emediastudios Posted March 5, 2009 Share Posted March 5, 2009 I recently had someone fix this code up for me to show prices if logged in and not to if not logged in. Works like a charm. <?php if(modApiFunc('Customer_Account','getCurrentSignedCustomer') !== null) { ProductSalePrice(); }else{ echo"<A HREF=\""; PageURL('CustomerSignIn'); echo"\">Sign In</A> | <A HREF=\""; PageURL('CustomerSignIn'); echo"\">Register</A>"; } ?> What i need now is to replace the ProductSalePrice(); to show the add to cart button if logged in and the the lower part of the code if not, register sign in. the add to cart button is as follows. <!-- Add to Cart Button --> <TD align="left"> <IMG SRC="images/add_to_cart_button.gif" WIDTH="96" HEIGHT="18" BORDER=0 ALT="" onClick="<?php Local_ProductAddToCart(); ?>" style="cursor: pointer;"> </TD> Thanks for any help, this has to be my last issue with this site. Quote Link to comment Share on other sites More sharing options...
samshel Posted March 5, 2009 Share Posted March 5, 2009 u already solved ur problem... if u want to replace ProductSalePrice(); with add to cart, go ahead and replace in the code.... Quote Link to comment Share on other sites More sharing options...
Stephen68 Posted March 5, 2009 Share Posted March 5, 2009 You just want to add the add to cart button under the price function? <?php if(modApiFunc('Customer_Account','getCurrentSignedCustomer') !== null) { ProductSalePrice(); echo "<p>"; echo "<IMG SRC=\"images/add_to_cart_button.gif\" WIDTH=\"96\" HEIGHT=\"18\" BORDER=0 ALT=\"\" onClick=\"".Local_ProductAddToCart()."\" style=\"cursor: pointer;\">"; }else{ echo"<A HREF=\""; PageURL('CustomerSignIn'); echo"\">Sign In</A> | <A HREF=\""; PageURL('CustomerSignIn'); echo"\">Register</A>"; } ?> Not sure if that will work since I can not test it, let me know if it helps out any. Quote Link to comment Share on other sites More sharing options...
emediastudios Posted March 5, 2009 Author Share Posted March 5, 2009 here is the site link http://extremehairextensions.com.au/store/product-info.php?pid80.html at the bottom is at to cart button. The code half works, (on localhost testing, overwrite site file when workind), it shows the sign in - register if not signed in but shows $54.95 javascript: ProductFormSubmit_36(); if signed in, your getting there Quote Link to comment Share on other sites More sharing options...
emediastudios Posted March 5, 2009 Author Share Posted March 5, 2009 I altered you code a little <?php if(modApiFunc('Customer_Account','getCurrentSignedCustomer') !== null) { echo "<IMG SRC=\"images/add_to_cart_button.gif\" WIDTH=\"96\" HEIGHT=\"18\" BORDER=0 ALT=\"\" onClick=\"".Local_ProductAddToCart()."\" style=\"cursor: pointer;\">"; }else{ echo"<A HREF=\""; PageURL('CustomerSignIn'); echo"\">Sign In</A> | <A HREF=\""; PageURL('CustomerSignIn'); echo"\">Register</A>"; } ?> Does the right thing if not signed in, but shows this and no button if they are - javascript: ProductFormSubmit_36(); Quote Link to comment Share on other sites More sharing options...
Stephen68 Posted March 5, 2009 Share Posted March 5, 2009 Don't know what javascript: ProductFormSubmit_36(); is you would have to post some code Quote Link to comment Share on other sites More sharing options...
emediastudios Posted March 5, 2009 Author Share Posted March 5, 2009 This is a snippet from the page code on server <tr> <td> </td> <td style="padding-top: 20px; padding-bottom: 20px;" valign="top" align="right"> <table width="100%" border="0" cellpadding="3" cellspacing="0"> <tbody><tr> <!-- Quantity Select --> <td width="10%" align="left" nowrap="nowrap"> Quantity: <select name="quantity_in_cart"> <option value="1" selected="selected">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option> </select> </td> <!-- Add to Cart Button --> <td align="left"> javascript: ProductFormSubmit_36();<img src="http://localhost/extremehairextensions/shop/avactis-templates/catalog/product-info/default/%22images/add_to_cart_button.gif%22" alt="" onclick="" style="cursor: pointer;" width="96" border="0" height="18"> </td> </tr> </tbody></table> </td> </tr> Thanks for all you help stephen Quote Link to comment Share on other sites More sharing options...
Stephen68 Posted March 5, 2009 Share Posted March 5, 2009 I don't know a lot about JS but shouldn't there be script tags around that call to the function? Heading to sleep land, maybe cya tomrrow Quote Link to comment Share on other sites More sharing options...
blueman378 Posted March 5, 2009 Share Posted March 5, 2009 well no what i think its meant to be is <img src="http://localhost/extremehairextensions/shop/avactis-templates/catalog/product-info/default/%22images/add_to_cart_button.gif%22" alt="" onclick="ProductFormSubmit_36()" style="cursor: pointer;" width="96" border="0" height="18"> Quote Link to comment Share on other sites More sharing options...
emediastudios Posted March 5, 2009 Author Share Posted March 5, 2009 i added you input to my code as follows. Is an error still there, not working <?php if(modApiFunc('Customer_Account','getCurrentSignedCustomer') !== null) { echo "<img src="http://localhost/extremehairextensions/shop/avactis-templates/catalog/product-info/default/%22images/add_to_cart_button.gif%22" alt="" onclick="ProductFormSubmit_36()" style="cursor: pointer;" width="96" border="0" height="18">"; }else{ echo"<A HREF=\""; PageURL('CustomerSignIn'); echo"\">Sign In</A> | <A HREF=\""; PageURL('CustomerSignIn'); echo"\">Register</A>"; } ?> Quote Link to comment Share on other sites More sharing options...
emediastudios Posted March 5, 2009 Author Share Posted March 5, 2009 please anyone! certainly its not too difficult for some of you phpfreak masters! This will put an end to my month long nightmare with this client. Quote Link to comment Share on other sites More sharing options...
Stephen68 Posted March 5, 2009 Share Posted March 5, 2009 Just find out where the button is stored first, then write the code to go where the button image is. <?php echo "<IMG SRC=\"images/add_to_cart_button.gif\" WIDTH=\"96\" HEIGHT=\"18\" BORDER=0 ALT=\"\" onClick=\"".Local_ProductAddToCart()."\" style=\"cursor: pointer;\">"; ?> This code tells me that the image you are looking for is in the same directory you are in the image directory. Check and see if it is there I guess. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.