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


PHP ps_product::get_adjusted_attribute_price方法代码示例

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


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

示例1: updateRecords


//.........这里部分代码省略.........
        /**
         * Insert the User Billto & Shipto Info
         */
        // First: get all the fields from the user field list to copy them from user_info into the order_user_info
        $fields = array();
        require_once CLASSPATH . 'ps_userfield.php';
        $userfields = ps_userfield::getUserFields('', false, '', true, true);
        foreach ($userfields as $field) {
            if ($field->name == 'email') {
                $fields[] = 'user_email';
            } else {
                $fields[] = $field->name;
            }
        }
        $fieldstr = implode(',', $fields);
        // Save current Bill To Address
        $q = "INSERT INTO `#__{vm}_order_user_info` \n\t\t\t(`order_info_id`,`order_id`,`user_id`,address_type, " . $fieldstr . ") ";
        $q .= "SELECT NULL, '{$order_id}', '" . $auth['user_id'] . "', address_type, " . $fieldstr . " FROM #__{vm}_user_info WHERE user_id='" . $auth['user_id'] . "' AND address_type='BT'";
        $db->query($q);
        // Save current Ship to Address if applicable
        $q = "INSERT INTO `#__{vm}_order_user_info` \n\t\t\t(`order_info_id`,`order_id`,`user_id`,address_type, " . $fieldstr . ") ";
        $q .= "SELECT NULL, '{$order_id}', '" . $auth['user_id'] . "', address_type, " . $fieldstr . " FROM #__{vm}_user_info WHERE user_id='" . $auth['user_id'] . "' AND user_info_id='" . $d['ship_to_info_id'] . "' AND address_type='ST'";
        $db->query($q);
        /**
         * Insert all Products from the Cart into order line items; 
         * one row per product in the cart 
         */
        $dboi = new ps_DB();
        for ($i = 0; $i < $cart["idx"]; $i++) {
            $r = "SELECT product_id,product_in_stock,product_sales,product_parent_id,product_sku,product_name ";
            $r .= "FROM #__{vm}_product WHERE product_id='" . $cart[$i]["product_id"] . "'";
            $dboi->query($r);
            $dboi->next_record();
            $product_price_arr = $ps_product->get_adjusted_attribute_price($cart[$i]["product_id"], $cart[$i]["description"]);
            $product_price = $GLOBALS['CURRENCY']->convert($product_price_arr["product_price"], $product_price_arr["product_currency"]);
            if (empty($_SESSION['product_sess'][$cart[$i]["product_id"]]['tax_rate'])) {
                $my_taxrate = $ps_product->get_product_taxrate($cart[$i]["product_id"]);
            } else {
                $my_taxrate = $_SESSION['product_sess'][$cart[$i]["product_id"]]['tax_rate'];
            }
            // Attribute handling
            $product_parent_id = $dboi->f('product_parent_id');
            $description = '';
            if ($product_parent_id > 0) {
                $db_atts = $ps_product->attribute_sql($dboi->f('product_id'), $product_parent_id);
                while ($db_atts->next_record()) {
                    $description .= $db_atts->f('attribute_name') . ': ' . $db_atts->f('attribute_value') . '; ';
                }
            }
            $description .= $ps_product->getDescriptionWithTax($_SESSION['cart'][$i]["description"], $dboi->f('product_id'));
            $product_final_price = round($product_price * ($my_taxrate + 1), 2);
            $vendor_id = $ps_vendor_id;
            $fields = array('order_id' => $order_id, 'user_info_id' => $d["ship_to_info_id"], 'vendor_id' => $vendor_id, 'product_id' => $cart[$i]["product_id"], 'order_item_sku' => $dboi->f("product_sku"), 'order_item_name' => $dboi->f("product_name"), 'product_quantity' => $cart[$i]["quantity"], 'product_item_price' => $product_price, 'product_final_price' => $product_final_price, 'order_item_currency' => $GLOBALS['product_currency'], 'order_status' => 'P', 'product_attribute' => $description, 'cdate' => $timestamp, 'mdate' => $timestamp);
            $db->buildQuery('INSERT', '#__{vm}_order_item', $fields);
            $db->query();
            // Update Stock Level and Product Sales, decrease - no matter if in stock or not!
            $q = "UPDATE #__{vm}_product ";
            $q .= "SET product_in_stock = product_in_stock - " . (int) $cart[$i]["quantity"];
            $q .= " WHERE product_id = '" . $cart[$i]["product_id"] . "'";
            $db->query($q);
            $q = "UPDATE #__{vm}_product ";
            $q .= "SET product_sales= product_sales + " . (int) $cart[$i]["quantity"];
            $q .= " WHERE product_id='" . $cart[$i]["product_id"] . "'";
            $db->query($q);
            // Update stock of parent product, if all child products are sold, thanks Ragnar Brynjulfsson
            if ($dboi->f("product_parent_id") != 0) {
开发者ID:atomtechnologyltd,项目名称:VM9_paynetz_for_Joomla1.5_updated,代码行数:67,代码来源:ps_nbpaynetz.php

示例2: vmGet

 /**
  * Calculate the tax charges for the current order.
  * You can switch the way, taxes are calculated:
  * either based on the VENDOR address,
  * or based on the ship-to address.
  * ! Creates the global $order_tax_details
  *
  * @param float $order_taxable
  * @param array $d
  * @return float
  */
 function calc_order_tax($order_taxable, $d)
 {
     global $order_tax_details, $discount_factor;
     $total = 0;
     $order_tax = 0;
     $auth = $_SESSION['auth'];
     $ps_vendor_id = $_SESSION["ps_vendor_id"];
     $db = new ps_DB();
     $ship_to_info_id = vmGet($_REQUEST, 'ship_to_info_id');
     require_once CLASSPATH . 'ps_tax.php';
     $ps_tax = new ps_tax();
     $discount_factor = 1;
     // Shipping address based TAX
     if (!ps_checkout::tax_based_on_vendor_address()) {
         $q = "SELECT state, country FROM #__{vm}_user_info ";
         $q .= "WHERE user_info_id='" . $ship_to_info_id . "'";
         $db->query($q);
         $db->next_record();
         $state = $db->f("state");
         $country = $db->f("country");
         $q = "SELECT * FROM #__{vm}_tax_rate WHERE tax_country='{$country}' ";
         if (!empty($state)) {
             $q .= "AND (tax_state='{$state}' OR tax_state=' {$state} ')";
         }
         $db->query($q);
         if ($db->next_record()) {
             $rate = $order_taxable * floatval($db->f("tax_rate"));
             if (empty($rate)) {
                 $order_tax = 0.0;
             } else {
                 $cart = $_SESSION['cart'];
                 $order_tax = 0.0;
                 if ((!empty($_SESSION['coupon_discount']) || !empty($d['payment_discount'])) && PAYMENT_DISCOUNT_BEFORE == '1') {
                     require_once CLASSPATH . 'ps_product.php';
                     $ps_product = new ps_product();
                     for ($i = 0; $i < $cart["idx"]; $i++) {
                         $item_weight = ps_shipping_method::get_weight($cart[$i]["product_id"]) * $cart[$i]['quantity'];
                         if ($item_weight != 0 or TAX_VIRTUAL) {
                             $price = $ps_product->get_adjusted_attribute_price($cart[$i]["product_id"], $cart[$i]["description"]);
                             $price['product_price'] = $GLOBALS['CURRENCY']->convert($price['product_price'], $price['product_currency']);
                             $tax_rate = $db->f("tax_rate");
                             $use_coupon_discount = @$_SESSION['coupon_discount'];
                             //if( !empty( $_SESSION['coupon_discount'] )) {
                             //    if( $auth["show_price_including_tax"] == 1 ) {
                             //        $use_coupon_discount = $_SESSION['coupon_discount'] / ($tax_rate+1);
                             //    }
                             //}
                             $factor = 100 * ($use_coupon_discount + @$d['payment_discount']) / $this->_subtotal;
                             $price["product_price"] = $price["product_price"] - $factor * $price["product_price"] / 100;
                             @($order_tax_details[$tax_rate] += $price["product_price"] * $tax_rate * $cart[$i]["quantity"]);
                             $order_tax += $price["product_price"] * $tax_rate * $cart[$i]["quantity"];
                             $total += $price["product_price"] * $cart[$i]["quantity"];
                         } else {
                             $order_tax += 0.0;
                         }
                     }
                 } else {
                     $order_tax = $rate;
                 }
             }
         } else {
             $order_tax = 0.0;
         }
         $order_tax_details[$db->f('tax_rate')] = $order_tax;
     } else {
         // Calculate the Tax with a tax rate for every product
         $cart = $_SESSION['cart'];
         $order_tax = 0.0;
         $total = 0.0;
         if ((!empty($_SESSION['coupon_discount']) || !empty($d['payment_discount'])) && PAYMENT_DISCOUNT_BEFORE == '1') {
             // We need to recalculate the tax details when the discounts are applied
             // BEFORE taxes - because they affect the product subtotals then
             $order_tax_details = array();
         }
         require_once CLASSPATH . 'ps_product.php';
         $ps_product = new ps_product();
         require_once CLASSPATH . 'ps_shipping_method.php';
         for ($i = 0; $i < $cart["idx"]; $i++) {
             $item_weight = ps_shipping_method::get_weight($cart[$i]["product_id"]) * $cart[$i]['quantity'];
             if ($item_weight != 0 or TAX_VIRTUAL) {
                 $price = $ps_product->get_adjusted_attribute_price($cart[$i]["product_id"], $cart[$i]["description"]);
                 $price['product_price'] = $GLOBALS['CURRENCY']->convert($price['product_price'], $price['product_currency']);
                 $tax_rate = $ps_product->get_product_taxrate($cart[$i]["product_id"]);
                 if ((!empty($_SESSION['coupon_discount']) || !empty($d['payment_discount'])) && PAYMENT_DISCOUNT_BEFORE == '1') {
                     $use_coupon_discount = @$_SESSION['coupon_discount'];
                     if (!empty($_SESSION['coupon_discount'])) {
                         if ($auth["show_price_including_tax"] == 1) {
                             $use_coupon_discount = $_SESSION['coupon_discount'] / ($tax_rate + 1);
                         }
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:owaspbwa,代码行数:101,代码来源:ps_checkout.php

示例3: shopMakeHtmlSafe

 }
 $product_rows[$i]['product_name'] = "<a href=\"{$url}\"><strong>" . shopMakeHtmlSafe($ps_product->get_field($_SESSION['cart'][$i]["product_id"], "product_name")) . "</strong></a><br />" . $ps_product->getDescriptionWithTax($_SESSION['cart'][$i]["description"], $_SESSION['cart'][$i]["product_id"]);
 // Display attribute values if this an item
 $product_rows[$i]['product_attributes'] = "";
 if ($product_parent_id) {
     $db_detail = $ps_product->attribute_sql($cart[$i]["product_id"], $product_parent_id);
     while ($db_detail->next_record()) {
         $product_rows[$i]['product_attributes'] .= "<br />" . $db_detail->f("attribute_name") . "&nbsp;";
         $product_rows[$i]['product_attributes'] .= "(" . $db_detail->f("attribute_value") . ")";
     }
 }
 $product_rows[$i]['product_sku'] = $ps_product->get_field($cart[$i]["product_id"], "product_sku");
 /* Product PRICE */
 $my_taxrate = $ps_product->get_product_taxrate($cart[$i]["product_id"], $weight_subtotal);
 $tax = $my_taxrate * 100;
 $price = $ps_product->get_adjusted_attribute_price($cart[$i]["product_id"], $cart[$i]["description"]);
 $price['product_price'] = $GLOBALS['CURRENCY']->convert($price['product_price'], $price['product_currency']);
 if ($auth["show_price_including_tax"] == 1) {
     $product_price = $price["product_price"] * ($my_taxrate + 1);
 } else {
     $product_price = $price["product_price"];
 }
 $product_price = round($product_price, 5);
 $product_rows[$i]['product_price'] = $GLOBALS['CURRENCY_DISPLAY']->getFullValue(round($product_price, 2));
 /* Quantity Box */
 $product_rows[$i]['quantity'] = $cart[$i]["quantity"];
 /* WEIGHT CALCULATION */
 $weight_subtotal = ps_shipping_method::get_weight($cart[$i]["product_id"]) * $cart[$i]['quantity'];
 $weight_total += $weight_subtotal;
 /* SUBTOTAL CALCULATION */
 $subtotal = $product_price * $cart[$i]["quantity"];
开发者ID:BackupTheBerlios,项目名称:kmit-svn,代码行数:31,代码来源:ro_basket.php

示例4: urlencode

 $url_parameters = "page=shop.product_details&amp;flypage={$flypage}&amp;product_id=" . $db_browse->f("product_id") . "&amp;category_id=" . $db_browse->f("category_id");
 if ($manufacturer_id) {
     $url_parameters .= "&amp;manufacturer_id=" . $manufacturer_id;
 }
 if ($keyword != '') {
     $url_parameters .= "&amp;keyword=" . urlencode($keyword);
 }
 $url = $sess->url($url_parameters);
 // Price: xx.xx EUR
 if (_SHOW_PRICES == '1' && $auth['show_prices']) {
     $product_price = $ps_product->show_price($db_browse->f("product_id"));
 } else {
     $product_price = "";
 }
 // @var array $product_price_raw The raw unformatted Product Price in Float Format
 $product_price_raw = $ps_product->get_adjusted_attribute_price($db_browse->f('product_id'));
 // i is the index for the array holding all products, we need to show. to allow sorting by discounted price,
 // we need to use the price as first part of the index name!
 $i = $product_price_raw['product_price'] . '_' . ++$counter;
 if ($db_browse->f("product_thumb_image")) {
     $product_thumb_image = $db_browse->f("product_thumb_image");
 } else {
     if ($product_parent_id != 0) {
         $product_thumb_image = $dbp->f("product_thumb_image");
         // Use product_thumb_image from Parent Product
     } else {
         $product_thumb_image = 0;
     }
 }
 if ($product_thumb_image) {
     if (substr($product_thumb_image, 0, 4) != "http") {
开发者ID:albertobraschi,项目名称:Hab,代码行数:31,代码来源:shop.browse.php

示例5: vmGet

 /**
  * Lists all child/sister products of the given product
  *
  * @param int $product_id
  * @return string HTML code with Items, attributes & price
  */
 function list_attribute_list($product_id, $display_use_parent, $child_link, $display_type, $cls_sfuffix, $child_ids, $dw, $aw, $display_header, $product_list_type, $product_list)
 {
     global $CURRENCY_DISPLAY, $mm_action_url;
     require_once CLASSPATH . 'ps_product.php';
     $ps_product = new ps_product();
     require_once CLASSPATH . 'ps_product_type.php';
     $ps_product_type = new ps_product_type();
     $Itemid = vmGet($_REQUEST, 'Itemid', "");
     $category_id = vmGet($_REQUEST, 'category_id', "");
     $curr_product = vmGet($_REQUEST, 'product_id', "");
     $db = new ps_DB();
     $db_sku = new ps_DB();
     $db_item = new ps_DB();
     $tpl = vmTemplate::getInstance();
     $price = $ps_product->get_adjusted_attribute_price($product_id);
     $tpl->set("cls_suffix", $cls_sfuffix);
     $tpl->set("product_id", $product_id);
     $tpl->set("display_header", $display_header);
     $tpl->set("display_product_type", $product_list_type);
     $tpl->set("product_price", $price['product_price']);
     $html = '';
     // Get list of children
     $pp = $ps_product->parent_has_children($product_id);
     if ($pp) {
         $q = "SELECT product_id,product_name,product_parent_id,product_sku,product_in_stock,product_full_image,product_thumb_image FROM #__{vm}_product WHERE product_publish='Y' AND product_parent_id='{$product_id}'  ";
     } else {
         $q = "SELECT product_id,product_name,product_parent_id,product_sku,product_in_stock,product_full_image,product_thumb_image FROM #__{vm}_product WHERE product_publish='Y' AND product_id='{$product_id}'  ";
     }
     if ($child_ids) {
         $ids = explode(",", $child_ids);
         $child_array = array();
         $parent_array = array();
         foreach ($ids as $extra_id) {
             if ($ps_product->parent_has_children($extra_id)) {
                 $parent_array[] = $extra_id;
             } else {
                 $child_array[] = $extra_id;
             }
         }
         $parent_ids = implode(',', $parent_array);
         $child_ids = implode(',', $child_array);
         if ($child_ids) {
             $q .= "UNION ALL SELECT product_id,product_name,product_parent_id,product_sku,product_in_stock,product_full_image,product_thumb_image FROM #__{vm}_product WHERE product_publish='Y' AND  product_id IN ({$child_ids}) ";
         }
         if ($parent_ids) {
             $q .= "UNION ALL SELECT product_id,product_name,product_parent_id,product_sku,product_in_stock,product_full_image,product_thumb_image FROM #__{vm}_product WHERE product_publish='Y' AND  product_parent_id IN ({$parent_ids})";
         }
     }
     $db->query($q);
     if ($pp) {
         $master_id = $product_id;
     } else {
         $master_id = $db->f("product_id");
     }
     $main_master = $master_id;
     $master_child_count = 0;
     if ($db->num_rows() < 1) {
         // Try to Get list of sisters & brothers
         $q = "SELECT product_parent_id FROM #__{vm}_product WHERE product_id='{$product_id}'";
         $db->setQuery($q);
         $db->query();
         $child_id = $product_id;
         $product_id = $db->f("product_parent_id") ? $db->f("product_parent_id") : $product_id;
         $parent_id = $db->f("product_parent_id");
         $q = "SELECT product_id,product_name,product_parent_id,product_sku,product_in_stock FROM #__{vm}_product WHERE product_parent_id='" . $db->f("product_parent_id") . "' AND product_parent_id<>0 AND product_publish='Y'";
         $db->query($q);
     }
     if ($db->num_rows() > 0) {
         $products = array();
         $headings = array();
         $i = 0;
         $attrib_heading = array();
         $ci = 0;
         while ($db->next_record()) {
             $parent_id = $db->f("product_parent_id");
             if ($db->f("product_id") != $curr_product && @$child_id) {
                 continue;
             }
             // Start row for this child
             $q = "SELECT product_id, attribute_name FROM #__{vm}_product_attribute_sku ";
             $q .= "WHERE product_id='" . $db->f("product_parent_id") . "' ORDER BY attribute_list ASC";
             $db_sku->query($q);
             $attrib_value = array();
             while ($db_sku->next_record()) {
                 $q = "SELECT attribute_name,attribute_value ";
                 $q .= "FROM #__{vm}_product_attribute WHERE ";
                 $q .= "product_id='" . $db->f("product_id") . "' AND ";
                 $q .= "attribute_name='" . $db_sku->f("attribute_name") . "'";
                 $db_item->setQuery($q);
                 $db_item->query();
                 while ($db_item->next_record()) {
                     if ($ci == 0) {
                         $attrib_heading[] = $db_item->f("attribute_name");
                         $tpl->set('headings', $attrib_heading);
//.........这里部分代码省略.........
开发者ID:albertobraschi,项目名称:Hab,代码行数:101,代码来源:ps_product_attribute.php

示例6: getCartnvpstr

 function getCartnvpstr(&$order_totals = array())
 {
     global $auth, $VM_LANG;
     $cart = $_SESSION['cart'];
     require_once CLASSPATH . 'ps_product.php';
     $ps_product = new ps_product();
     $ret_str = "";
     $item_total = 0;
     for ($i = 0; $i < $cart["idx"]; $i++) {
         // Product PRICE
         $price = $ps_product->get_adjusted_attribute_price($cart[$i]["product_id"], $cart[$i]["description"]);
         // Convert to product currency if necessary
         $product_price = $GLOBALS['CURRENCY']->convert($price["product_price"], $price["product_currency"]);
         // SUBTOTAL CALCULATION
         $ret_str .= "&L_AMT" . $i . "=" . round($product_price, 2);
         $ret_str .= "&L_QTY" . $i . "=" . $cart[$i]["quantity"];
         $ret_str .= "&L_NAME" . $i . "=" . urlencode($ps_product->get_field($_SESSION['cart'][$i]["product_id"], "product_name"));
         $item_total += round($product_price, 2) * $cart[$i]["quantity"];
     }
     if (!empty($order_totals['coupon_discount'])) {
         // Discount is the difference left after order total has been reduced by subtotal, tax, shipping and shipping tax
         $discount = round($order_totals['order_total'], 2) - $item_total - round($order_totals['order_tax'], 2) - $order_totals['order_shipping'] - $order_totals['order_shipping_tax'];
         // add discount as line item
         $ret_str .= "&L_AMT" . $i . "=" . round($discount, 2);
         $ret_str .= "&L_QTY" . $i . "=1";
         $ret_str .= "&L_NAME" . $i . "=" . urlencode($VM_LANG->_('PHPSHOP_COUPON_DISCOUNT'));
         $item_total += $discount;
     }
     $order_totals['item_total'] = round($item_total, 2);
     $ret_str .= "&ITEMAMT=" . round($item_total, 2);
     //die( $ret_str );
     return $ret_str;
 }
开发者ID:noikiy,项目名称:owaspbwa,代码行数:33,代码来源:ps_paypal_api.php


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