Post by elastic » Wed Jun 22, 2011 12:31 am

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

Newbie

Posts

Joined
Wed Jun 22, 2011 12:17 am

Post by elastic » Wed Jun 22, 2011 6:14 pm

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

Newbie

Posts

Joined
Wed Jun 22, 2011 12:17 am

Post by st3vieb » Tue Sep 13, 2011 10:04 am

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

Newbie

Posts

Joined
Wed Jul 06, 2011 12:43 pm

Post by Xsecrets » Tue Sep 13, 2011 11:29 am

st3vieb 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
no

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by st3vieb » Tue Sep 13, 2011 2:37 pm

Is anyone aware of any way to send dynamic variables other than "product_id" and "quantity" to the cart from an external form?

I need to get this done.

Newbie

Posts

Joined
Wed Jul 06, 2011 12:43 pm

Post by uksitebuilder » Tue Sep 13, 2011 6:05 pm

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

ImageImageImageImageImage

For Friendly Professional Support - Click Here


User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by Xsecrets » Tue Sep 13, 2011 9:44 pm

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


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by st3vieb » Wed Sep 14, 2011 11:58 am

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.

Newbie

Posts

Joined
Wed Jul 06, 2011 12:43 pm

Post by st3vieb » Wed Sep 14, 2011 12:24 pm

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
I totally agree.

How do I go about implementing your suggestion?

Newbie

Posts

Joined
Wed Jul 06, 2011 12:43 pm

Post by scd1982 » Sat Apr 07, 2012 4:13 am

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.
When I do this in 1.5.2.1, I get the following error:

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
Lines 13, 14, 15 and 16 of /home/public_html/vqmod/vqcache/vq2-catalog_controller_checkout_cart.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		}
Line 27, 28, 29, 30 and 31 of /home/public_html/vqmod/vqcache/vq2-system_engine_controller.php:

Code: Select all

27	protected function redirect($url, $status = 302) {
28		header('Status: ' . $status);
29		header('Location: ' . str_replace('&', '&', $url));
30		exit();
31	}
I'm not sure why this is happening. Any thoughts?
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


New member

Posts

Joined
Tue Mar 27, 2012 3:57 am

Post by alber99 » Mon Apr 09, 2012 1:56 am

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".

New member

Posts

Joined
Sun Apr 08, 2012 9:14 am

Post by scd1982 » Tue Apr 10, 2012 1:57 am

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".
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.

I usually forget to mention I'm using OC v1.4.9.4


New member

Posts

Joined
Tue Mar 27, 2012 3:57 am

Post by naturesfootprint » Wed Apr 11, 2012 6:57 am

scd1982 wrote:
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.
When I do this in 1.5.2.1, I get the following error:

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
Lines 13, 14, 15 and 16 of /home/public_html/vqmod/vqcache/vq2-catalog_controller_checkout_cart.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		}
Line 27, 28, 29, 30 and 31 of /home/public_html/vqmod/vqcache/vq2-system_engine_controller.php:

Code: Select all

27	protected function redirect($url, $status = 302) {
28		header('Status: ' . $status);
29		header('Location: ' . str_replace('&', '&', $url));
30		exit();
31	}
I'm not sure why this is happening. Any thoughts?
I'm having the same issue, find any solutions yet?


Posts

Joined
Wed Apr 11, 2012 6:54 am

Post by scd1982 » Thu Apr 12, 2012 1:56 am

naturesfootprint wrote:I'm having the same issue, find any solutions yet?
Check this post out, and see if it helps: http://forum.opencart.com/viewtopic.php?f=20&t=55340
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


New member

Posts

Joined
Tue Mar 27, 2012 3:57 am

Post by naturesfootprint » Fri Apr 13, 2012 1:35 am

scd1982 wrote:
naturesfootprint wrote:I'm having the same issue, find any solutions yet?
Check this post out, and see if it helps: http://forum.opencart.com/viewtopic.php?f=20&t=55340
It isn't exactly the same thing, but it gets the same result.
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.


Posts

Joined
Wed Apr 11, 2012 6:54 am

Post by scd1982 » Fri Apr 13, 2012 2:10 am

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 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.

I usually forget to mention I'm using OC v1.4.9.4


New member

Posts

Joined
Tue Mar 27, 2012 3:57 am

Post by pooks » Fri Aug 03, 2012 11:49 pm

Umm do you mean that there is no way to send product options from external site? Like color or size?

New member

Posts

Joined
Tue Mar 27, 2012 1:42 am

Post by scd1982 » Sat Aug 04, 2012 3:08 am

pooks wrote:Umm do you mean that there is no way to send product options from external site? Like color or size?
No, not as far as I can tell. Unless something has been developed to do this in the meantime??

I usually forget to mention I'm using OC v1.4.9.4


New member

Posts

Joined
Tue Mar 27, 2012 3:57 am

Post by DefconRhall » Tue Dec 04, 2012 9:19 pm

None of these solutions seem to work for 1.5.4
This really should be a feature put into the base system

New member

Posts

Joined
Thu Aug 30, 2012 11:00 am

Post by Dcru » Wed Mar 06, 2013 1:46 am

Has there been any progress made getting this working for 1.5.4?

Newbie

Posts

Joined
Fri Mar 30, 2012 7:37 pm
Who is online

Users browsing this forum: No registered users and 7 guests