marty.net 1001 Postcards Love Love Love Meep Meep ZenZodiac DailyQuotation

YOU ARE HERE:
Product Type Numbers String = "Product Typ" output

HOME

CPSHOP|

|

|

EMAIL MARTY
  marty.net message board
  « Product Type Numbers String = "Product Typ" output »
Welcome, Guest. Please Login or Register.
12/18/17 at 18:42:25
Home Help Search Login Register
   marty.net message board
   About cpshop
   Feature Requests
   Product Type Numbers String = "Product Typ" output
(Moderator: Marty)
Pages: « 1 2 3 4 5 6 » Reply Notify of replies Send the topic Print 
   Author  Topic: Product Type Numbers String = "Product Typ" output  (Read 9412 times)
brattytees
Gold Dragon
****

Posts: 439



ack!
   

Re: Product Type Numbers String = "Product Typ" ou
« Reply #45 on: 12/09/11 at 20:19:19 »
Reply with quote Modify message

You know, I've always wondered if my cpshop.cgi files were mucked up. I've never had luck doing anything in them, I think there's something missing or something because if you try to use the $hacked part you always get a server error when you set it to 1. I just went back to look at an original I had saved from like 2006, but it's the same as all my current ones.   That's why I've always done everything inside the cppage and cpdata libs and lately the separate lib.
« Last Edit: 12/09/11 at 20:20:26 by brattytees » Logged
brattytees
Gold Dragon
****

Posts: 439



ack!
   

Re: Product Type Numbers String = "Product Typ" ou
« Reply #46 on: 12/09/11 at 20:24:32 »
Reply with quote Modify message



on 12/09/11 at 19:34:36, Hex Angel - Patrick wrote:
1. In the (fixed) page source, did you take out the class when you fixed it?

2. Also, i think you could save yourself one search through the content if you rewrote the clean_product_name call this way, and replace the h2 tags with it.


Code:
$content =~ s/(<div id\=\"productCaption\" class\=\"pageTitle head\"><h1>)(.*?)(<\/h1>)/@{[clean_product_name(\%product_names,$2,$producttypeno,'<div id="productCaption" class="pageTitle head"><h2 class="productCaption">','</h2></div>')]}/si; # product detail title

1. I'm not sure I follow you. The only thing I changed was the h1's to h2's.

2. Thanks, that's what I was going to do after I got this other stuff settled down. I just happened to have that regex already so I threw it in there for a quick temp fix.
Logged
Hex Angel - Patrick
Gold Dragon
****

Posts: 500



Our nature lies in movement; complete calm is death.
   

WWW
Re: Product Type Numbers String = "Product Typ" ou
« Reply #47 on: 12/09/11 at 21:05:18 »
Reply with quote Modify message

Page source product name (fixed)


Code:
<h2 class="productCaption">Naughty, Spank Me Women's Plus Size V-Neck Dark T-Shirt</h2>




Code:
$content =~ s/(<div id\=\"productCaption\" class\=\"pageTitle head\"><h1>)(.*?)(<\/h1>)/@{[clean_product_name(\%product_names,$2,$producttypeno,$1,$3)]}/si; # product detail title


I'm just a bit confused by this...

The first thing I notice, is there's no id element appearing in the page source code. (sorry, i wrote 'class' above)
The second is the fixed h2s.
The third is that the product name isn't truncated.

The replacement code wouldn't have matched that source code string, because it's looking for an id element, so it wouldn't have replaced the product name.

So, if you're not also erasing the id element while you're fixing the h2s, then that could explain why the code isn't catching the product title.

On the other hand, the page source is showing the proper untruncated product name... so it looks like the code worked.

So it's a bit confusing.
Logged

CPSHOP
www.PeaceAndLoveShop.com Namaste
BLOG
www.TheNomadicSpirit.com Inspired by travel
www.GodBeautyPerfectionLove.com Inspired by spirit
www.MyMuseMoviesMusicAndBooks.com Inspired by the arts
Hex Angel - Patrick
Gold Dragon
****

Posts: 500



Our nature lies in movement; complete calm is death.
   

WWW
Re: Product Type Numbers String = "Product Typ" ou
« Reply #48 on: 12/09/11 at 21:08:05 »
Reply with quote Modify message



on 12/09/11 at 20:19:19, brattytees wrote:
You know, I've always wondered if my cpshop.cgi files were mucked up. I've never had luck doing anything in them, I think there's something missing or something because if you try to use the $hacked part you always get a server error when you set it to 1.


That's just plain odd.  I've gotten plenty of server errors after setting hacked=1, but everytime it's been something stupid i've done!    
Logged

CPSHOP
www.PeaceAndLoveShop.com Namaste
BLOG
www.TheNomadicSpirit.com Inspired by travel
www.GodBeautyPerfectionLove.com Inspired by spirit
www.MyMuseMoviesMusicAndBooks.com Inspired by the arts
brattytees
Gold Dragon
****

Posts: 439



ack!
   

Re: Product Type Numbers String = "Product Typ" ou
« Reply #49 on: 12/09/11 at 21:26:19 »
Reply with quote Modify message



on 12/09/11 at 21:05:18, Hex Angel - Patrick wrote:
Page source product name (fixed)


Code:
<h2 class="productCaption">Naughty, Spank Me Women's Plus Size V-Neck Dark T-Shirt</h2>




Code:
$content =~ s/(<div id\=\"productCaption\" class\=\"pageTitle head\"><h1>)(.*?)(<\/h1>)/@{[clean_product_name(\%product_names,$2,$producttypeno,$1,$3)]}/si; # product detail title


I'm just a bit confused by this...

The first thing I notice, is there's no id element appearing in the page source code. (sorry, i wrote 'class' above)
The second is the fixed h2s.
The third is that the product name isn't truncated.

The replacement code wouldn't have matched that source code string, because it's looking for an id element, so it wouldn't have replaced the product name.

So, if you're not also erasing the id element while you're fixing the h2s, then that could explain why the code isn't catching the product title.

On the other hand, the page source is showing the proper untruncated product name... so it looks like the code worked.

So it's a bit confusing.

It's there on the page, I'm not getting rid of it, I left it out when I pasted it in here. Sorry for the confusion!

Code:
<div id="productCaption" class="pageTitle head"><h2 class="productCaption">Naughty, Spank Me Women's Plus Size V-Neck Dark T-Shirt</h2></div>
Logged
brattytees
Gold Dragon
****

Posts: 439



ack!
   

Re: Product Type Numbers String = "Product Typ" ou
« Reply #50 on: 12/09/11 at 21:27:25 »
Reply with quote Modify message


on 12/09/11 at 21:08:05, Hex Angel - Patrick wrote:
That's just plain odd.  I've gotten plenty of server errors after setting hacked=1, but everytime it's been something stupid i've done!    

I could do/change absolutely nothing but change it to 1 and will get an error.

Now if I were to actually do something in there and get an error I wouldn't be surprised at all.  

Here's an untouched cgi file from the "instructions" to the end.

Code:
$hacked = 0;

if ($hacked) {

   # Your code here. You have $content, $breadcrumb and $pagetitle
   # to work with.  Have fun.

} else {
   &gettemplate;
   $html =~ s/<\[title\]>/$pagetitle/g;
   $html =~ s/<\[breadcrumb\]>/$breadcrumb/g;
   $html =~ s/<\[content\]>/$content/;

   unless (@ARGV) {
       print "Content-Type: text/html\n\n";
   }
   print $html;
   exit;
}

1;
« Last Edit: 12/10/11 at 00:00:30 by brattytees » Logged
Hex Angel - Patrick
Gold Dragon
****

Posts: 500



Our nature lies in movement; complete calm is death.
   

WWW
Re: Product Type Numbers String = "Product Typ" ou
« Reply #51 on: 12/09/11 at 22:39:15 »
Reply with quote Modify message



on 12/09/11 at 21:27:25, brattytees wrote:
I could do/change absolutely nothing but change it to 1 and will get an error.


OK - try this: change something inside a comment.

If that *still* generates an error, then it's likely the editor or ftp client, you're using, or how you've configured them. One or the other is adding something to the file that the perl interpolator doesn't like.

You can confirm that if you have file access to your server, either directly through a shell client or indirectly via a web control panel. Try editing your cpshop.cgi from there.

I used to run an amazon affiliate script on one of my other websites... had to edit that using an old dos-like unix editor called pico.  blech. But I couldn't find a windows editor that would allow me to even open the script and save it. Once uploaded, the script would crash every time.

Logged

CPSHOP
www.PeaceAndLoveShop.com Namaste
BLOG
www.TheNomadicSpirit.com Inspired by travel
www.GodBeautyPerfectionLove.com Inspired by spirit
www.MyMuseMoviesMusicAndBooks.com Inspired by the arts
brattytees
Gold Dragon
****

Posts: 439



ack!
   

Re: Product Type Numbers String = "Product Typ" ou
« Reply #52 on: 12/09/11 at 22:58:09 »
Reply with quote Modify message



on 12/09/11 at 22:39:15, Hex Angel - Patrick wrote:
OK - try this: change something inside a comment.

There isn't anything in the file to change. See my above post with included cgi file. It does its thing as is, cpshop works, but change the 0 to 1 doing nothing else and you get a server error.

I use EditPlus for a text editor, have been for ages, and I use WinSCP for an ftp client along with its built in editor for editing files directly on the server. If either of these were adding anything wouldn't all my other perl files be corrupt too?

I see what you're getting at, but I don't think that editor is the issue here.
Logged
Hex Angel - Patrick
Gold Dragon
****

Posts: 500



Our nature lies in movement; complete calm is death.
   

WWW
Re: Product Type Numbers String = "Product Typ" ou
« Reply #53 on: 12/10/11 at 01:11:43 »
Reply with quote Modify message

I understand your frustration. Really, I've been there. It sucks.

Could you indulge my curiosity...what happens if you make this edit?

from


Code:
# to work with.  Have fun.



Code:
# to work with.  Have fun.... omfg -- you call this fun?



If that still blows up, then the interpreter's not failing on any kind of logical flaw. The addition should be invisible to it.

I would be more surprised if it doesn't.
Logged

CPSHOP
www.PeaceAndLoveShop.com Namaste
BLOG
www.TheNomadicSpirit.com Inspired by travel
www.GodBeautyPerfectionLove.com Inspired by spirit
www.MyMuseMoviesMusicAndBooks.com Inspired by the arts
Hex Angel - Patrick
Gold Dragon
****

Posts: 500



Our nature lies in movement; complete calm is death.
   

WWW
Re: Product Type Numbers String = "Product Typ" ou
« Reply #54 on: 12/10/11 at 01:13:08 »
Reply with quote Modify message

Oh... silly question, but....

What happens if you do your stuff in the no hacking part, and don't set the hacked to 1?
Logged

CPSHOP
www.PeaceAndLoveShop.com Namaste
BLOG
www.TheNomadicSpirit.com Inspired by travel
www.GodBeautyPerfectionLove.com Inspired by spirit
www.MyMuseMoviesMusicAndBooks.com Inspired by the arts
brattytees
Gold Dragon
****

Posts: 439



ack!
   

Re: Product Type Numbers String = "Product Typ" ou
« Reply #55 on: 12/10/11 at 15:22:28 »
Reply with quote Modify message



on 12/10/11 at 01:11:43, Hex Angel - Patrick wrote:
I understand your frustration. Really, I've been there. It sucks.

Could you indulge my curiosity...what happens if you make this edit?

from


Code:
# to work with.  Have fun.



Code:
# to work with.  Have fun.... omfg -- you call this fun?



If that still blows up, then the interpreter's not failing on any kind of logical flaw. The addition should be invisible to it.

I would be more surprised if it doesn't.

I see what you're saying now. Adding something into a comment doesn't make any difference. Everything still works fine, assuming I leave 0 at 0, you know.
Logged
brattytees
Gold Dragon
****

Posts: 439



ack!
   

Re: Product Type Numbers String = "Product Typ" ou
« Reply #56 on: 12/10/11 at 15:30:14 »
Reply with quote Modify message



on 12/10/11 at 01:13:08, Hex Angel - Patrick wrote:
Oh... silly question, but....

What happens if you do your stuff in the no hacking part, and don't set the hacked to 1?

That's not a silly question at all. I've been able to get some stuff to work down there, avoiding the hacked and 1 part altogether. But in the long run it's still simpler to hack the lib files or put what I can in the hack lib file.
Logged
brattytees
Gold Dragon
****

Posts: 439



ack!
   

Re: Product Type Numbers String = "Product Typ" ou
« Reply #57 on: 12/10/11 at 15:55:29 »
Reply with quote Modify message

You know, I was reading this other thread about changing the breadcrum trail and I saw this

Quote:
Open cpshop.cgi and find the line that reads.


Code:
$hacked = 0;


Change it to


Code:
$hacked = 1;


A few lines further down, you'll find this code section (it appears in cpshop.cgi twice, you want the first one)


Code:
    # use cpshop to get our template and fill it with our content.
  &gettemplate;
  $html =~ s/<\[title\]>/$pagetitle/g;
  $html =~ s/<\[breadcrumb\]>/$breadcrumb/g;

It doesn't appear in mine twice as I posted above.

Oh, and just for giggles and grins, I downloaded the latest Full update last night to see if something changed, and that cgi file looks just like mine. So what changed and when?
« Last Edit: 12/10/11 at 16:04:37 by brattytees » Logged
brattytees
Gold Dragon
****

Posts: 439



ack!
   

Re: Product Type Numbers String = "Product Typ" ou
« Reply #58 on: 12/10/11 at 20:02:02 »
Reply with quote Modify message

So after playing around with it some, I guess my cgi file was missing some important stuff up in the hacked section, I always thought it didn't look right. I got it to where I can change it to 1 without throwing an error. But right now I really don't care (too much) about that. I've lived with it all along.

Can you explain to me why this

Code:
$breadcrumb =~ s/((T-Shirt|Sweatshirt|Hoodie)|(Junior Jersey) (T-shirt)) (\(dark\)|\(dark|\(dar|\(da|\(d|\()/$3 Dark $2$4/;
$productname =~ s/((T-Shirt|Sweatshirt|Hoodie)|(Junior Jersey) (T-shirt)) (\(dark\)|\(dark|\(dar|\(da|\(d|\()/$3 Dark $2$4/;
$content =~ s/((T-Shirt|Sweatshirt|Hoodie)|(Junior Jersey) (T-shirt)) (\(dark\)|\(dark|\(dar|\(da|\(d|\()/$3 Dark $2$4/g;

works to change everything on the page, yes breadcrumb and all, but this doesn't

Code:
$breadcrumb =~ s/(.*?<span class\=\"cpshopbreadcrumbtext\">)(.*)(<\/span>.*$)/@{[clean_product_name($hash_ref,$2,$producttypeno,$1,$3)]}/si;  # careful, this is all one line!

They're both in my hack lib file, along with the relevant code to change your breadcrumb string.

« Last Edit: 12/10/11 at 20:30:55 by brattytees » Logged
brattytees
Gold Dragon
****

Posts: 439



ack!
   

Re: Product Type Numbers String = "Product Typ" ou
« Reply #59 on: 12/11/11 at 19:22:05 »
Reply with quote Modify message

Finally got the breadcrumb! Changed this

Code:
$breadcrumb =~ s/(.*?<span class\=\"cpshopbreadcrumbtext\">)(.*)(<\/span>.*$)/@{[clean_product_name($hash_ref,$2,$producttypeno,$1,$3)]}/si;

to this

Code:
$breadcrumb =~ s/(.*?<span class\=\"cpshopbreadcrumbtext\">)(.*)(<\/span>.*$)/@{[clean_product_name(\%product_names,$2,$producttypeno,$1,$3)]}/si;

And I got it to work in my hacked lib file.
« Last Edit: 12/11/11 at 19:24:28 by brattytees » Logged
Pages: « 1 2 3 4 5 6 » Reply Notify of replies Send the topic Print 
Jump to:


marty.net message board (http://www.marty.net/cgi/marty/board/messageboard)

Powered by YaBB 1 Gold - Release (Yet Another Bulletin Board)
Copyright 2000-2001, X-Null. All Rights Reserved.