News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Virtuemart 3.0 - Discount coupon only in the first occurrence of each product

Started by Hiago D'O.S, September 11, 2016, 17:24:29 PM

Previous topic - Next topic

Hiago D'O.S

Hi,

I'm searching or trying to know how can I put the discount coupon for the first occurrence of each product in my cart let me explain what I want to do.

First we put US$ 1.00 (one dollar) as the discount price in the coupon discount.
coupon discount = 1.00

And his code will be "b coupon".

In my example shop we have 3 products x, y and z, the quantity in my store of all products is the same 3, the price of x is US$ 3.00, of y is US$ 4.00 and z is US$5.00.

Product / Price
x = 3.00
y = 4.00
z = 5.00

Well, in my example cart I inserted some products and it brought to me this, before I have inserted the "b coupon".






ProductQuantityPrice
x26.00
y28.00
Total:14.00

Well, after that, I included my discount coupon in my cart and the result was:







ProductQuantityPrice
x2US$ 6.00
y2US$  8.00
b couponUS$  -2.00
Total:US$ 12.00

In this case my "b coupon" his value is US$ 1.00 but it apply to each product in my cart, and because this the "b coupon" value becomes US$ 2.00.

Now I just wanted to know, is possible to do that with programing? Does anyone know an extension that make this?

Thanks.


 
QuotePS: I'm learning english, so if you not understand something please reply me with your doubt and I'll answer you.

GJC Web Design

I don't understand why a $1.00 discount coupon gives u $2 off?

what are your settings for the coupon?
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Hiago D'O.S

What I want is a override or a plugin, something that make that.. I explained above gives me $2 because I want to create discount to the each products and not in the total value of my order.

In the virtuemart this not occurs, I need this because it's for a client.

#EDIT



The fact is that my client want to make discount for the first item of each product, in cart, so if you picked 2 products but they are the same product the discount will be only US$ 1.00 dollar, but if you picked 2 products and they are diferent products the discount will be US$ 2.00, same I having in virtuemart coupon settings this coupon value registred as US$1.00 discount for a limited day, the rule that he want is this.
QuotePS: I'm learning english, so if you not understand something please reply me with your doubt and I'll answer you.

GJC Web Design

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Hiago D'O.S

Hi,

Thank you, I installed the free version of the component and I make some adjusts, this component helped me a lot.

vm_coupon.php
               
                                        foreach($coupon_row->cart_items as $product_id=>$row) {
$product_id = $row['product_id'];
if( ($coupon_row->function_type2=='product' && isset($coupon_row->productlist[$product_id]))
||  ($coupon_row->function_type2=='category' && !empty($coupon_row->cart_items_def[$product_id]['is_valid_category']))
) {
// I Changed it, to apply the percentage to do the discount off in only the first quantity of product in cart------------------------------
$coupon_value += round( $row['product_price'] * $coupon_row->coupon_value / 100, 2);
//$coupon_value += round( $row['qty'] * $row['product_price'] * $coupon_row->coupon_value / 100, 2);
}
}
if( $this->product_total < $coupon_value ) $coupon_value = (float)$this->product_total;
}
$_SESSION_coupon_discount = $coupon_value;


Thanks.
QuotePS: I'm learning english, so if you not understand something please reply me with your doubt and I'll answer you.