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 11-11-2004 13:43:31

myqee
Member
From: London - UK
Registered: 11-11-2004
Posts: 55
Website

Hack Request: Alternate 'add To Cart' Button

First, I am new here... Hi all!   :-)

oh... and fantastic software btw!!


Anyway, I would like to have the 'add to cart' button on the category & product list pages display as a greyed out image when there is no stock rather than not display at all. I know this is just aesthetics and not of any practical importance, but hey... its gota look right eh?  wink

Well I think I’ve found the right file and code to alter but apart from HTML, JavaScript, and the usual I have no Pearl skills so this is where I'm flummoxed.

Does anyone know how to edit this so when the particular product whatever it may be will be displayed as a different image which is inactive (no HREF link) in place of the usual 'add to cart' button? At the moment the code just removes the 'add to cart' button which is fine but I'm fussy with my webpage layouts and its upsetting my layout balance!!

Thanks.


File to edit: (I think!)

ccp51\cgi-bin\library\modules\ste_prod.pl

Code to edit: (I reckon!!)

Code:

#######################################################################
# Ste Prod Show AddToCart                                             #
#######################################################################

sub ste_prod_show_addtocart {

&initialize_sub_add('ste_prod_show_addtocart');

#########
######### This routine prints the add to cart button for products
######### where inventory levels allow you to add the item to the
######### cart.
#########

if ((($product_useinv eq "N") || ($product_useinv eq "Y" && $product_inv > "0")) && ($product_pricestatus ne "D") && ($product_pricestatus ne "N")) {

print <<ENDOFTEXT;

<INPUT TYPE="IMAGE" SRC="$images_path/button/submit_addtocart.gif" WIDTH="$site_button_image_width" HEIGHT="$site_button_image_height" BORDER="0" VALUE="submit">

ENDOFTEXT

} ######### End of if statement.

&initialize_sub_remove('ste_prod_show_addtocart');

} ######### End of subroutine.

myqee
_____________________________________________________________



  <-- My CCP Shop!
_____________________________________________________________

Offline

 

#2 11-11-2004 15:41:29

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Hack Request: Alternate 'add To Cart' Button

Right on.  And you'd need to edit as follows:

Code:


#######################################################################
# Ste Prod Show AddToCart                                             #
#######################################################################

sub ste_prod_show_addtocart {

&initialize_sub_add('ste_prod_show_addtocart');

#########
######### This routine prints the add to cart button for products
######### where inventory levels allow you to add the item to the
######### cart.
#########

if ((($product_useinv eq "N") || ($product_useinv eq "Y" && $product_inv > "0")) && ($product_pricestatus ne "D") && ($product_pricestatus ne "N")) {

print <<ENDOFTEXT;

<INPUT TYPE="IMAGE" SRC="$images_path/button/submit_addtocart.gif" WIDTH="$site_button_image_width" HEIGHT="$site_button_image_height" BORDER="0" VALUE="submit">

ENDOFTEXT

} else {

<IMG SRC="$images_path/button/submit_addtocart_disabled.gif" WIDTH="$site_button_image_width" HEIGHT="$site_button_image_height" BORDER="0">

} ######### End of if statement.

&initialize_sub_remove('ste_prod_show_addtocart');

} ######### End of subroutine.

Then save a file named 'submit_addtocart_disabled.gif' in the ./media/images/button directory.


Nick Hendler

Offline

 

#3 11-11-2004 15:53:01

myqee
Member
From: London - UK
Registered: 11-11-2004
Posts: 55
Website

Re: Hack Request: Alternate 'add To Cart' Button


excellent,... thanks ever so much Nick. U r a star!!

smile 


myqee
_____________________________________________________________



  <-- My CCP Shop!
_____________________________________________________________

Offline

 

#4 11-11-2004 16:36:16

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Hack Request: Alternate 'add To Cart' Button

It was a good idea.  I liked it.


Nick Hendler

Offline

 

#5 11-12-2004 11:25:52

myqee
Member
From: London - UK
Registered: 11-11-2004
Posts: 55
Website

Re: Hack Request: Alternate 'add To Cart' Button

Just realised its not working. However all that was needed was the 'print' statement with the 'endtext' bits which now makes the complete code:

Code:

#######################################################################
# Ste Prod Show AddToCart                                             #
#######################################################################

sub ste_prod_show_addtocart {

&initialize_sub_add('ste_prod_show_addtocart');

#########
######### This routine prints the add to cart button for products
######### where inventory levels allow you to add the item to the
######### cart.
#########

if ((($product_useinv eq "N") || ($product_useinv eq "Y" && $product_inv > "0")) && 

($product_pricestatus ne "D") && ($product_pricestatus ne "N")) {

print <<ENDOFTEXT;

<INPUT TYPE="IMAGE" SRC="$images_path/button/submit_addtocart.gif" WIDTH="$site_button_image_width" 

HEIGHT="$site_button_image_height" BORDER="0" VALUE="submit">

ENDOFTEXT

} else {

print <<ENDOFTEXT;

<IMG SRC="$images_path/button/submit_addtocart_disabled.gif" WIDTH="$site_button_image_width" 

HEIGHT="$site_button_image_height" BORDER="0">

ENDOFTEXT

} ######### End of if statement.

&initialize_sub_remove('ste_prod_show_addtocart');

} ######### End of subroutine.

Just another thought, maybe for V6?,...

instead of having a greyed out 'dead' add-to-cart button when an item is out of stock, as in the idea of this thread... how about a 'live' button that says 'email me when in stock' where the user is taken to a page to submit their email and name (also provides another opportunity to add a cumster to newsletter with a check box option on the page) and they will be send a notification email when the particular product is back in stock.

You may well have this idea already, just thought I'd mention it though.   :-)


myqee
_____________________________________________________________



  <-- My CCP Shop!
_____________________________________________________________

Offline

 

#6 11-12-2004 13:16:46

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Hack Request: Alternate 'add To Cart' Button

I like that idea a lot!  I've moved this to the CCP6 devel forum...


Nick Hendler

Offline

 

Board footer