Post by glolar » Thu Oct 10, 2019 6:40 am

Hello,

By default, products in the cart seem to be sorted by date added (The date_added field in the product table). I need the products in the cart to be sorted by model (the model field in the product table).

For the life of me, I cannot find the code that is setting the default to "date_added". If someone has the solution to this, it would be greatly appreciated!

Larry

Increase Your Child's I.Q.
iPad Wallpapers
Turtle & Tortoise Screen Savers


User avatar
Active Member

Posts

Joined
Thu Jul 29, 2010 12:35 pm
Location - San Diego, CA

Post by thekrotek » Thu Oct 10, 2019 2:20 pm

Try to add this before "return $product_data;" in getProducts() function of system/library/cart/cart.php file:

usort($product_data, function ($a, $b) { return strcmp($a['model'], $b['model']); });

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member
Online

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by glolar » Fri Oct 11, 2019 12:55 am

thekrotek, that seems to have solved the issue.

I was trying to add changes to /store/catalog/controller/checkout/cart.php, and not the cart.php in /store/system/library/cart.

Cannot thank you enough!

Increase Your Child's I.Q.
iPad Wallpapers
Turtle & Tortoise Screen Savers


User avatar
Active Member

Posts

Joined
Thu Jul 29, 2010 12:35 pm
Location - San Diego, CA

Post by glolar » Fri Oct 11, 2019 1:05 am

thekrotek,

Since you have been so helpful here, (and many times in the past), could I ask you a quick question? Do you know what determines which products are in the "Bestsellers" list ... Is it the products that have sold the most quantity, or is it based on total dollar amount sold for each product? I would like to look at the code that determines this, so if you know which file to look in, that would be extremely helpful.

Thanks again, thekrotek!

Larry

Increase Your Child's I.Q.
iPad Wallpapers
Turtle & Tortoise Screen Savers


User avatar
Active Member

Posts

Joined
Thu Jul 29, 2010 12:35 pm
Location - San Diego, CA

Post by thekrotek » Fri Oct 11, 2019 4:41 am

The first one - most purchased. The total sum of all product quantities from all orders with this product.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member
Online

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by glolar » Fri Oct 11, 2019 4:45 am

thekrotek,

Yeah, I found the code with the query to fetch the bestsellers. I modified it to only include products ordered in the last 120 days.

Thanks again for all the help!

Larry

Increase Your Child's I.Q.
iPad Wallpapers
Turtle & Tortoise Screen Savers


User avatar
Active Member

Posts

Joined
Thu Jul 29, 2010 12:35 pm
Location - San Diego, CA
Who is online

Users browsing this forum: pprmkr and 22 guests