What's the easiest way to pre-fill a shopping cart in Magento?
There is the CartController on the Checkout route, which has an "add" method, allowing you to do stuff like:
http://<shopurl>/checkout/cart/add?product=1
But what to do when you need more items in the cart? There is an "addGroup" method, but that only takes into account previous order lines.
When digging into the Checkout/CartController/addAction, there appears to be an argument "related_product". It enables you to do this:
http://<shopurl>/checkout/cart/add?product=1&related_product=2,4
Downsides are you only get a message about the main product added, and for the related products you cannot specify quantities. Upside is, you can populate a cart like this with several items at once without even touching Magento code.
If you want to add more items of the same, just repeat the id in the array
Related
In the Volusion shopping carts "soft add to cart" feature, which is turned on in product options with "Enable Add To Cart Popup", the popup shows the "Subtotal" of products currently in the cart.
The issue is this Subtotal does not include quantity discounts and therefore shows customers a higher price than the actual Subtotal after discounts are applied.
For that reason, we would like to display the cart Total, which includes any quantity discounts applied.
The problem is, I cannot find a place where this can be done in the HTML we have access to and if I were to find it, I'm not sure of the proper Volusion syntax to use to call up the Total instead of the Subtotal.
Thanks!
I had a different issue, but the same problem (soft add to cart did not display the proper info).
In my case, we allow engraving on our products, for an additional charge, and when selected this option was not displayed in the popup cart. As a result, customers were not sure if they chose it or not.
My solution was to add a Shopping Cart block to the page, as part of the template, using jQuery.
If you call http://yourUrl/AjaxCart.asp you'll see the discount info you need in the JSON data, as well as the line items in the order.
Is it possible, using apps/api/ajax etc to have a shopify cart send off a request to an external site which calculates a price based on the carts contents and adds an item to the cart with said price?
At the moment what I think might be a way forward is:
Have a product "Handling" with a £0.01 price
Write an app that includes some scripttags that add options to cart items
When the options are changed the script contacts the external service with the cart contents and options
External service can then add a quantity of the "Handling" product to the cart based on the calculation, customer can remove this item if they wish, which will reset their options
Is this a remotely feasible plan? Have I listed anything that just isn't possible or would be more appropriately done in another way?
Many thanks for any guidance.
I have this idea to make a product page that lists all the products on the site, Perhaps paginatied, and have them all have a quantity box on the right side of them.
This way, people who stock my product can go to this page, enter the quantities for all the products they need and click "Add to cart" at the top or bottom of the page.
Saving the stockist time by adding 40 of each product they want etc.
Has this been done before? Can it be done?
Of course this is possible. In terms of magento quite everything is possible. If your question "Has this been done before?" aims to an extension-suggestion. Sorry, but i don't know one.
But in simplest case a "small" custom module could do the job. Simply add a custom attribute to the categories (e.g. wholesale = yes|no), override the catalog/category/view.phtml by your module-layout-update and check this attrib within that "new" view. If it is "yes" list all products out of this category in the way described above.
Processes of "add to cart" with the right qty out of a categoryview exist already but you need to trigger them e.g. by a custom javasscript just before the page swaps. and you slightly have to mod the "add to cart" itself to prevent jumping into the cart afterwards. Its just an example, would work for non-configurable/non-optioned products at least.
If it has to be an own page listing all products of the shop, your module has to provide a bit more up front (controller, viewblock, etc.) but that more could be also helpful with implementing own logic, eg. collecting all qty in a session first and ask later for "add to cart"
I have been working on a LiftSuggest - an automatic Product Recommendations generator.
Now,I have introduced a bundling functionality which will bundle two products and assign discount.
For example,
On product page of A of the client's site,I(LiftSuggest) displays a bundle Saying "Buy A and B together and avail 10% off on net value". Now, when the user clicks on the add to cart button , I want both the products to be added simultaneously to cart. I had implemented the solution proposed on this link, but I need the products to be added on click of add to cart button,without entering the quantity or providing the check box.Just imagine that you can see a box( container) containing two products and on click of add to cart button-in that div container itself, both of them should be added to cart.I can make out that I need to store both the products in session, but I don't know exactly how to proceed.
Scripting language used:PHP
Please Help!
There are cart rules for various shopping carts. You can manipulate those rules through coding and achieve the desired output.
We are selling ready made packs ( total weight 18 kg ) which is include several food products. But we want to make a special thing to our customers which they should make their packs by selecting our product range.
So that, they should make first a base pack with selected products then they can multiply this package in the checkout section.
What I want to do, modify the checkout section of magento to multiply selected products with a text field and calculate total amount by button.
Like in image...
Does anybody help me to make such a thing?
Personally I would do this with frontend code, in prototype. The reason being that you will have to modify your template anyway and your customers will need javascript enabled to get to your cart anyway.
General approach is to have the onclick for your apply button take the id.value for your quantity text box and then update everything with the quantity class in the cart page. Then have this script call the same update url as the standard update quantities button.
Here is my suggestion: in your module you create an observer listening to controller_action_predispatch_checkout_cart_index. In your observer's method you can get the items in cart with $itemCollection = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();. now you just have to loop through this condition and set the quantity:
foreach ($itemCollection as $item) {
$item->setQty(here_the_integer_you_want);
}
edit: sorry, didn't read about the input and button.
For the input and button, you just have to edit the template (app/design/frontend/base/default/template/checkout/cart.phtml). Or, if you want tom make an independant extension, you could add them by an observer. Check out inchoo's post. This form you've just created will call your controller/action, where you can set the items quantity (so no need for an observer anymore), with the same technique I've put earlier.
Let me know if that's not clear.
HTH