Jump to content

Get data from same table with JOIN / Wholesale_price


Krikis

Recommended Posts

0

As Prestashop 1.7 doesn't support simple product.wholesale_price variable.... Looking for some SQL request to get Wholesale_price in Back Office admin product catalog list to add additional column.

Currently I have this code, but it doesn't fetch Wholesale_price according to id_product. Maybe some one could assist where is my mistake?

public function hookActionAdminProductsListingFieldsModifier($params)
{
    $params['sql_select']['product'] = [
        'table' => 'm',
        'field' => 'wholesale_price',
        'filtering' => \PrestaShop\PrestaShop\Adapter\Admin\AbstractAdminQueryBuilder::FILTERING_LIKE_BOTH
        ];
    
    $params['sql_table']['m'] = [
        'table' => 'product',
        'join' => 'LEFT JOIN',
        'on' => 'p.`id_product` = m.`id_product`',
    ];
}

 

wholesale.png

Edited by Krikis
deleted comments (see edit history)
Link to comment
Share on other sites

  • 5 months later...
Just now, Adnan Nahri said:

Where you able to do this by any chance?

I wanted to add a columns for Wholesale price whiting the order details for each order.
I was able to do this after a lot of changes while using 1.7.4.2, but I was still missing the quantity so the column will only show the wholesale price of a single unit even if the client got X quantity of that product in the order. I also wasn't able to display the corret wholesale total price, instead I always got the wholesale price of the last product within the order. 

Unfortunately, After I updated to 1.7.8.6,  everything is gone. and the old routes aren't working 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...