anuraj_pr Posted June 23, 2016 Share Posted June 23, 2016 (edited) hello, I want a product price,discount percentage/price,price after discount in a controller by product Id,..when i go through several search results it shows only displayed it on a tpl file.how to get these values in a controller file..Thanks in advance.. Edited June 23, 2016 by anuraj_pr (see edit history) Link to comment Share on other sites More sharing options...
Radhanatha Posted June 23, 2016 Share Posted June 23, 2016 This is the way to find discount price percentage by product id: require_once('./config/config.inc.php'); require_once('init.php'); $context = \Context::getContext(); $product=new Product($params['id_product'], false, $context->language->id); $id_customer = (isset($context->customer) ? (int)$context->customer->id : 0); $id_group = (isset($tcontext->customer) ? $tcontext->customer->id_default_group : _PS_DEFAULT_CUSTOMER_GROUP_); $id_country = (int)$id_customer ? Customer::getCurrentCountry($id_customer) : Configuration::get('PS_COUNTRY_DEFAULT'); $id_currency = (int)$context->cookie->id_currency; $id_shop = (int)$context->shop->id; $quantity_discounts = SpecificPrice::getQuantityDiscounts($product->id, $id_shop, $id_currency, $id_country, $id_group, null, true,$id_customer); Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now