Does adding products to the cart via querystring still work for v1.5.0? It's not working for my version.
Looks like you're right...the code for adding products via a URL has been removed. I really liked that feature, so I'm going to file an issue and see if Daniel will add it back.madisonstudios wrote:Does adding products to the cart via querystring still work for v1.5.0? It's not working for my version.
Thanks Johnathan. I hope it is soon. I was counting on that feature. I guess I could always revert back to the older versions, but I'd rather just have this version work.
If you want to add it in yourself, just do the following edit:
IN:
REPLACE:
WITH:
IN:
Code: Select all
/catalog/controller/checkout/cart.php
Code: Select all
if ($this->request->server['REQUEST_METHOD'] == 'POST') {
Code: Select all
if ($this->request->server['REQUEST_METHOD'] == 'GET' && isset($this->request->get['product_id'])) {
if (isset($this->request->get['option'])) {
$option = $this->request->get['option'];
} else {
$option = array();
}
if (isset($this->request->get['quantity'])) {
$quantity = $this->request->get['quantity'];
} else {
$quantity = 1;
}
unset($this->session->data['shipping_methods']);
unset($this->session->data['shipping_method']);
unset($this->session->data['payment_methods']);
unset($this->session->data['payment_method']);
$this->cart->add($this->request->get['product_id'], $quantity, $option);
$this->redirect($this->url->link('checkout/cart'));
} elseif ($this->request->server['REQUEST_METHOD'] == 'POST') {
Troubles getting this to work on 1.5.1.3
I made the following vqmod, but when I try the link it does not work:
vqmod:
The link I am trying goes like this:
http://www.domain.com/shop/index.php?ro ... quantity=1
No luck there!
I made the following vqmod, but when I try the link it does not work:
vqmod:
Code: Select all
<modification>
<id>Add To Cart</id>
<version>1.0</version>
<vqmver>2.1.5</vqmver>
<author>OliGoesToWar</author>
<file name="/catalog/controller/checkout/cart.php">
<operation>
<search position="replace"><![CDATA[
if ($this->request->server['REQUEST_METHOD'] == 'POST') {
]]></search>
<add><![CDATA[
if ($this->request->server['REQUEST_METHOD'] == 'GET' && isset($this->request->get['product_id'])) {
if (isset($this->request->get['option'])) {
$option = $this->request->get['option'];
} else {
$option = array();
}
if (isset($this->request->get['quantity'])) {
$quantity = $this->request->get['quantity'];
} else {
$quantity = 1;
}
unset($this->session->data['shipping_methods']);
unset($this->session->data['shipping_method']);
unset($this->session->data['payment_methods']);
unset($this->session->data['payment_method']);
$this->cart->add($this->request->get['product_id'], $quantity, $option);
$this->redirect($this->url->link('checkout/cart'));
} elseif ($this->request->server['REQUEST_METHOD'] == 'POST') {
]]></add>
</operation>
</file>
</modification>
http://www.domain.com/shop/index.php?ro ... quantity=1
No luck there!
Last edited by Johnathan on Wed Jan 25, 2012 3:17 am, edited 1 time in total.
Reason: Added [code] tags for readability
Reason: Added [code] tags for readability
I understand how to add a product to the cart using a URL as was previously discussed. But what if that product has several options? Is there a way to specify color, size, or other option variable in the URL?
I tried something like:
All it would do is add the first option that shows on the product page to the cart, regardless of what I changed the last variable, product_option_value_id, to. Even if the number was a completely random number (i.e. not an option value id), it would still add the first option.
I tried something like:
Code: Select all
http://mysite.com/index.php?route=checkout/cart&product_id=580&quantity=1&product_option_id=431&product_option_value_id=1081
I use multistore. It works good with the default store.Johnathan wrote:If you want to add it in yourself, just do the following edit:
IN:REPLACE:Code: Select all
/catalog/controller/checkout/cart.php
WITH:Code: Select all
if ($this->request->server['REQUEST_METHOD'] == 'POST') {
Code: Select all
if ($this->request->server['REQUEST_METHOD'] == 'GET' && isset($this->request->get['product_id'])) { if (isset($this->request->get['option'])) { $option = $this->request->get['option']; } else { $option = array(); } if (isset($this->request->get['quantity'])) { $quantity = $this->request->get['quantity']; } else { $quantity = 1; } unset($this->session->data['shipping_methods']); unset($this->session->data['shipping_method']); unset($this->session->data['payment_methods']); unset($this->session->data['payment_method']); $this->cart->add($this->request->get['product_id'], $quantity, $option); $this->redirect($this->url->link('checkout/cart')); } elseif ($this->request->server['REQUEST_METHOD'] == 'POST') {
But when I use second store it adds product for the second store but redirect in a cart of default store.
Any suggestions how to fix it?
So, any help?
Once again:
I have multistore
site1.com
site2.com
When I use this link everything works great:
http://site1.com/index.php?route=checko ... ntity[0]=1
interesting that it also adds product to a site2.com
when i use this link:
http://site2.com/index.php?route=checko ... ntity[0]=1
2 products are added to site 2 and it redirects to empty cart to site1.com
How to make this script works?
It should be:
1. When I use link http://site1.com/index.php?route=checko ... ntity[0]=1
it should add product only for site1.com (not for site2.com) and redirect to a cart of site1.com like it works now.
2. When I use link http://site2.com/index.php?route=checko ... ntity[0]=1
it should add product only for site2.com (not for site1.com) and redirect to a cart of site2.com (now it redirects to site1.com cart)
Thanks for help
Once again:
I have multistore
site1.com
site2.com
When I use this link everything works great:
http://site1.com/index.php?route=checko ... ntity[0]=1
interesting that it also adds product to a site2.com
when i use this link:
http://site2.com/index.php?route=checko ... ntity[0]=1
2 products are added to site 2 and it redirects to empty cart to site1.com
How to make this script works?
It should be:
1. When I use link http://site1.com/index.php?route=checko ... ntity[0]=1
it should add product only for site1.com (not for site2.com) and redirect to a cart of site1.com like it works now.
2. When I use link http://site2.com/index.php?route=checko ... ntity[0]=1
it should add product only for site2.com (not for site1.com) and redirect to a cart of site2.com (now it redirects to site1.com cart)
Thanks for help
Come to conclusion
Jonathan's Post and jfeher's post
in:
Replace with offset 25:
WITH:
working like a charm
Jonathan's Post and jfeher's post
in:
Code: Select all
/catalog/controller/checkout/cart.php
Code: Select all
$this->language->load('checkout/cart');
Code: Select all
$this->language->load('checkout/cart');
if ($this->request->server['REQUEST_METHOD'] == 'GET' && isset($this->request->get['product_id'])) {
if (isset($this->request->get['option'])) {
$option = $this->request->get['option'];
} else {
$option = array();
}
if (isset($this->request->get['quantity'])) {
$quantity = $this->request->get['quantity'];
} else {
$quantity = 1;
}
unset($this->session->data['shipping_methods']);
unset($this->session->data['shipping_method']);
unset($this->session->data['payment_methods']);
unset($this->session->data['payment_method']);
$this->cart->add($this->request->get['product_id'], $quantity, $option);
$this->redirect($this->url->link('checkout/cart'));
} elseif ($this->request->server['REQUEST_METHOD'] == 'POST') {
working like a charm
Selling Kristik - Jasa Foto Aura - Kapas Vapor - supplier baju anak -
So you have your cart in an iframe and a link outside of the iframe that you want to use to add item to the cart inside the iframe?Krayg6 wrote:I am using 1.5.5.1 OpenCart and was wondering if there is anyway of using a GET/POST from a iframe with a external "Add To Cart" button with variables, to add to the opencart cart.
Any help with be much appreciated.
Thanks
Read this: http://webdesign.about.com/od/iframes/q ... frames.htm
So wherever you set this add to cart url, set the <a href="path/to/link" target="iframe-name" />
Got a specific module built just for this.
http://dolrichfortich.com/buy-now-link
It supports options, seo keyword, coupon and multiple products on a link.
http://dolrichfortich.com/buy-now-link
It supports options, seo keyword, coupon and multiple products on a link.
Opencart Options Pro, Reward Points For Review, DISQUS Comment Form,
Dolrich Fortich - Freelance web developer
Whoopdee doo.. we all have one alreadydolrichfortich wrote:Got a specific module built just for this.
http://dolrichfortich.com/buy-now-link
It supports options, seo keyword, coupon and multiple products on a link.

http://www.opencart.com/index.php?route ... n_id=11443
and some other cloners:
http://www.opencart.com/index.php?route ... n_id=13731
http://www.opencart.com/index.php?route ... n_id=13437
Oopppss, did not notice. I guess the more the better. 

Opencart Options Pro, Reward Points For Review, DISQUS Comment Form,
Dolrich Fortich - Freelance web developer
Who is online
Users browsing this forum: No registered users and 5 guests