Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
Forum Search
Google Site Search
 All Forums
 Technical
 PHP (Unix / Linux / Apache) versions
 Add item to Cart directly code
Author « Topic »  

ardade
Advanced Member

257 Posts

Pre-sales questions only
(More Details...)

Posted - 07/31/2019 :  07:23:29  
What is the link to the PHP code to post an item to the cart? I used the code below that I got from my ASP version but it does not work. It shows the slider image and gets you to the cart when you click on it but it does not add the item to the cart. The test web page is at https://www.waldenfarms.com/index4.php



<li>
<form method="post" action="cart.asp">
<input type="hidden" name="id" value="88071">
<input type="hidden" name="mode" value="add">
<input type="image" src="banners/maplebaconsyrup.jpg">
</form>
<!--<a href="products.php?cat=Syrups"> <img src="banners/maplebaconsyrup.jpg" alt="Maple Bacon Syrup" /></a>-->
<!--<p class="caption">This is banner one ... </p>-->
</li>

Edited by - ardade on 07/31/2019 07:54:20

Vince
Administrator

42874 Posts

Posted - 07/31/2019 :  08:05:25  
Hi Ardade
You have the action of the form to cart.asp but that should be cart.php
Also, I'm not sure how you are triggering this. Should it have for instance a submit button for the form?

<form method="post" action="cart.php">
<input type="hidden" name="id" value="88071">
<input type="hidden" name="mode" value="add">
<input type="image" src="banners/maplebaconsyrup.jpg">
<input type="submit" value="Submit" />
</form>

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

ardade
Advanced Member

257 Posts

Pre-sales questions only
(More Details...)

Posted - 07/31/2019 :  08:51:14  
Thanks! is was the cart.asp causing the issue, duh. I used cart.php without a submit and it works perfectly.

ardade
Advanced Member

257 Posts

Pre-sales questions only
(More Details...)

Posted - 07/31/2019 :  10:04:39  
The only thing I did notice is that the image used for the button does not resize itself like the other images do. I imagine becuase its within the form and maybe that cannot get resized. I suppose I could clone this page and have a redirect at for cell phone resolutions.


<div class="callbacks_container">
<ul class="rslides" id="slider3">
<li>
<form method="post" action="cart.php">
<input type="hidden" name="id" value="88071">
<input type="hidden" name="mode" value="add">
<input type="image" src="banners/maplebaconsyrup.jpg">
</form>
<!--<a href="products.php?cat=Syrups"> <img src="banners/maplebaconsyrup.jpg" alt="Maple Bacon Syrup" /></a>-->

</li>
<li>
<a href="products.php?cat=Salad+Dressings"> <img src="banners/saladdressing.jpg" alt="Salad Dressings" /></a>

</li>

<li>
<a href="products.php?cat=BBQ+Sauces"> <img src="banners/bbq.jpg" alt="BBQ Sauces" /></a>

</li>
<li>
<a href="products.php?cat=Sweet+Dips"> <img src="banners/sweetdips.jpg" alt="Sweet Dips" /></a>

</li>

<li>
<a href="products.php?cat=Syrups"><img src="banners/syrups.jpg" alt="Syrups" /></a>

</li>


</ul>
</div>

Vince
Administrator

42874 Posts

Posted - 07/31/2019 :  15:14:51  
Hi Ardade
It's more likely to do with the class that is applied to the image. Try adding the same class that you have on other images, or create a new class and set dimensions for that.

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

ardade
Advanced Member

257 Posts

Pre-sales questions only
(More Details...)

Posted - 08/02/2019 :  07:52:48  
Thanks Vince! Your right, i added the class to the image and its working perfectly now.

<form method="post" action="cart.php">
<input type="hidden" name="id" value="88071">
<input type="hidden" name="mode" value="add">
<input type="image" img class="rslides" src="banners/maplebaconsyrup.jpg" alt="Maple Bacon Syrup" />
</form>
  « Topic »  
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.02 seconds. Snitz Forums 2000