Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 02-17-2006 12:57:16

Laits
Member
From: Winchester, United Kingdom
Registered: 06-17-2005
Posts: 41

Adding Field To Category Product Regular Price Dis

Hi all,

Ok, I sell product in packs (wholesale) these pack sizes are variable between 3 and 10.

I have a field that has been created in product.csv called product_packsize, which carries the packsize value.

I have a lot of cutomers questioning if my price is for a single item or the pack.

So to make things clear in the Cat prod display Id like it to say for example
'£32.94 for a pack of 6'

I have Identified 'Category Product Regular Price Display' as the place to change this with half successful results, I can get it to say '£32.94 for a pack of' but cant get it to call the packsize. I guessed at it being:-

<BR>(CGIVAR)currency_symbol(/CGIVAR)(CGIVAR)product_regprice(/CGIVAR) in pack of (CGIVAR)product_packsize(/CGIVAR)

(CGIVAR)product_packsize(/CGIVAR) doesn't work.



Its in the same table as (CGIVAR)product_regprice(/CGIVAR)!

I know as with most things on CCP that this must be possible, and I probably just have to enter something in another table.

Please Help!!!  :-(

Rich

Offline

 

#2 02-17-2006 13:27:08

rachaelseven
Member
From: Massachusetts, USA
Registered: 01-23-2006
Posts: 3169
Website

Re: Adding Field To Category Product Regular Price Dis

Actually, I don't think your problem is related to your table - it sounds like you added the column properly.  I believe the problem is that the script ste_prod.pl is not querying the database for your new column, so the value is not getting assigned to a CGIVAR.  It should be possible to mod ste_prod.pl to make this work.  If you're comfortable with this sort of editting, here is what I think will work.  First, make a backup of ccp51/cgi-bin/library/modules/ste_prod.pl.  Then open the original in a text editor, like notepad, and make the following changes:

First locate the subroutine ste_prod_detail and find:

Code:

#########
######### Build the column line.
#########

$column_line = "product_id,product_name,product_number,product_pricestatus,product_regprice,product_saleprice,product_volprice,product_voltext,product_recurprice,product_recurstatus,product_keywords,product_usecatdisc,product_useinv,product_inv,product_imgxlguse,product_imgxlg,product_imglg,product_imgsm,product_lgdisp,product_descshort,product_desclong,product_xopt";

and change to:

Code:

#########
######### Build the column line.
#########

$column_line = "product_id,product_name,product_number,product_pricestatus,product_regprice,product_saleprice,product_volprice,product_voltext,product_recurprice,product_recurstatus,product_keywords,product_usecatdisc,product_useinv,product_inv,product_imgxlguse,product_imgxlg,product_imglg,product_imgsm,product_lgdisp,product_descshort,product_desclong,product_xopt,product_packsize";

And then further down in the same subroutine find:

Code:

#########
######### Loop through the returned product array.
#########

foreach $row(@proddetail) {

($product_id,$product_name,$product_number,$product_pricestatus,$product_regprice,$product_saleprice,$product_volprice,$product_voltext,$product_recurprice,$product_recurstatus,$product_keywords,$product_usecatdisc,$product_useinv,$product_inv,$product_imgxlguse,$product_imgxlg,$product_imglg,$product_imgsm,$product_lgdisp,$product_descshort,$product_desclong,$product_xopt) = @$row;

and change to:

Code:

#########
######### Loop through the returned product array.
#########

foreach $row(@proddetail) {

($product_id,$product_name,$product_number,$product_pricestatus,$product_regprice,$product_saleprice,$product_volprice,$product_voltext,$product_recurprice,$product_recurstatus,$product_keywords,$product_usecatdisc,$product_useinv,$product_inv,$product_imgxlguse,$product_imgxlg,$product_imglg,$product_imgsm,$product_lgdisp,$product_descshort,$product_desclong,$product_xopt,$product_packsize) = @$row;

I believe that will get the (CGIVAR)product_packsize(/CGIVAR) call to work properly and you shouldn't need to make any changes to the category regular price display you have now.    I'm not 100% sure though, so be prepared to go back to your backup of ste_prod.pl if it doesn't work as expected.  And if anyone else has any input about whether or not I have this right, please feel free to chime in.

Good luck,
Rachael 


Rachael Katz
- Custom Focusing Screens for DSLR Cameras

Offline

 

#3 02-17-2006 14:04:48

Laits
Member
From: Winchester, United Kingdom
Registered: 06-17-2005
Posts: 41

Re: Adding Field To Category Product Regular Price Dis

Ahh, thats the kind of reply i way hoping for...but it hasn't worked! Any other Ideas?

Thanks for the effort!

Rich

Offline

 

#4 02-17-2006 14:18:47

Laits
Member
From: Winchester, United Kingdom
Registered: 06-17-2005
Posts: 41

Re: Adding Field To Category Product Regular Price Dis

My apologies, if i'd entered the code where you'd told me, and not somewhere similar then it would have worked!

Working a treat now.

A+ for you!

Many, many thanks



Tich

Offline

 

#5 02-17-2006 14:34:37

rachaelseven
Member
From: Massachusetts, USA
Registered: 01-23-2006
Posts: 3169
Website

Re: Adding Field To Category Product Regular Price Dis

You're very welcome.  I'm glad it worked!

Rachael :-)


Rachael Katz
- Custom Focusing Screens for DSLR Cameras

Offline

 

#6 02-17-2006 15:15:47

Laits
Member
From: Winchester, United Kingdom
Registered: 06-17-2005
Posts: 41

Re: Adding Field To Category Product Regular Price Dis

Hi Racheal,

Sorry spoke too soon.

With the new code in place, If i click on a product in the category, it doesn't display anything!

I put the back up of the pl file back (pre changes) and it works again (but without the said mod obviously)

But interestingly in product detail, the same text 'in a pack of' appears after price.

Does product_packsize have to be entered have to be accounted for in another pl file?

Sorry for my lack of programming jargon...lol

The following error message appears when i viewed the source of the black prod detail page, that maybe you can dechipher.

<!-- DISPLAY ERROR: SUBROUTINE ste_prod_detail GENERATED MESSAGE: DBD::AnyData::st fetchall_arrayref failed: Attempt to fetch row from a Non-SELECT statement at /home/users/web3643/html/gifted-dreams.co.uk/cgi-bin/library/common/database.pl line 626.



SELECT product_id,product_name,product_number,product_pricestatus,product_regprice,product_saleprice,product_volprice,product_voltext,product_recurprice,product_recurstatus,product_keywords,product_usecatdisc,product_taxcountry,product_useinv,product_inv,product_imgxlguse,product_imgxlg,product_imglg,product_imgsm,product_lgdisp,product_descshort,product_desclong,product_xopt,
FROM product
WHERE product_id='bac0022'

-->

This is my test installation of CCP so that i can test stuff like this, as my real site can't afford any downtime, so don't mind experimenting with any suggestions you have!

I really appriciate your help

Offline

 

#7 02-17-2006 15:39:34

rachaelseven
Member
From: Massachusetts, USA
Registered: 01-23-2006
Posts: 3169
Website

Re: Adding Field To Category Product Regular Price Dis

If you look at the end of the line of the error message that starts with "SELECT", it seems to terminate with a comma, rather than with product_packsize.  Are you sure you got the code in correctly?  Also, I think the same change may have to be made in another spot to get it totally working.  Let me keep looking at the code while you check your changes.

Rachael


Rachael Katz
- Custom Focusing Screens for DSLR Cameras

Offline

 

#8 02-17-2006 15:54:33

rachaelseven
Member
From: Massachusetts, USA
Registered: 01-23-2006
Posts: 3169
Website

Re: Adding Field To Category Product Regular Price Dis

Ok, I think the instructions I gave you should work to get the new field in the product detail display.  But if you also want it in the category product disply (which you originally asked for actually), I think there are two more changes to ste_prod.pl.

In the subroutine ste_prod_disp, find:

Code:

#########
######### Build the column line.
#########

$column_line = "product_id,product_name,product_number,product_pricestatus,product_regprice,product_saleprice,product_volprice,product_voltext,product_recurprice,product_recurstatus,product_usecatdisc,product_useinv,product_inv,product_imglg,product_imgsm,product_descshort,product_desclong";

#########
######### Here we dynamically build the SQL call to retrieve a count
######### of either matched search items or all items in the 
######### table.
#########

and change to:

Code:

#########
######### Build the column line.
#########

$column_line = "product_id,product_name,product_number,product_pricestatus,product_regprice,product_saleprice,product_volprice,product_voltext,product_recurprice,product_recurstatus,product_usecatdisc,product_useinv,product_inv,product_imglg,product_imgsm,product_descshort,product_desclong,product_packsize";

#########
######### Here we dynamically build the SQL call to retrieve a count
######### of either matched search items or all items in the 
######### table.
#########

Then, in the subroutine ste_prod_show, find:

Code:

#########
######### Loop through the array of products and print info as we
######### find it.
#########

foreach $row(@proddisp) {

($product_id,$product_name,$product_number,$product_pricestatus,$product_regprice,$product_saleprice,$product_volprice,$product_voltext,$product_recurprice,$product_recurstatus,$product_usecatdisc,$product_useinv,$product_inv,$product_imglg,$product_imgsm,$product_descshort,$product_desclong) = @$row;

$product_descshort = display_parse_string($product_descshort);
$product_desclong = display_parse_string($product_desclong);

and change to:

Code:

#########
######### Loop through the array of products and print info as we
######### find it.
#########

foreach $row(@proddisp) {

($product_id,$product_name,$product_number,$product_pricestatus,$product_regprice,$product_saleprice,$product_volprice,$product_voltext,$product_recurprice,$product_recurstatus,$product_usecatdisc,$product_useinv,$product_inv,$product_imglg,$product_imgsm,$product_descshort,$product_desclong,$product_packsize) = @$row;

$product_descshort = display_parse_string($product_descshort);
$product_desclong = display_parse_string($product_desclong);

I don't have a test site up at the moment to play with, so I can't actually test this.  But I'm pretty sure if you get all 4 changes right, it should work for both the category displays and the product detail displays.  It shouldn't affect anything else, since all we've done is add a variable to the SQL call... unless it generates an error, which I don't think it should.  If you want to give me FTP access to your test site (in a PM, obviously), I'd be happy to try it out for you.

Rachael


Rachael Katz
- Custom Focusing Screens for DSLR Cameras

Offline

 

#9 02-17-2006 16:14:12

Laits
Member
From: Winchester, United Kingdom
Registered: 06-17-2005
Posts: 41

Re: Adding Field To Category Product Regular Price Dis

Hey Rachael,

I'm so thankful for your help, you really know your stuff.

It probably was my dodgy typing that did it!

I've changed all 4 lines in the pl from scratch and now working perfectly.

Can't thank you enough.

Rich

Offline

 

#10 05-29-2007 14:40:37

carasmo
Member
From: Florida
Registered: 10-07-2002
Posts: 147
Website

Re: Adding Field To Category Product Regular Price Dis

Thank YOU!!

I followed these instructions and it worked on the product display, but now I want to display the new field on the ste_cart_contu page and it doesn't work.

How would I add the same field to show up in the cart (I don't need to track it).

Thank you for any help.

Last edited by carasmo (05-29-2007 14:41:38)

Offline

 

#11 05-29-2007 14:46:45

rachaelseven
Member
From: Massachusetts, USA
Registered: 01-23-2006
Posts: 3169
Website

Re: Adding Field To Category Product Regular Price Dis

The cart page is only displaying details from the customer's temporary shopping cart table - it doesn't pull anything from the product table to generate that page.  So the cart cannot display anything that isn't stored in the cart and tracked with the order.  Sorry.


Rachael Katz
- Custom Focusing Screens for DSLR Cameras

Offline

 

#12 05-29-2007 15:10:23

carasmo
Member
From: Florida
Registered: 10-07-2002
Posts: 147
Website

Re: Adding Field To Category Product Regular Price Dis

It appears that this thread discusses it:

https://forum.kryptronic.com/viewtopic.php?id=4500

But it's not as clear cut as your instructions. I have a product_smid (a small number that is not as long) and that is in the product display and the category display, I just want to display it on the cart page.

Just not going to give up so soon. ;-)

Offline

 

#13 05-29-2007 15:28:40

rachaelseven
Member
From: Massachusetts, USA
Registered: 01-23-2006
Posts: 3169
Website

Re: Adding Field To Category Product Regular Price Dis

Oh it could be done and you needn't give up.  But to show that information on the cart page, you will have to modify the configuration of the cart tables, reconfigure the trackitem table to store the information, modify the add to cart PERL routines to put that information into the tables, modify the PERL that displays the cart to retrieve the information, and unless you want a new empty column in the trackitem table, you might have to modify the checkout routines to store the new information.  Since you said you didn't need to track this information, I assumed (perhaps incorrectly), that it wouldn't be worth modifications as extensive as that.  If you want to have a go at it, the post you referenced is as good as any.  Good luck!


Rachael Katz
- Custom Focusing Screens for DSLR Cameras

Offline

 

Board footer