VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: nonki212 on January 20, 2018, 22:29:38 PM

Title: Banner over image after click add to cart - can anybody have solution?
Post by: nonki212 on January 20, 2018, 22:29:38 PM
virtuemart 3.2 12
hello
i am looking for a code to add, or change, so when my clients add a product to cart, a banner over the thumb image will display.
see attached for the sample.
if anybody knows what to change and how, please respond.
i know there is css to do it, but i am not that good in coding
Title: Re: Banner over image after click add to cart - can anybody have solution?
Post by: Studio 42 on January 21, 2018, 00:04:09 AM
This is not so simple, because added to order, need to check the product in cart
Title: Re: Banner over image after click add to cart - can anybody have solution?
Post by: nonki212 on January 25, 2018, 00:53:12 AM
thank you
i thought to write "IF" product is in cart, then change image or add image on top.
but thank you.
Title: Re: Banner over image after click add to cart - can anybody have solution?
Post by: Studio 42 on January 25, 2018, 11:42:30 AM
$cart = VirtueMartCart::getCart(false);
foreach ($cart->cartProductsData() as $cartProduct) {
if($cartProduct['virtuemart_product_id'] == $product->virtuemart_product_id){
// yourcode here
}
Some code is certainly missing and i dont tried, but you should cache this and not run this for each product.
Title: Re: Banner over image after click add to cart - can anybody have solution?
Post by: nonki212 on January 29, 2018, 04:27:26 AM
thank you, if i will manage to do it, i will post code here