gitexperts Posted September 8, 2022 Share Posted September 8, 2022 Hello everyone, How to get star rating on custom product list page, Please see my attached code. public function getProductdata($p_id, $qty=1) { $product_data = array(); // Load Product Object $product = new Product($p_id); $is_product = Validate::isLoadedObject( $product ); if($is_product){ // Language id $id_lang = (int) Configuration::get('PS_LANG_DEFAULT'); // Get cover image for your product $image = Image::getCover($p_id); // Initialize the link object $link = new Link(); // Get Product URL $url = $link->getProductLink($product); $product_data['image_path'] = $link->getImageLink($product->link_rewrite[Context::getContext()->language->id], $image['id_image'], 'home_default'); $product_data['name'] = $product->name[$id_lang]; $product_data['price'] = Product::getPriceStatic($p_id); $product_data['_price'] = Tools::displayPrice($product_data['price']); $product_data['stock'] = Product::getQuantity($p_id); $product_data['url'] = $url; $product_data['qty'] = $qty; $product_data['p_id'] = $p_id; //$all_products[] = $product_data; } return $product_data; } I want get review in this function. Thanks in advance. Link to comment Share on other sites More sharing options...
webprog Posted September 9, 2022 Share Posted September 9, 2022 Hello, star rating is getting from functions of productcomments module. There are no rating functions in the core classes. 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