News:

Support the VirtueMart project and become a member

Main Menu

Latest products shows random product (Bug)

Started by Twix, April 26, 2012, 16:20:56 PM

Previous topic - Next topic

Twix

The Latest products module (mod_virtuemart_product) shows random product, in stead of the latest product. Could you fix this please?
Thanks!


serapol

Quote from: Twix on April 26, 2012, 16:20:56 PM
The Latest products module (mod_virtuemart_product) shows random product, in stead of the latest product. Could you fix this please?
Thanks!

It is not a bug and feature writing code. According to the latest product code Considered one in which the change date is the eldest. Accordingly, if you change your old item and save it you will automatically become final.

I have already offered to developers to replace this sample at the output of goods on the latest product ID but they felt that since they did more correctly. Although I do not agree with them.

Can do to fix the file administrator /components/com_virtuemart/models/product.php
Find code


case 'latest':
$date = JFactory::getDate( time()-(60*60*24*7) ); //Set on a week, maybe make that configurable
$dateSql = $date->toMySQL();
$where[] = 'p.`modified_on` > "'.$dateSql.'" ';
$orderBy = 'ORDER BY p.`modified_on`';
$this->filter_order_Dir = 'DESC';
                                        break;

and change in the


case 'latest':
$this->filter_order_Dir = 'DESC';
$orderBy = 'ORDER BY p.`virtuemart_product_id` ';
break;

Twix

Thanks for your reply. I don't like to edit the core files, but maybe my clients prefer that I do that. Hopefully the developers will edit it. An edited product (which you have for example 2 years in your webshop) is not a new product if you ask me...

Milbo

Serapol that is not fair, read here http://forum.virtuemart.net/index.php?topic=100789.msg333706#msg333706. my last message indicates, that I did not understand you and that I changed the core.

Quote from: Twix on May 08, 2012, 10:30:09 AM
Thanks for your reply. I don't like to edit the core files, but maybe my clients prefer that I do that. Hopefully the developers will edit it. An edited product (which you have for example 2 years in your webshop) is not a new product if you ask me...

That differs from case to case. Others said, uhh, why it is created_on, I just updated my product and it is not latest. So I think we must make it configurable.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

serapol

I wrote it without any complaints, just a man had a similar situation and I said that this is not bug but feature and pointed out how you can avoid it in the code.

Can be completely and correctly to make this option configurable. While as for me the last items are the ones that were added last. Well, IMHO it is in my case, can the other in a different way.

By the way on theme modules Mode "topten" does not work at all due to the fact that the order without recording the data in the database field "product_sales". I still did not understand this, posmtrite what it was please, and then on my site now displays items in discord.

Thank you very much for your trouble, I'm sure that eventually turn out a decent product with great functionality.

Twix

Quote from: Milbo on May 08, 2012, 18:27:35 PMThat differs from case to case. Others said, uhh, why it is created_on, I just updated my product and it is not latest. So I think we must make it configurable.
That would be a very nice solution Milbo!

Milbo

Quote from: serapol on May 08, 2012, 18:39:44 PM
I wrote it without any complaints,
Good then :-)

Quote from: serapol on May 08, 2012, 18:39:44 PM
By the way on theme modules Mode "topten" does not work at all due to the fact that the order without recording the data in the database field "product_sales". I still did not understand this, posmtrite what it was please, and then on my site now displays items in discord.

Sorry, I do not understand you, maybe we use skype and my wife translates for us? lol.  But I wonder, because imho I fixed it. grumble, not?
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/