Jump to content

Afficher le nom du produit (packs) et les autres sous produits (standards)


Recommended Posts

Environnement de travail :

localhost : xampp dernière version, sur Ubuntu

apache web server

mySQL database

Ubuntu

 

Bonjour,

Je m'adresse à vous, car j'aimerais afficher dans mon pdf pas que le produit, qui est un produit pack, mais aussi la liste des noms des produits qui sont dans le packs.

                 <tbody>
                 {foreach from=$details item=value}
                     {math assign='product_total' equation='x*y' x=$value.product_price y=$value.product_quantity}
                     <tr>
                         <td align="left" class="details-{$value.id_pdf_detail|escape:'htmlall':'UTF-8'}"
                             id="product_reference">
                             {$value.product_reference|escape:'htmlall':'UTF-8'}
                         </td>
                         <td align="left" class="details-{$value.id_pdf_detail|escape:'htmlall':'UTF-8'}"
                             id="product_name">
                             {$value.product_name|escape:'htmlall':'UTF-8'}<br>
                             {$value.name|escape:'htmlall':'UTF-8'}<br>
                             {if isset($customizations) && $customizations}
                                 {l s='Customization :' mod='pdf_document'}<br>
                                 {foreach from=$customizations item=customization}
                                     {if $customization.product_id == $value.product_id}
                                         {foreach from=$customization.customizations item=$cust}
                                             {$cust|escape:'htmlall':'UTF-8'}<br>
                                         {/foreach}
                                     {/if}
                                 {/foreach}
                             {/if}
                         </td>

Dans mon fichier de base modules/pdf_document/pdf_document.php ,dans la fonction

private function createSimplePdfDoc($id_product, $id_product_attribute, $id_customization, $qty)

$pdfdetail->product_name = (string)$cart_product['name'];

Puis dans ma fonction HookOptions($params)

$cartproducts = $cart->getProducts();
        $customerGroups = Customer::getGroupsStatic((int)$cart->id_customer);
        $selected_cat = $this->getAllowedCategories();
        $allowed_groups = $this->getAllowedGroups();
        foreach ($cartproducts as $cartproduct) {
            $product = new Product((int)$cartproduct['id_product']);
            if (!in_array($product->id_category_default, $selected_cat)) {
                return;
            }
            if ($product->visibility == 'none'
                || (bool)$product->available_for_order === false
                || (bool)$product->show_price === false
            ) {
                return;
            }
        }

Et dans ma fonction hookDIsplayDoc() :

        $cart = $this->context->cart;
        $cartproducts = $cart->getProducts();
        $customerGroups = Customer::getGroupsStatic((int)$this->context->customer->id);
        $selected_cat = $this->getAllowedCategories();
        $allowed_groups = $this->getAllowedGroups();
        foreach ($cartproducts as $cartproduct) {
            $product = new Product((int)$cartproduct['id_product']);
            if (!in_array($product->id_category_default, $selected_cat)) {
                return;
            }
        }
        if (!array_intersect($allowed_groups, $customerGroups)
            || empty($allowed_groups)
        ) {
            return;
        }

 

Auriez-vous une idée ?

 

Cordialement

 

Futamiya

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
 Share

×
×
  • Create New...

Important Information

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