Jump to content

[RESOLU] [1.6] Afficher quantité en stock dans le bordereau de livraison


Recommended Posts

Bonjour à tous,
 
Je suis en Prestashop 1.6.1.10 et en multi-boutique
 
Pour préparer les commandes à expédier, on utilise le bordereau de livraison.
 
Mon problème est le suivant : Je voudrais faire apparaître discrètement la quantité en stock restante pour chaque produit. Ainsi, en même temps, le préparateur pourrait contrôler le stock du produit qu il est entrain de prendre. 
 
post-840283-0-58546200-1485211131_thumb.png
 
J ai un peu creusé la question mais je n y arrive pas.
 
Dans /pdf/delivery-slip.product-tab.tpl j ai remplacé :
 
				<td class="product center">
					{if empty($order_detail.product_reference)}
						---
					{else}
						{$order_detail.product_reference} 
					{/if}
				</td>

par 

				<td class="product center">
					{if empty($order_detail.product_reference)}
						---
					{else}
						{$order_detail.product_reference} #{$order_detail.product_quantity_in_stock} 
					{/if}
				</td>
 
... mais ça ne marche pas, il me retourne la quantité commandée
 
post-840283-0-77635700-1485211185_thumb.png
 
Pouvez-vous m'aider ?
 
Merci d'avance et bonne journée.
 

 

Edited by srslctv786 (see edit history)
Link to comment
Share on other sites

Alors... je me répond à moi même et à ceux qui sont aussi intéressés.

 

Dans /pdf/delivery-slip.product-tab.tpl j ai remplacé :

				<td class="product center">
					{if empty($order_detail.product_reference)}
						---
					{else}
						{$order_detail.product_reference} 
					{/if}
				</td> 

par 

				<td class="product center">
					{if empty($order_detail.product_reference)}
						---
					{else}
						{$order_detail.product_reference} #{$order_detail.product_quantity_in_stock} 
					{/if}
				</td> 

ensuite ce qu'il me manquait

 

Dans classes/PDF/HTMLTemplateDeliverySlip.php  j'ai remplacé :

        if (Configuration::get('PS_PDF_IMG_DELIVERY')) {
            foreach ($order_details as &$order_detail) {
                if ($order_detail['image'] != null) {
                    $name = 'product_mini_'.(int)$order_detail['product_id'].(isset($order_detail['product_attribute_id']) ? '_'.(int)$order_detail['product_attribute_id'] : '').'.jpg';
                    $path = _PS_PROD_IMG_DIR_.$order_detail['image']->getExistingImgPath().'.jpg';

                    $order_detail['image_tag'] = preg_replace(
                        '/\.*'.preg_quote(__PS_BASE_URI__, '/').'/',
                        _PS_ROOT_DIR_.DIRECTORY_SEPARATOR,
                        ImageManager::thumbnail($path, $name, 45, 'jpg', false),
                        1
                    );

                    if (file_exists(_PS_TMP_IMG_DIR_.$name)) {
                        $order_detail['image_size'] = getimagesize(_PS_TMP_IMG_DIR_.$name);
                    } else {
                        $order_detail['image_size'] = false;
                    }
                }
            }
        } 

par 

        if (Configuration::get('PS_PDF_IMG_DELIVERY')) {
            foreach ($order_details as &$order_detail) {
                if ($order_detail['image'] != null) {
                    $name = 'product_mini_'.(int)$order_detail['product_id'].(isset($order_detail['product_attribute_id']) ? '_'.(int)$order_detail['product_attribute_id'] : '').'.jpg';
                    $path = _PS_PROD_IMG_DIR_.$order_detail['image']->getExistingImgPath().'.jpg';

                    $order_detail['image_tag'] = preg_replace(
                        '/\.*'.preg_quote(__PS_BASE_URI__, '/').'/',
                        _PS_ROOT_DIR_.DIRECTORY_SEPARATOR,
                        ImageManager::thumbnail($path, $name, 45, 'jpg', false),
                        1
                    );

                    if (file_exists(_PS_TMP_IMG_DIR_.$name)) {
                        $order_detail['image_size'] = getimagesize(_PS_TMP_IMG_DIR_.$name);
                    } else {
                        $order_detail['image_size'] = false;
                    }
                }
				$order_detail['product_quantity_in_stock'] = StockAvailable::getQuantityAvailableByProduct($order_detail['product_id'],$order_detail['product_attribute_id']) ;
            }
        } 

en fait j'ai juste renseigné $order_detail['product_quantity_in_stock']

$order_detail['product_quantity_in_stock'] = StockAvailable::getQuantityAvailableByProduct($order_detail['product_id'],$order_detail['product_attribute_id']) ;
Edited by srslctv786 (see edit history)
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...