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


PHP ps_product::attribute_sql方法代码示例

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


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

示例1: updateRecords


//.........这里部分代码省略.........
                $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) {
                $q = "SELECT COUNT(product_id) ";
                $q .= "FROM #__{vm}_product ";
                $q .= "WHERE product_parent_id = " . $dboi->f("product_parent_id");
                $q .= " AND product_in_stock > 0";
                $db->query($q);
                $db->next_record();
                if (!$db->f("COUNT(product_id)")) {
                    $q = "UPDATE #__{vm}_product ";
                    $q .= "SET product_in_stock = 0 ";
                    $q .= "WHERE product_id = " . $dboi->f("product_parent_id") . " LIMIT 1";
                    $db->query($q);
开发者ID:atomtechnologyltd,项目名称:VM9_paynetz_for_Joomla1.5_updated,代码行数:67,代码来源:ps_nbpaynetz.php

示例2: basename

 }
 // Get product parent id if exists
 $product_parent_id = $ps_product->get_field($cart[$i]["product_id"], "product_parent_id");
 // Get flypage for this product
 $flypage = $ps_product->get_flypage($cart[$i]["product_id"]);
 // Build URL based on whether item or product
 if ($product_parent_id) {
     $url = $sess->url(URL . basename($_SERVER['PHP_SELF']) . "?page=shop.product_details&flypage={$flypage}&product_id={$product_parent_id}");
 } else {
     $url = $sess->url(URL . basename($_SERVER['PHP_SELF']) . "?page=shop.product_details&flypage={$flypage}&product_id=" . $_SESSION['cart'][$i]["product_id"]);
 }
 $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"];
开发者ID:BackupTheBerlios,项目名称:kmit-svn,代码行数:31,代码来源:ro_basket.php


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