Prestashop 1.6 : Reset date in cart when Update - cart

I have a selected date when I choose a carrier.
I try to reset this date to zero if I modify my cart.
I tried with ActionCartSave() hook but it does not take place when I add or remove an item from my cart, but just before the validation of this one.

Try to work with this hook:
actionBeforeCartUpdateQty
this hook is located in Cart::updateQty and it's fired before adding, updating and deleting product.

Related

Hook in cart update on change

I have a Woocommerce One Page Checkout and I have the quantity input changed to a select box according this snippet.
Now I want that when I change my quantity with the select, the quantity in my shopping cart also updates with the selected quantity using AJAX. How can I achieve this in my functions.php?
The snippet later on that page does not what it should do. Can someone help me out?
Update:
Could this maybe part of my solution?

Magento Shipping-Estimator Block not updating

When I try to increase quantity in the shopping-cart page, the shipping-estimator block does not get updated with latest shipping rates after the cart quantity has been updated. Any suggestion why it's not updating?
If you are implementing your own functionality to modify quotes, you need to do this to recalculate totals:
$quote->getShippingAddress()->setCollectShippingRates(true);
$quote->collectTotals();
$quote->save();

Magmi import: Add To Cart Button not showing

I have managed to make a csv which imports my products using magmi into my magento store. All works well but the buy now buttons don't appear unless I go to the product and click save. I've tried reindexing or clearing the cache but nothing seems to work. Any further ideas. The same happens when i send an update import.
I'm using the up to date magento/magmi.
Hi,
I'm using this sample. I've already tried to update an randomly attribute of many products, to act like an "mass save", but it won't works too.
The 'add to cart' button will disappear if you let Magento manage stock / when the item is out of stock. Did you define is_in_stock and manage_stock in your header?
Try this:
In Catalog > Manage products. Select all or the ones you want. Action : Modify attributes.
Set
Catalog-> Manage Products-> X product-> Design-> Display Product Options In: to Product Info Column
Worked for me

Magento quote items modify sku

I need to change SKU on quoteitems and I do it like this:
foreach($items as $item){
$item->setSku($newSku);
$item->save();
}
But magento always resets SKUs into their original values. Is there some easy way to change it, like superMode on prices? Or if not, then where can I find methods to rewrite, so that they ignore my custom SKUs?
Tried looking for it, but even if I remove cart init and save from index action, they still reset somewhere.
I need it to work in Magento 1.7-1.8
Ok, so I didnt feel like waiting and found it.
You can find it in Mage_Sales_Model_Quote_Item and there in function setProduct. This function is run every time the cart is shown and it resets the data from Product to Item.
Not sure if now my data will get through whole checkout process, will update the answer if not.
EDIT
This has solved only cart, will need to find also function for order. Will update when I get it.
EDIT
In the end, I don't advise you to do this. But if you need it then, the way to do it is to create observe on event sales_order_save_after and modify sku of order items. This seems to work everywhere, only in email after checkout it doesn't work, there you have to modify email. Also I use this only on configurable products.
I do the same thing on my project using sales_quote_collect_totals_after
Just change quote item SKU as you want using this event.

Magento: edit quantity and update price of bundle option in quote item

I am working with Magento bundle products that contain hidden bundle options that need to have the quantity updated programmatically. A problem arises when the bundle quantity is edited from the shopping cart. I have a button set up to submit the bundle quote item to an updateLineItemAction() method in my own CartController to handle the update of the hidden bundle option.
The updateLineItemAction() method locates the hidden bundle option and assigns the updated quantity to the "selection_qty_X" and "product_qty_X" properties, where X is the ID of the bundle option. Values in the "info_buyRequest" are also updated. After saving the quote item, there's a redirect to the cart to show the updated cart values.
The updated quantity is displayed correctly in the cart, and the hidden bundle option has the correct quantity assigned. The problem is that the bundle item price has not updated to reflect the updated quantity on the hidden bundle option. I did something similar to this in Magento 1.1.x and it worked fine. Doing this now in 1.4.1.2, the price is not automatically updated when the quote item is saved. I've tried saving the quote and the cart again after updating the item, but that doesn't seem to have any effect.
What is the proper way to recalculate the price for a quote item when subitems have had the quantity changed? Is there a better way to change the quantity of a quote item bundle option so that the price of the bundle item is updated correctly?
The solution for my case was to update the quantity values of the selections as noted in my original post, and also to adjust the quantity assigned to the bundle item associated with the hidden bundle option. This last step was not necessary in versions prior to Magento 1.4.

Resources