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.
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?
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!!)
####################################################################### # 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.
Offline
Right on. And you'd need to edit as follows:
####################################################################### # 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.
Offline
excellent,... thanks ever so much Nick. U r a star!!
Offline
Just realised its not working. However all that was needed was the 'print' statement with the 'endtext' bits which now makes the complete 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. :-)
Offline