Hello
In previous versions (1.4.9.x), if you had a link on an external website with the href set to this;
<a href="http://yourwebsite/index.php?route=chec ... quantity=1"> link! </a>
...it added a product to the cart. That doesn't work any more (I'm guessing because of the new Ajax cart, could be wrong).
Is there an updated URL/href to add products I could use?
many thanks
Matt
In previous versions (1.4.9.x), if you had a link on an external website with the href set to this;
<a href="http://yourwebsite/index.php?route=chec ... quantity=1"> link! </a>
...it added a product to the cart. That doesn't work any more (I'm guessing because of the new Ajax cart, could be wrong).
Is there an updated URL/href to add products I could use?
many thanks
Matt
Found it.
If anyone is interested, you can add a product to the (1.5.x) cart from an external website using this form structure;
<form action="http://yoursite/index.php?route=checkout/cart" method="post">
<input type="hidden" name="product_id" value="XX">
<input type="hidden" name="quantity" value="1">
<input type="submit" name="submit" value="submit">
</form>
where XX is the product ID number and 'yoursite' is obviously the domain of your shop.
Cheers
Matt
If anyone is interested, you can add a product to the (1.5.x) cart from an external website using this form structure;
<form action="http://yoursite/index.php?route=checkout/cart" method="post">
<input type="hidden" name="product_id" value="XX">
<input type="hidden" name="quantity" value="1">
<input type="submit" name="submit" value="submit">
</form>
where XX is the product ID number and 'yoursite' is obviously the domain of your shop.
Cheers
Matt
This is very useful.
What if I want to add another variable (a small additional piece of information) to be sent? How do I configure opencart 1.5x to do that?
Basically I want to send something similar to:
<form action="http://st3vieb.com/store/index.php?route=checkout/cart" id="personalVirtualPrivateServerForm" method="post">
<input type="hidden" name="product_id" value="80">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="info" value="whatever">
<a href="#" class="link" onClick="document.getElementById('personalVirtualPrivateServerForm').submit()">Purchase</a>
</form>
and have open cart receive product_id, quantity and info variables.
Is there a simple module that I could use that allows me to pass product_id, quantity and another variable (info) straight to the cart from a form/external link?
Steve
What if I want to add another variable (a small additional piece of information) to be sent? How do I configure opencart 1.5x to do that?
Basically I want to send something similar to:
<form action="http://st3vieb.com/store/index.php?route=checkout/cart" id="personalVirtualPrivateServerForm" method="post">
<input type="hidden" name="product_id" value="80">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="info" value="whatever">
<a href="#" class="link" onClick="document.getElementById('personalVirtualPrivateServerForm').submit()">Purchase</a>
</form>
and have open cart receive product_id, quantity and info variables.
Is there a simple module that I could use that allows me to pass product_id, quantity and another variable (info) straight to the cart from a form/external link?
Steve
nost3vieb wrote:This is very useful.
What if I want to add another variable (a small additional piece of information) to be sent? How do I configure opencart 1.5x to do that?
Basically I want to send something similar to:
<form action="http://st3vieb.com/store/index.php?route=checkout/cart" id="personalVirtualPrivateServerForm" method="post">
<input type="hidden" name="product_id" value="80">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="info" value="whatever">
<a href="#" class="link" onClick="document.getElementById('personalVirtualPrivateServerForm').submit()">Purchase</a>
</form>
and have open cart receive product_id, quantity and info variables.
Is there a simple module that I could use that allows me to pass product_id, quantity and another variable (info) straight to the cart from a form/external link?
Steve
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
It depends on what it is you want to send.
The only way I can see this working is if you have an option on the product set-up as a text input.
You should then be able to figure out what variable to send over
The only way I can see this working is if you have an option on the product set-up as a text input.
You should then be able to figure out what variable to send over
yes you can send over text options, but it would have to already be setup on that product and can't be dynamic.
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
I'm looking to send an alpha numeric string (its actually a domain name eg the string would be "whatever123.com") which would vary depending upon the domain that the user wishes to purchase. Thus the input text needs to be dynamic.
I've attempted using the "available options" (called options in opencart 1.5 admin area), but when viewing the source code for the product the code is an "option" and not "input type" and thus I couldn't send a dynamic variable - it had to be from a predifined option value as setup in the admin area. Same goes for using "attributes" in the admin section.
Code from product page (couldn't send dynamic variable due to not being an input type):
<div id="option-226" class="option">
<span class="required">*</span>
<b>Domain:</b><br />
<select name="option[226]">
<option value=""> --- Please Select --- </option>
</select>
</div>
Any thoughts on how to go about implementing a dynamic text-input? Or altering some opencart code so that "available options" can be sent values dynamically? It only needs to apply to one particular product if that helps.
BTW thankyou to all for help to date.
I've attempted using the "available options" (called options in opencart 1.5 admin area), but when viewing the source code for the product the code is an "option" and not "input type" and thus I couldn't send a dynamic variable - it had to be from a predifined option value as setup in the admin area. Same goes for using "attributes" in the admin section.
Code from product page (couldn't send dynamic variable due to not being an input type):
<div id="option-226" class="option">
<span class="required">*</span>
<b>Domain:</b><br />
<select name="option[226]">
<option value=""> --- Please Select --- </option>
</select>
</div>
Any thoughts on how to go about implementing a dynamic text-input? Or altering some opencart code so that "available options" can be sent values dynamically? It only needs to apply to one particular product if that helps.
BTW thankyou to all for help to date.
I totally agree.uksitebuilder wrote:It depends on what it is you want to send.
The only way I can see this working is if you have an option on the product set-up as a text input.
You should then be able to figure out what variable to send over
How do I go about implementing your suggestion?
When I do this in 1.5.2.1, I get the following error:elastic wrote: If anyone is interested, you can add a product to the (1.5.x) cart from an external website using this form structure;
<form action="http://yoursite/index.php?route=checkout/cart" method="post">
<input type="hidden" name="product_id" value="XX">
<input type="hidden" name="quantity" value="1">
<input type="submit" name="submit" value="submit">
</form>
where XX is the product ID number and 'yoursite' is obviously the domain of your shop.
Code: Select all
Warning: Invalid argument supplied for foreach() in /home/public_html/vqmod/vqcache/vq2-catalog_controller_checkout_cart.php on line 14Warning: Cannot modify header information - headers already sent by (output started at /home/public_html/index.php:104) in /home/public_html/vqmod/vqcache/vq2-system_engine_controller.php on line 28Warning: Cannot modify header information - headers already sent by (output started at /home/public_html/index.php:104) in /home/public_html/vqmod/vqcache/vq2-system_engine_controller.php on line 29
Code: Select all
13 if (!empty($this->request->post['quantity'])) {
14 foreach ($this->request->post['quantity'] as $key => $value) {
15 $this->cart->update($key, $value);
16 }
Code: Select all
27 protected function redirect($url, $status = 302) {
28 header('Status: ' . $status);
29 header('Location: ' . str_replace('&', '&', $url));
30 exit();
31 }
Last edited by scd1982 on Tue Apr 10, 2012 2:07 am, edited 2 times in total.
I usually forget to mention I'm using OC v1.4.9.4
Check out this post http://forum.opencart.com/viewtopic.php?t=14960 Depending on what version of OC you are running, there's a way to set a URL to add a product to the cart.alber99 wrote:anyone know how to apply "add to cart" functionality to a banner - so that customer can click header banner image on product page to add to cart ? The banner manager in admin only has an entry field for "link".
I usually forget to mention I'm using OC v1.4.9.4
I'm having the same issue, find any solutions yet?scd1982 wrote:When I do this in 1.5.2.1, I get the following error:elastic wrote: If anyone is interested, you can add a product to the (1.5.x) cart from an external website using this form structure;
<form action="http://yoursite/index.php?route=checkout/cart" method="post">
<input type="hidden" name="product_id" value="XX">
<input type="hidden" name="quantity" value="1">
<input type="submit" name="submit" value="submit">
</form>
where XX is the product ID number and 'yoursite' is obviously the domain of your shop.Lines 13, 14, 15 and 16 of /home/public_html/vqmod/vqcache/vq2-catalog_controller_checkout_cart.php:Code: Select all
Warning: Invalid argument supplied for foreach() in /home/public_html/vqmod/vqcache/vq2-catalog_controller_checkout_cart.php on line 14Warning: Cannot modify header information - headers already sent by (output started at /home/public_html/index.php:104) in /home/public_html/vqmod/vqcache/vq2-system_engine_controller.php on line 28Warning: Cannot modify header information - headers already sent by (output started at /home/public_html/index.php:104) in /home/public_html/vqmod/vqcache/vq2-system_engine_controller.php on line 29
Line 27, 28, 29, 30 and 31 of /home/public_html/vqmod/vqcache/vq2-system_engine_controller.php:Code: Select all
13 if (!empty($this->request->post['quantity'])) { 14 foreach ($this->request->post['quantity'] as $key => $value) { 15 $this->cart->update($key, $value); 16 }
I'm not sure why this is happening. Any thoughts?Code: Select all
27 protected function redirect($url, $status = 302) { 28 header('Status: ' . $status); 29 header('Location: ' . str_replace('&', '&', $url)); 30 exit(); 31 }
Check this post out, and see if it helps: http://forum.opencart.com/viewtopic.php?f=20&t=55340naturesfootprint wrote:I'm having the same issue, find any solutions yet?
It isn't exactly the same thing, but it gets the same result.
I usually forget to mention I'm using OC v1.4.9.4
Excellent! that works for getting the item into the cart and defining a quantity, but I can't figure out how to set up the variable option. I've got a product with three color options and somewhere the customer needs to select that color.scd1982 wrote:Check this post out, and see if it helps: http://forum.opencart.com/viewtopic.php?f=20&t=55340naturesfootprint wrote:I'm having the same issue, find any solutions yet?
It isn't exactly the same thing, but it gets the same result.
I haven't figured out the options yet either. A quick fix might be to setup 3 identical products, one for each color. Then set your form/link to point to the correct product (color) as necessary.naturesfootprint wrote:Excellent! that works for getting the item into the cart and defining a quantity, but I can't figure out how to set up the variable option. I've got a product with three color options and somewhere the customer needs to select that color.
I usually forget to mention I'm using OC v1.4.9.4
No, not as far as I can tell. Unless something has been developed to do this in the meantime??pooks wrote:Umm do you mean that there is no way to send product options from external site? Like color or size?
I usually forget to mention I'm using OC v1.4.9.4
None of these solutions seem to work for 1.5.4
This really should be a feature put into the base system
This really should be a feature put into the base system
Who is online
Users browsing this forum: No registered users and 73 guests