Hi!
I will be very greatful for some advice.
We will have a add for a book on Facebook. And we want to add it automatically to cart when link i clicked in the add? Is it possible? So when they click on add, they should come to a page to just add shipping information.
Is it possible?
Best regards Ulrika
You need to add some variable to your link and then process it, when page loads. For example, your link can look like this:
This link will open your product page, but there's "action" variable here and you need to capture it. Just add a code to controller/product/product.php, which will check for "action" variable in the link:
If variable is found, add this product to cart. Guess, something like this should work:
Then you can redirect the visitor anywhere you want. For example, to cart page:
This is a very simple example, which will add 1 pc of a single product without any options. For more complex task you'll dig a little deeper and expand your code.
Code: Select all
http://yourstore.com/index.php?route=product/product&product_id=1&action=add
Code: Select all
if ($this->request->get['action']) {
// Do stuff
}
Code: Select all
$this->cart->add($this->request->get['product_id']);
Code: Select all
$this->response->redirect($this->url->link('checkout/cart'));
Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com
or then, get an Extension for this:
---
Add to Cart via URL link (1.5.x/2.x.x)
https://www.opencart.com/index.php?rout ... n_id=11443
---
Utimate Add To Cart via URL
https://www.opencart.com/index.php?rout ... n_id=21707
---
Link Cart (Share Your Cart)
https://www.opencart.com/index.php?rout ... n_id=13731
---
Good Luck !
Ernie
---
Add to Cart via URL link (1.5.x/2.x.x)
https://www.opencart.com/index.php?rout ... n_id=11443
---
Utimate Add To Cart via URL
https://www.opencart.com/index.php?rout ... n_id=21707
---
Link Cart (Share Your Cart)
https://www.opencart.com/index.php?rout ... n_id=13731
---
Good Luck !

Ernie
My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
Who is online
Users browsing this forum: No registered users and 1 guest