Ejemplo n.º 1
0
 /**
  * Given a product_id and vendor_id
  * will perform a full CSV reconciliation of the _productquantities table
  *
  * @param $product_id
  * @param $vendor_id
  * @param $attributeOptionId
  * @return unknown_type
  */
 static function doProductQuantitiesReconciliation($product_id, $vendor_id = '0', $attributeOptionId = '0')
 {
     if (empty($product_id)) {
         return false;
     }
     if (J2STORE_PRO != 1) {
         return false;
     }
     $params = JComponentHelper::getParams('com_j2store');
     if (!$params->get('enable_inventory', 0)) {
         return false;
     }
     $csvs = J2StoreItem::getProductAttributeCSVs($product_id, $attributeOptionId);
     JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_j2store/models');
     $model = JModelLegacy::getInstance('ProductQuantities', 'J2StoreModel');
     $model->setState('filter_productid', $product_id);
     $items = $model->getList();
     $results = J2StoreItem::reconcileProductAttributeCSVs($product_id, $vendor_id, $items, $csvs);
 }