Forum

Thread tagged as: Question, Add-on-development, FoxyCart

Order of products

Hi guys,

I am trying to sort the order of the products out using FoxyCart app.

If you go to https://www.rpm.designbyconet.com/shop/category.php?cat=tarmac-review you can see that a DVD that begins with '1989' is near the start. It needs to be at the end.

I know I can do a custom shop and sort order if I were to make a page for each category but I don't to do that.

The code I have in category.php is

<?php perch_shop_products_by_category(perch_get('cat'), 24); ?>

Is there anything I can do here to sort in the order of the title field?

Cheers

Chris McGuicken

Chris McGuicken 1 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Use perch_products_custom() and you can set a sort order.

I tried

<?php perch_products_custom(array( sort => 'productTitle', sort-order => 'DESC' ))?>

And got this:

Fatal error: Call to undefined function perch_products_custom() in /home/web_com/rpm.web.com/shop/category.php on line 78

OK it was suppose to be perch_shop_custom I am guessing?

Used this instead:

<?php perch_shop_custom(array( 'template'=>'shop/product_in_list.html', 'sort' => 'productTitle', 'sort-order' => 'DESC' ))?>

But now it shows all products from all categories. How do I get it to show just the category that the user has chosen?

Got it sorted from a buddy:

<?php $currentcat = $_GET["cat"];
perch_shop_custom(array( 'category' => $currentcat, 'template'=>'shop/product_in_list.html', 'sort' => 'productTitle', 'sort-order' => 'DESC' ))?>