Is there a way to restrict one specific product so that it cannot be added to cart unless there is something (anything) in the cart? I offer a free product, but I don't want people ordering just the free product.
Announcement
Collapse
No announcement yet.
One product can't be added to empty cart: can it be done?
Collapse
X
-
There are a few ways to do this. You could put each Checkout button inside an mvt:if block to prevent it from being displayed if the only product in the basket is the free item. However, this can fail if the user is able to get to the checkout page some other way, such as by manually entering a Screen code in the URL.
I have a small utility module that can be used for this kind of decision-making. If you're interested in that, you can drop me a line by email for more details.
Thanks --Last edited by Kent Multer; 08-09-16, 08:42 AM.Kent Multer
Magic Metal Productions
http://TheMagicM.com
* Web developer/designer
* E-commerce and Miva
* Author, The Official Miva Web Scripting Book -- available on-line:
http://www.amazon.com/exec/obidos/IS...icmetalproducA
-
Just shooting from the hip here, but if you are using the stock mini-basket, there is a variable for checking to see if it is empty or not. (l.global_minibasket:empty) With that you should be able to wrap the add to cart button on the product page to look for that specific item and prevent customers from adding it to the cart if the mini-basket is empty. Something like the following, untested:
Code:<mvt:if expr="l.settings:product:code EQ 'your_item_code' AND l.global_minibasket:empty EQ 1"> hide add to cart button/form and display message in it's place <mvt:else> display normal add to cart button/form </mvt:if>
Comment
-
That solution will work to some extent. But a customer might put a paid product in the basket, then the free product, and then remove the first item. It takes a little more work to make sure that customers can't check out if the free item is the only thing in the basket.Kent Multer
Magic Metal Productions
http://TheMagicM.com
* Web developer/designer
* E-commerce and Miva
* Author, The Official Miva Web Scripting Book -- available on-line:
http://www.amazon.com/exec/obidos/IS...icmetalproducA
Comment
-
There's a whole buy x get y built in. or add on product
http://www.miva.com/videos/store_own...oduct-deal/149Mark Hood
Vermont Gear
Comment
Comment