Post by Qphoria » Sun Apr 10, 2011 2:28 pm

The system/library/cart.php file would have to be modified to support model id

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by madisonstudios » Wed Jul 20, 2011 5:22 am

Does adding products to the cart via querystring still work for v1.5.0? It's not working for my version.


Posts

Joined
Wed Jul 20, 2011 5:20 am

Post by Johnathan » Thu Jul 21, 2011 3:19 pm

madisonstudios wrote: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.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by madisonstudios » Thu Jul 21, 2011 11:34 pm

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.


Posts

Joined
Wed Jul 20, 2011 5:20 am

Post by Johnathan » Fri Jul 22, 2011 4:10 am

If you want to add it in yourself, just do the following edit:

IN:

Code: Select all

/catalog/controller/checkout/cart.php
REPLACE:

Code: Select all

if ($this->request->server['REQUEST_METHOD'] == 'POST') { 
WITH:

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') { 

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by madisonstudios » Fri Jul 22, 2011 11:02 am

Awesome. Thank you.


Posts

Joined
Wed Jul 20, 2011 5:20 am

Post by OliGoesToWar » Thu Nov 24, 2011 5:09 pm

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:

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>
The link I am trying goes like this:
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

New member

Posts

Joined
Tue Oct 25, 2011 10:35 pm

Post by ogomo » Fri Jan 20, 2012 5:47 am

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:

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

New member

Posts

Joined
Thu Aug 04, 2011 1:35 am

Post by dmonco » Sun Aug 26, 2012 8:29 pm

Any success with OpenCart 1.5.x?

New member

Posts

Joined
Sun Jun 12, 2011 8:05 am
Location - Ukraine

Post by dmonco » Fri Nov 16, 2012 9:07 am

Johnathan wrote:If you want to add it in yourself, just do the following edit:

IN:

Code: Select all

/catalog/controller/checkout/cart.php
REPLACE:

Code: Select all

if ($this->request->server['REQUEST_METHOD'] == 'POST') {
WITH:

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') {
I use multistore. It works good with the default store.
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?

New member

Posts

Joined
Sun Jun 12, 2011 8:05 am
Location - Ukraine

Post by dmonco » Sat Nov 24, 2012 10:04 pm

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

New member

Posts

Joined
Sun Jun 12, 2011 8:05 am
Location - Ukraine

Post by carbon-uk » Fri Mar 22, 2013 5:02 pm

Anybody got this working on 1.5.4

I really need to add product & qty & possibly coupon to cart via a url.

Thanks.

New member

Posts

Joined
Wed Jul 04, 2012 4:42 pm

Post by byens » Sat Jul 27, 2013 12:02 pm

Come to conclusion
Jonathan's Post and jfeher's post


in:

Code: Select all

/catalog/controller/checkout/cart.php
Replace with offset 25:

Code: Select all

 $this->language->load('checkout/cart');
WITH:

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 -


Active Member

Posts

Joined
Sat Dec 11, 2010 12:29 pm
Location - Surabaya

Post by byens » Mon Jul 29, 2013 2:17 pm

above instruction works only with url, it is not working within add to cart button.

So i disabled vqmod at this moment

Selling Kristik - Jasa Foto Aura - Kapas Vapor - supplier baju anak -


Active Member

Posts

Joined
Sat Dec 11, 2010 12:29 pm
Location - Surabaya

Post by Krayg6 » Wed Aug 07, 2013 11:17 pm

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

Newbie

Posts

Joined
Wed Aug 07, 2013 11:14 pm

Post by Qphoria » Thu Aug 08, 2013 2:50 am

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

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

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by dolrichfortich » Thu Sep 12, 2013 8:21 pm

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.

Opencart Options Pro, Reward Points For Review, DISQUS Comment Form,
Dolrich Fortich - Freelance web developer

Image


User avatar
New member

Posts

Joined
Thu Aug 05, 2010 8:09 pm
Location - Philippines

Post by Qphoria » Thu Sep 12, 2013 11:35 pm

dolrichfortich 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.
Whoopdee doo.. we all have one already 8)
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

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by dolrichfortich » Thu Sep 12, 2013 11:45 pm

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

Image


User avatar
New member

Posts

Joined
Thu Aug 05, 2010 8:09 pm
Location - Philippines
Who is online

Users browsing this forum: No registered users and 7 guests