Jump to content

Colocar imagem de cada produto no histórico de pedidos

Recommended Posts

Posted (edited)

Boa tarde.

Versão 1.6.x

Estou tentando colocar a foto de cada produto no Histórico dos pedidos. Já consegui mostrar imagens na página do histórico, mas ela se repete em todos os pedidos. Vou colar aqui o código que eu fiz até agora no controller HistoryController.php

public function initContent()

        if ($orders = Order::getCustomerOrders($this->context->customer->id)) {

            foreach ($orders as &$order) {
                $myOrder = new Order((int)$order['id_order']);

                if (Validate::isLoadedObject($myOrder)) {
                    $order['virtual'] = $myOrder->isVirtual(false);


                           $myOrder = new Order((int)$order['id_order']);   
                            $products = $myOrder->getProducts();
                            $product_ids = array();
                            foreach ($products as $product){
                            $product_ids[] = (int)$product['id_product'];
                            $cover = Image::getCover((int)$product['id_product']); // array image

                            if (sizeof($cover['id_image']) > 0) {
                                $folder = Image::getImgFolderStatic($cover['id_image']);  // folders inside /img/p/
                                $image = '<img src="../img/p/'.$folder.$cover['id_image'].'-medium_default.jpg" alt="" width="125" height="125" class="imgm img-thumbnail" />';
                            } else {
                                $image = '<img src="../img/p/en-default-medium_default.jpg" alt="" width="125" height="125" class="imgm img-thumbnail" />';

            'orders' => $orders,
            'images' => $image,
            'invoiceAllowed' => (int)Configuration::get('PS_INVOICE'),
            'reorderingAllowed' => !(bool)Configuration::get('PS_DISALLOW_HISTORY_REORDERING'),
            'slowValidation' => Tools::isSubmit('slowvalidation')


Alguém pode me ajudar a mostrar a figura de cada pedido?

Muito obrigado

Edited by jonyellery (see edit history)

Share this post

Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More