2. Installation

1. Files copy

Before you upload files on your server, you must rename directory « admin_bms » with the name of your admin panel.Then, upload all files on your server.

_images/93dff7e43c8695f13ab5d38834005f7a.png

2. Module installation

Once all files are uploaded, go in Prestashop Admin Panel and select « modules » tab : in this tab, select the « administration » section and click on the « Install » button.

_images/f339e641ab694c1a618de7a9d07cde2b.png

Once the module is installed, a new « ERP » tab is visibile :

_images/df0022363368b01b33d330bcc0dbedc1.png

3. Hooks installation

To customize Prestashop behaviour, it is necessary to edit Prestashop core files.

Note: Line numbers are given in a indicative way, they depending on PrestaShop version, pay attention to the “Location” section to add correctly the code into the file.

1. Supplier sheet

Prestashop 1.5 :

No additional code is required.

Prestashop < 1.5 :

  • Edit file : /[name_of_your_admin_directory]/tabs/AdminSuppliers.php
  • Code to be added : echo Module::hookExec(‘supplierSheetForm’, array(‘supplier’ => $supplier));
  • Location (around line 201) :
<input type="radio" name="active" id="active_off" [….] alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label></div>';

echo Module::hookExec('supplierSheetForm', array('supplier' => $supplier));

echo '<div class="margin-form"><input type="submit" value="'.$this->l(' Save ').'" […] <sup>*</sup> '.$this->l('Required field').'</div>

2. Product sheet (back office)

Prestashop 1.5 :

  • Edit file : /[name_of_your_admin_directory]/themes/[name_of_your_theme]/template/controllers/products/quantities.tpl
  • Code to be added : {hook h=’catalogProductSheetAfterStocks’ product=$product}
  • Location (around line 208) :
{if !$has_attribute}

<tr>

<td class="col-left"><label>{l s='Minimum quantity:'}</label></td>

<td style="padding-bottom:5px;">

<input size="3" maxlength="6" name="minimal_quantity" id="minimal_quantity" type="text" value="{$product->minimal_quantity|default:1}" />

<p class="preference_description">{l s='The minimum quantity to buy this product (set to 1 to disable this feature)'}</p>

</td>

</tr>

{/if}

{hook h='catalogProductSheetAfterStocks' product=$product}

{if $ps_stock_management}

<tr>

<td class="col-left">

...

Prestashop < 1.5 :

  • Edit file : /[name_of_your_admin_directory]/tabs/AdminProducts.php
  • Code to be added : echo Module::hookExec(‘catalogProductSheetAfterStocks’, array(‘product’ => $obj));
  • Location (around line 2706) :
if ($obj->id)

echo '<tr><td class="col-left">'.$this->l('Quantity in stock:') [.....] value="'.$qty.'" /></td></tr>';

echo Module::hookExec('catalogProductSheetAfterStocks', array('product' => $obj));

if ($has_attribute)

echo '<tr><td class="col-left">&nbsp;</td><td><div [….] quantity here, but in the Combinations tab').'</div></td></tr>';

3. Product sheet (front office)

Prestashop 1.5 :

  • Edit file : /themes/[name_of_your_theme]/product.tpl
  • Code to be added :
<!-- [START ERP SUPPLY DATE] -->
<p id="pSupplyDate" {if $product->quantity > 0 || $allow_oosp || $product->getSupplyDate() == '-'} style="display:none;" {/if}>
<span id="supply_date_label">{l s='Available from'} : </span><br/>
<span id="supply_date_value">{$product->getSupplyDate()}</span>
</p>
<!-- [END ERP SUPPLY DATE] -->
  • Location (around line 368) :
<!-- number of item in stock -->

{if ($display_qties == 1 && !$PS_CATALOG_MODE && $product->available_for_order)}

[...]
</p>

{/if}

<!-- [START ERP SUPPLY DATE] -->

<p id="pSupplyDate" {if $product->quantity > 0 || $allow_oosp || $product->getSupplyDate() == '-'} style="display:none;" {/if}>

<span id="supply_date_label">{l s='Available from'} : </span><br/>

<span id="supply_date_value">{$product->getSupplyDate()}</span>

</p>

<!-- [END ERP SUPPLY DATE] -->

<!-- Out of stock hook -->

<div id="oosHook"{if $product->quantity > 0} style="display: none;"{/if}>

{$HOOK_PRODUCT_OOS}

</div>

Prestashop < 1.5 :

  • Edit file : /themes/[name_of_your_theme]/product.tpl
  • Code to be added :
<!-- [START ERP SUPPLY DATE] -->

<p id="pSupplyDate" {if $product->quantity > 0 || $allow_oosp || $product->getSupplyDate() == '-'}style="display:none;" {/if}>

<span id="supply_date_label">{l s='Available from'} : </span><br/>

<span id="supply_date_value">{$product->getSupplyDate()}</span>

</p>

<!-- [END ERP SUPPLY DATE] -->
  • Location (around line 353) :
<!-- number of item in stock -->

{if ($display_qties == 1 && !$PS_CATALOG_MODE && $product->available_for_order)}

[...]

{/if}

<!-- [START ERP SUPPLY DATE] -->

<p id="pSupplyDate" {if $product->quantity > 0 || $allow_oosp || $product->getSupplyDate() == '-'}style="display:none;" {/if}>

<span id="supply_date_label">{l s='Available from'} : </span><br/>

<span id="supply_date_value">{$product->getSupplyDate()}</span>

</p>

<!-- [END ERP SUPPLY DATE] -->

<!-- Out of stock hook -->

{if !$allow_oosp}

[...]

{/if}