VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: marvays on March 04, 2020, 05:59:09 AM

Title: product filter in admin - discount
Post by: marvays on March 04, 2020, 05:59:09 AM
On the product list administration page, I see a filter that contains "Top Ten", "modified", "Discountinued" and a few others. Consider adding a filter to view products that have a discount.
Title: Re: product filter in admin - discount
Post by: Studio 42 on March 04, 2020, 12:52:23 PM
Marvays, you can create a module for other cases.
I sold a products module with many other filters here https://shop.st42.fr/en/products/products-any-ways.htm
Title: Re: product filter in admin - discount
Post by: marvays on March 04, 2020, 13:23:58 PM
Nice work. But I have in mind the administration of products. Not a frontend.
(https://i.postimg.cc/BjXD8LJ6/discount.png) (https://postimg.cc/BjXD8LJ6)
Title: Re: product filter in admin - discount
Post by: pinochico on March 04, 2020, 15:20:56 PM
Hi Martine,
nice idea for custom programming - You can order a freelancer for this job.

We make such modifications for the client on demand as custom work ourselves - (delete customfields for discontinued child products, toggle for discontinued products, togle for featured products, info about imported products from feed/ERP, info about numbers of reviews for products) - see on the attachments.

Rudolf


Title: Re: product filter in admin - discount
Post by: Studio 42 on March 04, 2020, 21:46:22 PM
Or create a vmextended plugin so you can add all filters you want.
Of course this can be included in core, but each shop need some other filters.
For a customer, he needed a order export per manufacturer by mail. I never requested it. Each shop work differently
Title: Re: product filter in admin - discount
Post by: Rsn on March 05, 2020, 04:41:39 AM
Hi, for our tasks, I added new option to this product filter in backend - User (modified by).
Now I can filter products by editors.
It is very useful for us:

(https://inform-resource.ru/docs/share/virtuemart/screen-2020-03-05-08-34-59.png)

I think your task can be done by analogy.
This is a hack of 3 files VM.
I can share my decision.

Title: Re: product filter in admin - discount
Post by: marvays on March 05, 2020, 05:18:56 AM
nice :)
Title: Re: product filter in admin - discount
Post by: Rsn on March 05, 2020, 20:43:51 PM
Quote from: marvays on March 04, 2020, 13:23:58 PM
(https://i.postimg.cc/BjXD8LJ6/discount.png) (https://postimg.cc/BjXD8LJ6)

If by "Discount" You meant "Overwrite final" in "Price" block, then this solution will work for You:

1) administrator/components/com_virtuemart/views/product/view.html.php

For $options array add last element ('discount' => 'Discount'):


$options = array( '' => vmText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION'),
                  'parent' => vmText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_PARENT_PRODUCT'),
                  'product' => vmText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_PRODUCT'),
                  'price' => vmText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_PRICE'),
                  'withoutprice' => vmText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_WITHOUTPRICE'),
                  'featured' => vmText::_('COM_VIRTUEMART_SHOW_FEATURED'),
                  'topten' => vmText::_('COM_VIRTUEMART_SHOW_TOPTEN'),
                  'latest' => vmText::_('COM_VIRTUEMART_LATEST_PRODUCT'),
                  'discontinued' => vmText::_('COM_VIRTUEMART_PRODUCT_FORM_DISCONTINUED'),
                  'discount' => 'Discount'
);


2) administrator/components/com_virtuemart/models/product.php

Find "switch ($group) {" and put, for example, second case:

case 'discount':
    $joinPrice = true;
    $where[] = 'pp.`override` = "1" AND pp.`product_override_price` < pp.`product_price` ';
    break;


This should work  ;)
Title: Re: product filter in admin - discount
Post by: Jörgen on March 05, 2020, 21:39:27 PM
Quote"Overwrite final"

This is legacy code and should NOT be used as it crashes with display of prices and VAT calculations etc.

Jörgen @ Kreativ Fotografi
Title: Re: product filter in admin - discount
Post by: Rsn on March 06, 2020, 03:39:22 AM
Quote from: Jörgen on March 05, 2020, 21:39:27 PM
This is legacy code and should NOT be used

Jörgen, what code would you suggest as recommended?
:)


Quoteit crashes with display of prices and VAT calculations etc.

For product list filter in backend? Are you sure?
Title: Re: product filter in admin - discount
Post by: Jörgen on March 06, 2020, 08:52:44 AM
Using calculation rules is the correct way to ensure that invoices, discounts, shipment and payment processors will work. Depending on the overrite final is not the way to go. You may come up with a solution using this, but it will not play well with other calculations. The discount option in prices is a legacy setting from VM 1.1 that You should not use. Creating discounts should be done with calculation rules.

Jörgen @ Kreativ Fotografi
Title: Re: product filter in admin - discount
Post by: Rsn on March 06, 2020, 10:17:02 AM
Quote from: marvays on March 04, 2020, 05:59:09 AM
Consider adding a filter to view products that have a discount.

marvays, how exactly do you assign discount to products?
Title: Re: product filter in admin - discount
Post by: Rsn on March 06, 2020, 11:59:15 AM
Jörgen, thanks, I understand you roughly.

Quote from: Jörgen on March 06, 2020, 08:52:44 AM
The discount option in prices is a legacy setting from VM 1.1 that You should not use.

Should not use?
We use it very actively. I would be very sad if it was removed from VirtueMart...

For example, our products are uploaded from the crm system. Approximately 300 products from different categories participate in the sale (closeout).
And for each product - its own sale price (purchase price).
I can easily automate this by setting Override price for this products. That's all right.

If I have to do this through the calculation rules, do I have to create a rule for each product? 300 rules?

I think Override price is a very necessary functionality that is relevant! Don't leave it, please.
Title: Re: product filter in admin - discount
Post by: Jörgen on March 06, 2020, 12:55:37 PM
Why should You use 300 discount rules ? I use 10 %, 20 % and so on, very flexible in my oppinion. I use on a very modest number of products, just around 2000, It has some drawbacks regarding children but otherwise ok.

The override is from the very VM start and is certainly going to be more and more obsolete and hard to combine with other options.

Jörgen @ Kreativ Fotografi
Title: Re: product filter in admin - discount
Post by: pinochico on March 06, 2020, 20:50:55 PM
Hi,

Ok,
I have products with final price
240
239
238
237
236
235
234
23X
..
200

I want her to adjust the price so that everyone has a price of 199 (psychologically for the buyer).

Do I really have to make a rule for every discount?

We use override price and import from ERP automatically. Maybe we are wrong?
Title: Re: product filter in admin - discount
Post by: Studio 42 on March 06, 2020, 22:07:11 PM
@pinochico
Why you find always extrem cases ?

I wrote a price rule plugin for a customer that have discount  groups per customer using an external tables.
Of course in some case, core calc rules is not the best solution ! But this not mean that you should not use it, if it's possible
And of course if each product have own rule, then it's better to override the price manually

And perhaps your case can be solved using a plugin, if you apply similar rules(here price = 199) to products so you can remove it without manually update each price
Title: Re: product filter in admin - discount
Post by: Rsn on March 07, 2020, 05:48:05 AM
I think this is not an extreme case.
I have a similar situation, only a little different.
The stock price is independent of the regular price. Therefore, percentages or + - are not suitable.
The stock price equals the purchase price. For each product, it is unique.
It must be specified for each product.
Rules are not suitable for this.
Title: Re: product filter in admin - discount
Post by: Rsn on March 07, 2020, 05:51:02 AM
Quote from: Jörgen on March 06, 2020, 12:55:37 PM
Why should You use 300 discount rules ?

Because, as I wrote above, for each product - its own sale price (purchase price).
Common rules do not fit.
Title: Re: product filter in admin - discount
Post by: Rsn on March 07, 2020, 05:57:38 AM
If there is no Override price in Virtemart,
then the only solution to the problem will be two prices for each product (prices depending on conditions).
This is also an acceptable solution, but these are redundant entries in the database that can now be avoided due to override prices.
Title: Re: product filter in admin - discount
Post by: Jörgen on March 07, 2020, 06:54:29 AM
This looks more like custom version of The Rappenrundung, a job for a custom  calculation plugin. Or importing the prices through Excel. Afaik this is not possible with standard calculation rules. Max has some extensions touching this area. Check with him.

Jörgen @ Kreativ Fotografi
Title: Re: product filter in admin - discount
Post by: Rsn on March 07, 2020, 11:20:03 AM
Jörgen, yes, I import data from Excel or CSV or XML. I have no problem with this. Everything is configured and everything works.
We also export data to some major services.

The only question is, now I calmly use the Override price for products on sale.
But you wrote that this is not a recommended solution.
And it bothers me that someday (with one of next updates) override prices will no longer be supported. I would not want that.
Title: Re: product filter in admin - discount
Post by: GJC Web Design on March 07, 2020, 11:38:20 AM
The solution I use is the "old" price ( in our case Recommended Retail price" ) we store in the Override price field but in config this is disabled

Then the "sale" or "reduced" price minus Vat is the base price

The price displays are adjusted to get the desired rendering

This way we can quickly adjust the "retail" / "sale" price (the base price) by import, this price we can make "pretty" and any tax/discount/coupon/quantity pricing etc adjustments work correctly

Title: Re: product filter in admin - discount
Post by: pinochico on March 07, 2020, 12:58:57 PM
@patrick
I'm sorry Patrick, but I use examples from real ecommerce life.

We do not use VirtueMart as a play the game, but as a competition to large ecommerce solutions (Shopify, Shopsys, Magento) and if I am looking for a solution, I am looking for a system solution solution == I have to consider all the real eventualities required by e-shop owners.