13. Miscellaneous

1. Export data

A. Export data with ERP

While installing extensions, export profiles are created in order to allow you to export purchasing extension’s data. All exports are made with the CSV format.

See also

You can access to these exports from System menu > Import/export > Advanced Profiles.

Following exports are available :

  • Export Purchase Order : Exports supplier orders list
  • Export Purchase Order Products : Exports supplier orders products list
  • Export Suppliers : Exports suppliers
  • Export Contact : Exports contacts
  • Export Supply Needs: Exports supply needs (at time T).
  • Export Product : Exports products ( for buying purposes)
  • Export Stock Movement : Exports stock movements for all products
  • Export Order To Prepare Pending: Exports shipment pending customer’s orders (full order or pending order waiting to be fully received).
  • Export Order To Prepare : Exports selected customer’s orders for order preparation
  • Export Order To Prepare Items : Exports selected orders products for order preparation

To execute an export, you just have to select it from export list, to select tab ” Execute the profile ” and to click on ” Execute the profile in a popup “.

The profile is executed and once completed, shows the path of created file.Kindly note all exports are made in the file /var/export in Magento. (please be careful, this field shall exist otherwise export will show an error).


Please note, in the Embedded ERP there is no reporting system .

B. Tips Magento : export product data

1. Select a product that will be used as example to test the export, keeping in mind it must have the same attribute set than the others products you will export. In this way, you can make sure that all the attributes you want will be present in the export columns.

  1. Try to find a product which has got a maximum of attributes already filled, it will make the following steps more easy to do. Note its SKU.
  2. Go in System > Import/Export > Export.
  3. Select “Products” as Entity Type, and “CSV” as Export File Format.
  4. In the displayed attributes grid, only check the SKU checkbox. Then, click on continue at page bottom.
  5. You will get an example file with dozens of columns, and only one product : the one you choosen. Open this file with a CSV editor, like OpenOffice for example. Don’t touch to the original product, expect if you want to modify it.

7. Then, regarding the previously choosen product, enter line by line the columns you want. A lot of fields are mandatory :

sku _attribute_set _type _category _root_category _product_websites description anme short_description status taxclass_id price visibility weigth

For thoose you don’t know, just copy what you have in the initial product.

8. For inventory, you can put the same quantity than the “qty” field one, it will work with ERP. Please don’t touch to the columns you don’t really know.

  1. Don’t forget to fill the cost and price with a dot as decimal separator, because thecoma is already used as columns separator.

10. Then, go in Système > Import Export > Import Put these options : - Products - Append complex data

  1. Select your file.
  2. Click on “Check Data”. Magento will do a file-check, and will tell you if some fields are missing.
  3. If everything is alright, a button will appear, and you will be able to import the file.

2. Developer corner

You will find there most useful ERP functions, callable from any program :

Create a stock movement

$additionalDatas = array('sm_type' => 'adjustment');


Create a background task

mage::helper('BackgroundTask')->AddTask($title,  'helperPath',  'helperfunctionName',  $functionParameter );

Create an organizer

->setot_entity_description($helper->__('Order #%s',$order->getincrement_id()))

Force stock update on a product


Force stock update on a product using a Background Task


Refresh product availability status


Get data from a product availability status

$productAvailabilityStatus = mage::helper('SalesOrderPlanning/ProductAvailabilityStatus')->getForOneProduct($productId,$websiteId);
echo $productAvailabilityStatus->getMessage();
echo $productAvailabilityStatus->getBackInStockDate();
echo $productAvailabilityStatus->getSupplyDelay();
echo $productAvailabilityStatus->getAvailableQty();

Display each warehouse qty of a simple product

$stocks = mage::helper('AdvancedStock/Product_Base')->getStocks($_productSimple->getId());
foreach ($stocks as $stockItem) {
     echo $stockItem->getQty(); //real stock qty
     echo $stockItem->getAvailableQty(); //stock qty real available after ERP reservation

Display each warehouse qty of all childs products associated to a configurable

$childIds = Mage::getModel('catalog/product_type_configurable')->getChildrenIds($_productConfigurable->getId());
foreach ($childIds as $key => $childId) {
    $stocks = mage::helper('AdvancedStock/Product_Base')->getStocks($childId);
    foreach ($stocks as $stockItem) {
        echo 'qty= '.$stockItem->getAvailableQty();

Display simple product qty for a given warehouse

$stocks = mage::helper('AdvancedStock/Product_Base')->getStocks($_product->getId());
foreach ($stocks as $stockItem) {
   $stockId = $stockItem->getstock_id();
   $warehouse = mage::getModel('AdvancedStock/Warehouse')->load($stockId);
   echo $warehouse->getstock_name().' : '.$stockItem->getAvailableQty().'<br/>';


Since ERP, a new module called ERP API is provided as standard.

It open a list of features of ERP for a classic Magento API usage via SOAP.

This module has been developed as the connector for ERP Droid features.

Since ERP, we had a list of functions to export Purchase Orders, suppliers and purchase order product for Accounting needs.

Available functions :

Stock management part







  getProductImage($productId, $getBase64 = false, $resize = false, $width = 50, $height=50){


  productPurchaseOrdersList($id, $limit)



  productPendingSalesOrdersList($id, $limit)

  productStockMovementList($id, $limit)


Purchase part

  purchaseOrdersBySupplierId($supplierId,  $limit)


  getSuppliers($supplierId = null)


  getPurchaseOrders($poUpdatedAtFrom = null, $poUpdatedAtTo = null, $poSent = null,$poPaid = null, $poFinished = null)


  purchaseOrderDelivery($purchaseOrderId,$targetWarehouseId, $itemsDelivered, $itemsDeliveredDefect)

Order preparation part




    getSelectedOrders($preparationWarehouseId, $operatorId)


    getRemainToShipOrderItems($orderId, $warehouseId)

    commitPacking($orderId,$warehouseId,$operatorId = 1, $weight = null){

    addToSelectedOrders($orderId,$warehouseId,$operatorId = 1){

    removeFromSelectedOrders($orderId,$warehouseId,$operatorId = 1){