Author Topic: Product navigation problem with override price  (Read 179 times)

restodo

  • Jr. Member
  • **
  • Posts: 71
Product navigation problem with override price
« on: September 11, 2017, 04:23:10 am »
Hi,

I’m having a problem with product navigation when some product has an override price.

For example I have:

Product 1 : Cost price $ 7509 / Override $ 0 / Disabled
Product 2 : Cost price $ 7933 / Override $ 0 / Disabled
Product 3 : Cost price $ 13499 / Override $ 8499 / Overwrite final
Product 4 : Cost price $ 8549 / Override $ 0 / Disabled

A correct product navigation from lower to higher price should be: Product 1 -> Product 2 -> Product 3 -> Product 4
But the product navigation is: Product 1 -> Product 2 -> Product 4 -> Product 3

Someone could tell me how can I solve this problem?

I’ve been looking in /administrator/components/com_virtuemart/models/product.php and try to modify getNeighborProducts unsuccessfully

I’m using Joomla 3.7.5 and Virtuemart 3.2.4


Thanks!

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 1022
    • Kreativ Fotografi
  • VirtueMart Version: 3.0.19.9
Re: Product navigation problem with override price
« Reply #1 on: September 11, 2017, 06:41:25 am »
Try and switch to template protostar.

regards Jörgen @ Kreativ Fotografi
Joomla 3.6.5
Virtuemart 3.0.19.9
Olympiantheme Hera (customized)

Ghost

  • Jr. Member
  • **
  • Posts: 341
Re: Product navigation problem with override price
« Reply #2 on: September 11, 2017, 10:24:43 am »
VM doesn't take price overrides, taxes and discounts into account when sorting by price. Only base price is used.

restodo

  • Jr. Member
  • **
  • Posts: 71
Re: Product navigation problem with override price
« Reply #3 on: September 11, 2017, 15:49:37 pm »
Try and switch to template protostar.

regards Jörgen @ Kreativ Fotografi

I've tried protostar template and same result.

restodo

  • Jr. Member
  • **
  • Posts: 71
Re: Product navigation problem with override price
« Reply #4 on: September 11, 2017, 15:51:34 pm »
VM doesn't take price overrides, taxes and discounts into account when sorting by price. Only base price is used.

VM has problem with price overrides only in product navigation nor in category view or other listing.
Then I think VM take price overrides when sorting by price in other places than product navigation.

restodo

  • Jr. Member
  • **
  • Posts: 71
Re: Product navigation problem with override price
« Reply #5 on: September 12, 2017, 15:15:36 pm »
Nobody?

I've found that this line is responsible of making a correct listing of products in a category.
$ff_select_price = ' , IF(pp.override, pp.product_override_price, pp.product_price) as product_price ';

But I can not find how to solve the navigation problem in products.



restodo

  • Jr. Member
  • **
  • Posts: 71
Re: Product navigation problem with override price
« Reply #6 on: September 13, 2017, 19:13:54 pm »
I've solved the problem modifying the following functions.


public function getNeighborProducts ($product, $onlyPublished = TRUE, $max = 1) {

LINE 1893

if($orderByNameMain=='product_price'){
     if(isset($product->prices['product_price'])){
         //$product->prices['product_price'];
         $product->product_price = $product->prices['product_override_price']; // New Line //
     } else {
         $product->product_price = 0.0;
     }
}


LINE 1915

//$whereorderByName = $orderByNameMain;
if ($orderByNameMain=='product_price'){ // New Lines //
    $whereorderByName = ' product_override_price';
    $orderByName = str_replace('product_price', 'product_override_price', $orderByName);
} else {
    $whereorderByName = $orderByNameMain;
}
               
            

public function store (&$product) {

LINE 2132

//$pricesToStore['product_override_price'] = $data['mprices']['product_override_price'][$k];
if ((int)$data['mprices']['override'][$k] == 1) {  // New Lines //
   $pricesToStore['product_override_price'] = $data['mprices']['product_override_price'][$k];
} else {
   $pricesToStore['product_override_price'] = $data['mprices']['product_price'][$k];
}