예제 #1
0
 /**
  * Method to create subproperty in E-conomic
  *
  * @access public
  * @return array
  */
 public function createSubpropertyInEconomic($prdrow = array(), $row = array())
 {
     $eco['product_desc'] = '';
     $eco['product_s_desc'] = '';
     $ecoProductGroupNumber = $this->createProductGroupInEconomic($prdrow);
     if (isset($ecoProductGroupNumber[0]->Number)) {
         $eco['product_group'] = $ecoProductGroupNumber[0]->Number;
     }
     $eco['product_number'] = $row->subattribute_color_number;
     if (ATTRIBUTE_AS_PRODUCT_IN_ECONOMIC == 2) {
         $eco['product_name'] = addslashes($row->subattribute_color_name);
         $string = trim($prdrow->product_price . $row->oprand . $row->subattribute_color_price);
         eval('$eco["product_price"] = ' . $string . ';');
     } else {
         $eco['product_name'] = addslashes($row->subattribute_color_name);
         $eco['product_price'] = $row->subattribute_color_price;
     }
     $eco['product_volume'] = 1;
     $debtorHandle = $this->_dispatcher->trigger('Product_FindByNumber', array($eco));
     $eco['eco_prd_number'] = "";
     if (count($debtorHandle) > 0 && isset($debtorHandle[0]->Number) != "") {
         $eco['eco_prd_number'] = $debtorHandle[0]->Number;
     }
     $stockamount = $this->_stockroomhelper->getStockroomTotalAmount($row->subattribute_color_id, "subproperty");
     // Start update stock info for redCRM stock tracking system
     if ($this->_redhelper->isredCRM() && ENABLE_ITEM_TRACKING_SYSTEM) {
         // Supplier order helper object
         $crmSupplierOrderHelper = new crmSupplierOrderHelper();
         // Get subattribute info for property id
         $subattributeData = $this->_producthelper->getAttibuteSubProperty($row->subattribute_color_id);
         $stockdata = new stdClass();
         $stockdata->product_id = $prdrow->product_id;
         $stockdata->property_id = $subattributeData[0]->subattribute_id;
         $stockdata->subproperty_id = $row->subattribute_color_id;
         $stockamount = $crmSupplierOrderHelper->getSupplierStock($stockdata);
     }
     $eco['product_stock'] = $stockamount;
     $ecoProductNumber = $this->_dispatcher->trigger('storeProduct', array($eco));
     return $ecoProductNumber;
 }
예제 #2
0
        $stockWhere = USE_STOCKROOM ? " 1=1" : " stockroom_id = " . DEFAULT_STOCKROOM;
        $stockroom_list = $crmHelper->getStockroom('stockroom_id AS value,stockroom_name AS text', "1", $stockWhere);
        $stockroomname = $stockroom_list[0]->text;
        $data = new stdClass();
        $data->product_id = $this->detail->product_id;
        $data->property_id = 0;
        $data->subproperty_id = 0;
        if ($section == 'property') {
            $data->property_id = $section_id;
        } elseif ($section == 'subproperty') {
            // Get data for property id.
            $subattribute_data = $this->getAttibuteSubProperty($section_id);
            $data->property_id = $subattribute_data[0]->subattribute_id;
            $data->subproperty_id = $section_id;
        }
        $stockAmount = $crmSupplierOrderHelper->getSupplierStock($data);
        $deliveryTime = DEFAULT_DELIVERY_DAYS_STATUS_PENDING;
        if ($stockAmount > 0) {
            $deliveryTime = DEFAULT_DELIVERY_DAYS_STATUS_ACTIVE;
        }
        ?>
							<tr>
								<td><?php 
        echo $stockroomname;
        ?>
</td>
								<td><?php 
        echo $stockAmount;
        ?>
</td>
							</tr>
예제 #3
0
 function getPreorderStockAmountwithReserve($section_id = 0, $section = "product", $stockroom_id = 0)
 {
     $quantity = 1;
     if (USE_STOCKROOM == 1) {
         $and = "";
         $table = "product";
         $db = JFactory::getDbo();
         if ($section != "product") {
             $table = "product_attribute";
         }
         if ($section_id != 0) {
             // Sanitize ids
             $section_id = explode(',', $section_id);
             JArrayHelper::toInteger($section_id);
             if ($section != "product") {
                 $and = "AND x.section = " . $db->quote($section) . " AND x.section_id IN (" . implode(',', $section_id) . ") ";
             } else {
                 $and = "AND x.product_id IN (" . implode(',', $section_id) . ") ";
             }
         }
         if ($stockroom_id != 0) {
             $and .= "AND x.stockroom_id = " . (int) $stockroom_id . " ";
         }
         $query = "SELECT SUM(x.preorder_stock) as preorder_stock, SUM(x.ordered_preorder) as ordered_preorder FROM " . $this->_table_prefix . $table . "_stockroom_xref AS x " . ", " . $this->_table_prefix . "stockroom AS s " . "WHERE s.stockroom_id=x.stockroom_id " . "AND x.quantity>=0 " . $and . "ORDER BY s.min_del_time ";
         $db->setQuery($query);
         $pre_order_stock = $db->loadObjectList();
         if ($pre_order_stock[0]->ordered_preorder == $pre_order_stock[0]->preorder_stock || $pre_order_stock[0]->ordered_preorder > $pre_order_stock[0]->preorder_stock) {
             $quantity = 0;
         } else {
             $quantity = $pre_order_stock[0]->preorder_stock - $pre_order_stock[0]->ordered_preorder;
         }
     } else {
         $helper = new redhelper();
         if ($helper->isredCRM()) {
             if (ENABLE_ITEM_TRACKING_SYSTEM && !ENABLE_ONE_STOCKROOM_MANAGEMENT) {
                 // Include redSHOP product helper
                 $producthelper = new producthelper();
                 // Supplier order helper object
                 $crmSupplierOrderHelper = new crmSupplierOrderHelper();
                 $getstockdata = new stdClass();
                 $getstockdata->property_id = 0;
                 $getstockdata->subproperty_id = 0;
                 if ($section == "product") {
                     $getstockdata->product_id = $section_id;
                 } elseif ($section == "property") {
                     $property = $producthelper->getAttibuteProperty($section_id);
                     $attribute_id = $property[0]->attribute_id;
                     $attribute = $producthelper->getProductAttribute(0, 0, $attribute_id);
                     $product_id = $attribute[0]->product_id;
                     $getstockdata->product_id = $product_id;
                     $getstockdata->property_id = $section_id;
                 } elseif ($section == "subproperty") {
                     $subproperty = $producthelper->getAttibuteSubProperty($section_id);
                     $property_id = $subproperty[0]->subattribute_id;
                     $property = $producthelper->getAttibuteProperty($property_id);
                     $attribute_id = $property[0]->attribute_id;
                     $attribute = $producthelper->getProductAttribute(0, 0, $attribute_id);
                     $product_id = $attribute[0]->product_id;
                     $getstockdata->product_id = $product_id;
                     $getstockdata->property_id = $property_id;
                     $getstockdata->subproperty_id = $section_id;
                 }
                 $quantity = $crmSupplierOrderHelper->getSupplierStock($getstockdata);
             }
         }
     }
     return $quantity;
 }