Jump to content

Star rating On custom product List page


gitexperts

Recommended Posts

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

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