当前位置: 首页>>代码示例>>PHP>>正文


PHP producthelper::getUnitConversation方法代码示例

本文整理汇总了PHP中producthelper::getUnitConversation方法的典型用法代码示例。如果您正苦于以下问题:PHP producthelper::getUnitConversation方法的具体用法?PHP producthelper::getUnitConversation怎么用?PHP producthelper::getUnitConversation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在producthelper的用法示例。


在下文中一共展示了producthelper::getUnitConversation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: check

 /**
  * Check for the product ID
  */
 public function check()
 {
     $producthelper = new producthelper();
     $unit = $producthelper->getUnitConversation("m", $discount_calc_unit[$c]);
     $converted_area_start = $this->area_start * $unit * $unit;
     $converted_area_end = $this->area_end * $unit * $unit;
     $query = "SELECT *\n\t\t\t\t\tFROM `" . $this->_table_prefix . "product_discount_calc`\n\t\t\t\t\tWHERE product_id = " . (int) $this->product_id . " AND (" . (int) $converted_area_start . "\n\t\t\t\t\tBETWEEN `area_start_converted`\n\t\t\t\t\tAND `area_end_converted` || " . (int) $converted_area_end . "\n\t\t\t\t\tBETWEEN `area_start_converted`\n\t\t\t\t\tAND `area_end_converted` )";
     $this->_db->setQuery($query);
     $xid = intval($this->_db->loadResult());
     if ($xid) {
         $this->_error = JText::_('COM_REDSHOP_SAME_RANGE');
         return false;
     }
     return true;
 }
开发者ID:jaanusnurmoja,项目名称:redjoomla,代码行数:18,代码来源:product_discount_calc.php

示例2: copyDiscountCalcdata

 /**
  * Function copyDiscountCalcdata.
  *
  * @param   int     $old_product_id        old_product_id
  * @param   int     $new_product_id        new_product_id
  * @param   string  $discount_calc_method  discount_calc_method
  *
  * @return bool
  */
 public function copyDiscountCalcdata($old_product_id, $new_product_id, $discount_calc_method)
 {
     $producthelper = new producthelper();
     $query = "SELECT * FROM `" . $this->table_prefix . "product_discount_calc`\r\n\t\t\t\t  WHERE product_id='" . $old_product_id . "' ";
     $this->_db->setQuery($query);
     $list = $this->_db->loadObjectList();
     for ($i = 0; $i < count($list); $i++) {
         $discount_calc_unit = $list[$i]->discount_calc_unit;
         $area_start = $list[$i]->area_start;
         $area_end = $list[$i]->area_end;
         $area_price = $list[$i]->area_price;
         $unit = $producthelper->getUnitConversation("m", $discount_calc_unit);
         // Replace comma with dot.
         $new_area_start = str_replace(",", ".", $area_start);
         $new_area_end = str_replace(",", ".", $area_end);
         if ($discount_calc_method == 'volume') {
             $calcunit = pow($unit, 3);
         } elseif ($discount_calc_method == 'area') {
             $calcunit = pow($unit, 2);
         } else {
             $calcunit = $unit;
         }
         // Updating value.
         $converted_area_start = $new_area_start * $calcunit;
         $converted_area_end = $new_area_end * $calcunit;
         // End
         $calcrow =& $this->getTable('product_discount_calc');
         $calcrow->load();
         $calcrow->discount_calc_unit = $discount_calc_unit;
         $calcrow->area_start = $new_area_start;
         $calcrow->area_end = $new_area_end;
         $calcrow->area_price = $area_price;
         $calcrow->area_start_converted = $converted_area_start;
         $calcrow->area_end_converted = $converted_area_end;
         $calcrow->product_id = $new_product_id;
         if ($calcrow->check()) {
             if (!$calcrow->store()) {
                 $this->setError($this->_db->getErrorMsg());
                 return false;
             }
         }
     }
     // Discount calc extra data
     $query_extra = "Select * FROM `" . $this->table_prefix . "product_discount_calc_extra` WHERE product_id='" . $old_product_id . "' ";
     $this->_db->setQuery($query_extra);
     $list_extra = $this->_db->loadObjectList();
     for ($i = 0; $i < count($list_extra); $i++) {
         $pdc_option_name = $list_extra[$i]->option_name;
         $pdc_price = $list_extra[$i]->price;
         $pdc_oprand = $list_extra[$i]->oprand;
         if (trim($pdc_option_name) != "") {
             $pdcextrarow =& $this->getTable('product_discount_calc_extra');
             $pdcextrarow->load();
             $pdcextrarow->pdcextra_id = 0;
             $pdcextrarow->option_name = $pdc_option_name;
             $pdcextrarow->oprand = $pdc_oprand;
             $pdcextrarow->price = $pdc_price;
             $pdcextrarow->product_id = $new_product_id;
             if (!$pdcextrarow->store()) {
                 return false;
             }
         }
     }
     return true;
 }
开发者ID:jaanusnurmoja,项目名称:redjoomla,代码行数:74,代码来源:product_detail.php

示例3: generateParcel

    public function generateParcel($order_id, $specifiedSendDate)
    {
        $order_details = $this->getOrderDetails($order_id);
        $producthelper = new producthelper();
        $orderproducts = $this->getOrderItemDetail($order_id);
        $billingInfo = $this->getOrderBillingUserInfo($order_id);
        $shippingInfo = $this->getOrderShippingUserInfo($order_id);
        $shippinghelper = new shipping();
        $shippingRateDecryptDetail = explode("|", $shippinghelper->decryptShipping(str_replace(" ", "+", $order_details->ship_method_id)));
        // Get Shipping Delivery Type
        $shippingDeliveryType = 1;
        if (isset($shippingRateDecryptDetail[8]) === true) {
            $shippingDeliveryType = (int) $shippingRateDecryptDetail[8];
        }
        $sql = "SELECT country_2_code FROM " . $this->_table_prefix . "country WHERE country_3_code = " . $this->_db->quote(SHOP_COUNTRY);
        $this->_db->setQuery($sql);
        $billingInfo->country_code = $this->_db->loadResult();
        $sql = "SELECT country_name FROM " . $this->_table_prefix . "country WHERE country_2_code = " . $this->_db->quote($billingInfo->country_code);
        $this->_db->setQuery($sql);
        $country_name = $this->_db->loadResult();
        $sql = "SELECT country_2_code FROM " . $this->_table_prefix . "country WHERE country_3_code = " . $this->_db->quote($shippingInfo->country_code);
        $this->_db->setQuery($sql);
        $shippingInfo->country_code = $this->_db->loadResult();
        // For product conetent
        $totalWeight = 0;
        $content_products = array();
        $qty = 0;
        for ($c = 0; $c < count($orderproducts); $c++) {
            $product_id[] = $orderproducts[$c]->product_id;
            $qty += $orderproducts[$c]->product_quantity;
            $content_products[] = $orderproducts[$c]->order_item_name;
            // Product Weight
            $sql = "SELECT weight FROM " . $this->_table_prefix . "product WHERE product_id = " . (int) $orderproducts[$c]->product_id;
            $this->_db->setQuery($sql);
            $weight = $this->_db->loadResult();
            // Accessory Weight
            $orderAccItemdata = $this->getOrderItemAccessoryDetail($orderproducts[$c]->order_item_id);
            $acc_weight = 0;
            if (count($orderAccItemdata) > 0) {
                for ($a = 0; $a < count($orderAccItemdata); $a++) {
                    $accessory_quantity = $orderAccItemdata[$a]->product_quantity;
                    $acc_sql = "SELECT weight FROM " . $this->_table_prefix . "product WHERE product_id = " . (int) $orderAccItemdata[$a]->product_id;
                    $this->_db->setQuery($acc_sql);
                    $accessory_weight = $this->_db->loadResult();
                    $acc_weight += $accessory_weight * $accessory_quantity;
                }
            }
            // Total weight
            $totalWeight += $weight * $orderproducts[$c]->product_quantity + $acc_weight;
        }
        $unitRatio = $producthelper->getUnitConversation('kg', DEFAULT_WEIGHT_UNIT);
        if ($unitRatio != 0) {
            // Converting weight in pounds
            $totalWeight = $totalWeight * $unitRatio;
        }
        if (SHOW_PRODUCT_DETAIL) {
            $content_products = array_unique($content_products);
            $content_products = implode(",", $content_products);
            $content_products = mb_convert_encoding($content_products, "ISO-8859-1", "UTF-8");
            $content_products_remark = substr(mb_convert_encoding($content_products, "ISO-8859-1", "UTF-8"), 0, 29);
        } else {
            $content_products = " ";
            $content_products_remark = " ";
        }
        // Total quantity
        $total_qty = $qty;
        $firstname = mb_convert_encoding($shippingInfo->firstname, "ISO-8859-1", "UTF-8");
        $lastname = mb_convert_encoding($shippingInfo->lastname, "ISO-8859-1", "UTF-8");
        $full_name = $firstname . " " . $lastname;
        $address = mb_convert_encoding($shippingInfo->address, "ISO-8859-1", "UTF-8");
        $city = mb_convert_encoding($shippingInfo->city, "ISO-8859-1", "UTF-8");
        if ($billingInfo->is_company) {
            $company_name = mb_convert_encoding($shippingInfo->company_name, "ISO-8859-1", "UTF-8");
            $fproductCode = "PDKEP";
            $addon = "<addon adnid='POD'></addon>";
            $finaladdress1 = $company_name;
            $finaladdress2 = $address;
        } else {
            $fproductCode = "P19DK";
            $addon = "<addon adnid='DLV'></addon>";
            $finaladdress1 = $address;
            $finaladdress2 = "";
        }
        // When shipping delivery set to post office don't need to send DLV or POD addon.
        if ($shippingDeliveryType == 0) {
            $addon = "";
        }
        if (WEBPACK_ENABLE_EMAIL_TRACK) {
            $addon .= '<addon adnid="NOTEMAIL"></addon>';
        }
        if (WEBPACK_ENABLE_SMS) {
            $addon .= '<addon adnid="NOTSMS"></addon>';
        }
        $xmlnew = '<?xml version="1.0" encoding="ISO-8859-1"?>
				<pacsoftonline>
				<meta>
				<val n="printer">1</val>
				</meta>
				<receiver rcvid="' . $shippingInfo->users_info_id . '">
				<val n="name"><![CDATA[' . $full_name . ']]></val>
//.........这里部分代码省略.........
开发者ID:jaanusnurmoja,项目名称:redjoomla,代码行数:101,代码来源:order.php


注:本文中的producthelper::getUnitConversation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。