Jump to content

i want to add filter by warehouse in available quantities and the code complex how will make this?


Recommended Posts

```

$sql = 'SELECT p.id_product, p.reference, pl.name, IFNULL(( SELECT AVG(product_attribute_shop.wholesale_price) FROM ' . _DB_PREFIX_ . 'product_attribute pa ' . Shop::addSqlAssociation('product_attribute', 'pa') . ' WHERE p.id_product = pa.id_product AND product_attribute_shop.wholesale_price != 0 '; if (version_compare(_PS_VERSION_, '1.7.0.0', '>=')) { $sql .= 'AND p.state = ' . Product::STATE_SAVED . ' '; } $sql .= '), product_shop.wholesale_price) as wholesale_price, IFNULL(stock.quantity, 0) as quantity FROM ' . _DB_PREFIX_ . 'product p ' . Shop::addSqlAssociation('product', 'p') . ' INNER JOIN ' . _DB_PREFIX_ . 'warehouse_product_location wpl ON( wpl.id_product = p.id_product ' . $wherew .') INNER JOIN ' . _DB_PREFIX_ . 'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = ' . (int)$this->context->language->id . Shop::addSqlRestrictionOnLang('pl') . ') ' . Product::sqlStock('p', 0); if (version_compare(_PS_VERSION_, '1.7.0.0', '>=')) { $sql .= ' WHERE p.state = ' . Product::STATE_SAVED . ' '; }

```

 

image.thumb.png.36a52a807db10863136a767863a41134.png

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...