News:

Support the VirtueMart project and become a member

Main Menu

Latest Products and Recently Viewed Products in cat page

Started by amorino, July 08, 2019, 07:32:16 AM

Previous topic - Next topic

amorino

Hello,

I need to get Latest Products and Recently Viewed Products after Products in the category page
I searched since many days but I didn't find where to set that or where to change files

Joomla! 3.9.8
Virtuemart 3.4.2

I hope really getting some help on this matter
Best regards
Création sites web Tunisie
http://www.idealconception.com

jjk

Create a new 'VirtueMart Products' module, configure it's settings, assign only the category you want to attach it to in the 'Menu Assignment' tab and publish it in a template position below the main content area.
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

amorino

Hello,
Thank you
@jjk I found a real difficulties with the design of my template
So the best thing for me would to revert them in the category template
Any help please ?

Thank you
Création sites web Tunisie
http://www.idealconception.com

jjk

Quote from: amorino on July 21, 2019, 06:30:05 AM
@jjk I found a real difficulties with the design of my template

Which template? And what is the problem with the template?
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

Studio 42

Do an override from file JOOMLAROOT/components/com_virtuemart/views/category/tmpl/default.php
   echo shopFunctionsF::renderVmSubLayout($this->productsLayout,array('products'=>$this->products,'currency'=>$this->currency,'products_per_row'=>$this->perRow,'showRating'=>$this->showRating));
is the code to render all the products
If you want to render it in another order, the only solution is to invert/manipulate the array : $this->products.

amorino

Hello,
Thank you @Studio 42

Yes that's it I just want to invert that array
How to do it please ?
How that code should be to invert ?
Création sites web Tunisie
http://www.idealconception.com

Studio 42

https://www.php.net/manual/en/function.array-reverse.php
$products= array_reverse($this->products, true);
echo shopFunctionsF::renderVmSubLayout($this->productsLayout,array('products'=>$products,'currency'=>$this->currency,'products_per_row'=>$this->perRow,'showRating'=>$this->showRating));

amorino

Hello Studio 42
This didn't work for me

But I made an other try that worked fine :

echo shopFunctionsF::renderVmSubLayout($this->productsLayout,array('products'=>$this->products,'currency'=>$this->currency,'products_per_row'=>$this->perRow,'showRating'=>$this->showRating));

I think that this should be rendered in some template as now I want to revert new products and last seen on the same page  hhhhhh
Any idea which code is rendering this
Création sites web Tunisie
http://www.idealconception.com

Studio 42

have you add the line in the right file
$products= array_reverse($this->products, true);
and change
echo shopFunctionsF::renderVmSubLayout($this->productsLayout,array('products'=>$this->products,'currency'=>$this->currency,'products_per_row'=>$this->perRow,'showRating'=>$this->showRating));a layout
with
echo shopFunctionsF::renderVmSubLayout($this->productsLayout,array('products'=>$products,'currency'=>$this->currency,'products_per_row'=>$this->perRow,'showRating'=>$this->showRating));
If yes, then my code should work.
I cannot help you, if you dont know how to do overrides in the template

amorino

Hello,
Thank you a lot
I did overrides in the template with no problem

I found the solution and worked well in my previous message

But now I want to change order of blocks new products and last seen on the same cat page
Création sites web Tunisie
http://www.idealconception.com

Studio 42

 if you want to customise the order then you have to manipulate the array $this->products directly or do a new array and add the products list(new, last ...) as you want.

amorino

Hello Studio 42
Thanks
Any example of code please ?
Thanks
Création sites web Tunisie
http://www.idealconception.com

Studio 42

#12

$lists = array();
$lists['related'] = $this->products['related'];
$lists['featured'] = $this->products['featured'];
$lists[0] = $this->products[0];
echo shopFunctionsF::renderVmSubLayout($this->productsLayout,array('products'=>$lists,'currency'=>$this->currency,'products_per_row'=>$this->perRow,'showRating'=>$this->showRating);

Studio 42

note that i replaced $this->products by $lists in
shopFunctionsF .... array('products'=>$lists

If you dont understand, then please hire someone to do it, it's really a basic PHP code