I successfully generated a test cart rule and assigned to my user.
I can see it both in backoffice and on the my-account page under 'my vouchers'. So we're sure it's recorderd and assigned.
What happens is that in shopping-cart page, even after loggin in with my user, I can't see any voucher field.
Digging deeper, I can say that the $discounts template var is not populated, or, simply it counts zero. So I took a look to the controller, and saw it assign it via $order->getCartRules(). And getCartRules simply reads a db table. And surprise?? The order_cart_rule table is empty. So it doesn't get populated. So what could be the problem here? Ever had same issue someone? It's a strange thing..
Probably the main question is: where/when exaclty do the cart and the rules get created/applied? I can see in FrontController the cart being created, but at that point it seems the cart rules are not setted yet.
By the way, I'm running on latest prestashop 1.6.1.4
$order->getCartRules
The function $order->getCartRules() gives you the list of cart rules applied to this order (you can find it in a table ps_order_cart_rule).
Where are all cart rules?
All cart rules are in the table ps_cart_rule.
If you have marked a cart rule as Highlight - you can see this:
If you have added any cart rule to your shop - you can see this:
If you can't see Vouchers field - either you don't have any cart rules or your theme installed isn't supporting it.
is a late answer but i noticed that if you enable paypal it has in paypal.js a line that remove not only the voucher area but also the trashcan to delete a product:
see pic: https://i.gyazo.com/403a9004aaa745a2817f11884d52346b.png
/* 1.5 One page checkout*/
var qty = $('.qty-field.cart_quantity_input').val();
$('.qty-field.cart_quantity_input').after(qty);
$('.qty-field.cart_quantity_input, .cart_total_bar, .cart_quantity_delete, #cart_voucher *').remove();
by renaming the cart_voucher to cart_voucher_2 (if you not use express checkout) and cart_quantity_delete to cart_quantity_delete_2 you will return to have your things right :)
Related
Hi all I will go straight to the point. I found out that when i create a shopping cart price rule in magento and added a promotion/coupon code as indicated above with all rules set correctly to have a discount works from the frontend as expected from customers checkout experience/process.
But when i try to create an order from the backend/admin and trying to apply the promocode1 coupon code to the order for a specific customer it shows it to be invalid. as indicated above.
My Version i am using currently is ver. 1.9.3.6
I hope someone can point me to the right direction or what i may be doing wrong or not doing.
snap shots below
Thanks.
This looks like a bug in magento as after several checks i realized that you have to select 'all store view' option during the creation of the price rule.
Even though you select the specific store view for the price rule, the coupon will not be applied to the order from the backend of magento without you selecting the 'all store view'.
I know this thread is old but I am also getting the same error messages and i resolve my issue by removing the fields reset_shipping: true from sales.js file in js/mage/adminhtml from function applyCoupon. In myside whenever i am applying coupon code then my shipping price is going to reset so coupon code could not apply if shipping price is 0 ( my coupon code is to offer free shipping)
I am creating a simple test product in magento and trying to add some custom attributes for variants. Unfortunatly these are not showing up in the front end.
So I'm pretty sure it's a theme issue here...
When I add a custom product option such as a drop down, the Add to Cart button vanished and can no longer be purchased... as well as now showing the dropdown.
Any thoughts would be greatly appreciated. Is there a directory to look this stuff up in?
I've added some photos in case my description wasn't clear enough
Thanks
Try clearing your caches
Check the inventory tab, if product is saleable on frontend (in stock and has qty)
check /var/log/ and /var/report for errors
calling isSaleable() on the product object can direct you as well (this check is also in product actions template where the add to cart button is rendered)
Just a note but if you have product variants (say size) you probably want to use configurable products instead of custom options
I have had same issue in my new magento 1.9
I just clean all caches from var/cache
Also clean your cache from magento admin.
I followed this answer which works fine: Magento - Programatically added bundle product isn't showing up in frontend
I'm able to generate a bundle product on the fly. Everything works fine.
Only one problem: My bundle product is correctly saved and I can see it through the admin area. But, after this generation on the fly, I have to add directly this product into the basket. The system returns "product not found". Basically, I have to go into the admin area, just save it and then I'm able to add it to the basket.
I really suspect a problem with the indexer but I can't really figure out what's going on.
I tried many solutions like:
Mage::getSingleton('index/indexer')->processEntityAction(
$product,
Mage_Catalog_Model_Product::ENTITY,
Mage_Index_Model_Event::TYPE_SAVE
);
But it still doesn't work.
Any Idea about which code I should trigger after the save method to index only this new added bundle product.
Thank you in advance.
Sounds like you are not creating a stock-item with your product. Therefore there is no stock and you can't add it to your basket?
Have a look into
/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php:672
/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php:571
where a product is generated and the stock data are cleand up / set with default data
I have one certain product that needs to be in the cart under certain circumstances. I have been looking at the Ubercart api documentation and I don't see any hooks that would be the obvious place to see if a certain item exists prior to checkout.
I could use the hook_add_to_cart hook to add the special item whenever the first item is added, but I'm concerned that the visitor may remove the item and then complete the purchase without the required item.
Any suggestions how to make sure the special item is in the cart on checkout?
You can have a module and run something like:
function mymodule_init() {
if (preg_match('/checkout/', request_uri()) {
$items = uc_cart_get_contents();
foreach ($items as $item) {
// code
}
}
}
That will fire up on the checkout page, and fetch the cart contents. Everytime they hit the checkout page, uc_cart_get_contents() returns the cart contents.
http://www.ubercart.org/docs/api/uc_cart_get_contents
There are probably better ways to do what you want to do though, like using a Conditional Action to prevent checkout if Item B is in the cart but Item A is not. You can also look at Product Kits, but I don't have much experience with that.
From what you have said it sounds as though the product kit module might be very much worth looking into as a way of ensuring any items associated with the main product are kept in the cart.
Product kit comes as part of ubercart and you will find it on the modules page under 'Ubercart - extra'. If this is no good then we can see about using the API :)
An old question, but I found a great solution.
hook_uc_cart_item_delete() functions specifically on certain entities when they are removed. You can just set this hook in your module, check for the specific entity being removed that is dependent on the other item, and then use uc_cart_remove_item() on the item you want to remove.
I know that setCouponCode is catch inside __call in Varien_Object but I can't figure out where it is defined.
I need it because I want to show the coupon code even if the discount equal zero.
I believed it's done inside this function.
So if anybody know where the function is defined or where I can modify the code to get the coupon code displayed all the time, please let me know.
Most text editors have a 'search in files/folders' option. Open the source folder and search for function __setCouponCode.
Ok I figured it out.
the SetCouponCode is setting the value for coupon_code in the magic function.
Related to this, did anybody notice that the quote is not being deleted properly? I say it is related to this because the coupon code variable keeps the value [if any] after you delete a product from cart.
Try:
1. Set some Shopping Price Cart Rule to a product and make it display a banner on the header section for example.
2. Add product to checkout/cart in order to trigger the rule and show the banner on the Cart.
3. Delete the product from cart and you will see the banner still showing on the header section.
Note. If you have another product in cart this will not work because when you delete the one that triggered the rule&banner the Coupon Code will get replaced with the one that belongs to this other product in cart.
SO this bug only works if only the product that triggers the rule&banner is in cart.
If anybody has a fix on this or can replicate these conditions: I'd love to have a conversation about magento's deficiency to make a proper product delete from cart - which implies a proper quote refresh.
Reference:
- app/code/core/Mage/Sales/Model/Quote.php -> public function removeItem($itemId)
And yes, magento core issue.