where is the method add for cart class in opencart - oop

I'm developing an integration on a opencart site with an hardcoded solution for calculate a cost of a product according to some input like height width and quantity and other some hidden value.
so
I'm trying to edit the add action for the cart to manage the sub-total in this specific circustance.
so I find in /catalog/controller/checkout/cart.php the this method:
$this->cart->add($this->request->post['product_id'], $this->request->post['quantity'], $option);
This action is in both of the cart controller page, index and update, but where is it the "add" method?
Thanks

You can find the method in
/system/library/cart.php
Be sure to make backups before editing, as its a core file

Related

Add items to a shopping cart with Vue?

I'm trying to figure out how to implement the shopping cart functionality on a page using Vue.js. I get a list of items from an API call and print them on page load. But I'm stuck trying to add items to my cart. The functionality should include the ability to select a quantity of an item and add it to the cart by clicking the "add to cart" button. So it should allow, directly from the cart, to change quantities and remove items from the cart.
For this kind of situation, use a state management pattern like vuex (or pinia), and it will store your data after route change also.
For more clear context, go through this link:
https://vuex.vuejs.org/

Shopify - is it possible to change the preview of a product with a inputbox?

Which ways are possible to edit the live preview of the product page in Shopify with Inputboxes next to it?
Let's say the product is a poster, and i want to add a custom text on it.
When typing into the inputbox the text changes in real time on the product.
Can this be implemented in the shopify code with the basic version of shopify?
Or does this necessarily needs an app?
ADDITIONALLY:
Let me go a bit deeper. I have a code that can generate a QR code.
Now i want that the QR code to be previewed in the product. Now position and color of the QR code is different from any product. Would that need an app?
Yes you can to an extent.
First the ground rules:
You can't modify the product from the front-end and update the content or media in the back-end - this would be a huge security hole
The changes applied to the product will be visible only to the user who changed them
The solution is to use Javascript and update the content of the front-end. If you like to store the changes for that specific user you can save them as cookie or localstorage.
If you like to share this change to other people you will need to add a custom parameter in the URL of the page and generate the content from it and share that url.
Each one of these steps will require some custom Javascript that will affect only the user in question, if you like to modify the product in the back-end directly you will need some kind of an app for this.
On my mind it can be done if the dynamic text is applied over product image.
Detailed code would be too long to write here but here are the steps:
Add an input to your product form to add a custom property (https://community.shopify.com/c/Shopify-Design/Product-pages-Get-customization-information-for-products/td-p/616503)
Write a Javascript function to get input value in real time
Use this value to display it in a div in product image container
Position this div in CSS as absolute and style it as you wish
While image container position should be set as relative in CSS
HTH

Make user stay on product view after clicking on "Add to Cart"

I'm using Hotcakes Commerce DNN modules and I'd like to know how I can allow the user to stay on the product page after the "Add to Cart" button is clicked. The default behaviour is to redirect the user to the cart page whenever the a product is added to the cart.
The easiest way to make this happen is to modify your viewset to change how the add to cart buttons work. Here's a summary of the required steps:
Add and begin modifying your viewset if you haven't started already.
Modify your \VIEWSETNAME\Views\Products_ProductDetails.cshtml file to change the add to cart action from a post, to an AJAX link. This will allow you to add products to cart directly using a link, but keep you on the page.
If you're using the Mini Cart, refresh the page using JS so that it updates appropriately.
Please note that this option won't work well if your products have choices. If this is the case, you should instead allow your customers to be directed to the cart page, and use a parameter there to determine whether or not you redirect back to the product page.

add custom value to cart from a form, prestashop

I'm creating a simple Prestashop module that places a form in CMS pages. That form will return a custom value (and a new product) that I need to be redirected to the cart after clicking a "submit" button.
How can I send the data to the cart?
Thank you!
Rui
Every customer has a unique cart ID.
1 ) After submit put information to mysql table
2 ) hook module to cart step
3 ) Check if this customer and cart id equal and do what you need to do.
I think its easiest and simplest way to do it. Rather than override system files. Even more you talking about module.
There is a javascript class in prestashop to control the cart.
Simply call ajaxCart.add(params)
This function will add the product to the cart with ajax.

How to implement "Add To Cart" button in bigcommerce

i am setting up my store on bigcommerce, i want to implement add to cart button on my custom home page can anyone tell me how can i add "Add to cart button" on three blocks below slider(In celebrate, bags, weddings section)? This is my store link http://eveningbags1.mybigcommerce.com/
Usually the best way to make an add to cart button on other pages or from other websites is to take the link the Bigcommerce uses for Category/Brand/Search pages. Works like this
site.com/cart.php?action=add&product_id={product_id}
To add a specific option/sku/variation to the cart, use this format
site.com/cart.php?action=add&sku={sku}
Thanks to #Alyss for the sku info