本文整理汇总了PHP中ps_product::get_price方法的典型用法代码示例。如果您正苦于以下问题:PHP ps_product::get_price方法的具体用法?PHP ps_product::get_price怎么用?PHP ps_product::get_price使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ps_product
的用法示例。
在下文中一共展示了ps_product::get_price方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: while
function list_attribute($product_id, $fils = true)
{
global $VM_LANG, $CURRENCY_DISPLAY;
$ps_product = new ps_product();
$db = new ps_DB();
$db_sku = new ps_DB();
$db_item = new ps_DB();
// Get list of children
if ($fils) {
$q = "SELECT product_id,product_name FROM #__{vm}_product WHERE product_parent_id='{$product_id}' AND product_publish='Y'";
} else {
$q = "SELECT product_parent_id FROM #__{vm}_product WHERE product_id='{$product_id}'";
$db->setQuery($q);
$db->query();
$db->next_record();
$product_parent_id = $db->f("product_parent_id");
$q = "SELECT product_id,product_name FROM #__{vm}_product WHERE product_parent_id='{$product_parent_id}' AND product_publish='Y'";
}
$db->setQuery($q);
$db->query();
if ($db->num_rows() > 0) {
$display = '<select name="product_id" onChange="this.form.add_product_validate.value=0;this.form.submit();">';
$display .= '<option value="-1">Choisissez un produit item</option>';
while ($db->next_record()) {
$display .= '<option value="' . $db->f("product_id") . '"';
if ($product_id == $db->f("product_id")) {
$display .= ' selected="yes"';
}
$display .= '>' . $db->f("product_name");
// For each child get attribute values by looping through attribute list
$q = "SELECT product_id, attribute_name FROM #__{vm}_product_attribute_sku ";
$q .= "WHERE product_id='{$product_id}' ORDER BY attribute_list ASC";
$db_sku->setQuery($q);
$db_sku->query();
while ($db_sku->next_record()) {
$q = "SELECT attribute_name, attribute_value, product_id ";
$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()) {
$display .= ' - ' . $db_item->f("attribute_name") . " ";
$display .= "(" . $db_item->f("attribute_value") . ")";
if (!$db_sku->is_last_record()) {
$display .= '; ';
}
}
}
// Attributes for this item are done.
// Now get item price
$price = $ps_product->get_price($db->f("product_id"));
if ($_SESSION["auth"]["show_price_including_tax"] == 1) {
$tax_rate = 1 + $ps_product->get_product_taxrate($db->f("product_id"));
$price['product_price'] *= $tax_rate;
}
$display .= ' - ' . $CURRENCY_DISPLAY->getFullValue($price["product_price"]);
$display .= '</option>';
}
$display .= '</select>';
} else {
$display = "<input type=\"hidden\" name=\"product_id\" value=\"{$product_id}\" />\n";
}
return $display;
}
示例2: explode
/**
* Creates drop-down boxes from advanced attribute format.
* @author Sean Tobin (byrdhuntr@hotmail.com)
* @param int $product_id
* @return string HTML code containing Drop Down Lists with Labels
*/
function list_advanced_attribute($product_id, $prod_id = null)
{
global $CURRENCY_DISPLAY;
$ps_product = new ps_product();
$db = new ps_DB();
$auth = $_SESSION['auth'];
$tpl = new $GLOBALS['VM_THEMECLASS']();
if ($product_id == 0) {
$product_id = $prod_id;
}
$q = "SELECT product_id, attribute FROM #__{vm}_product WHERE product_id='{$product_id}'";
$db->query($q);
$db->next_record();
$productPrice = $ps_product->get_price($product_id);
$advanced_attribute_list = $db->f("attribute");
if ($advanced_attribute_list) {
$has_advanced_attributes = 1;
$fields = explode(";", $advanced_attribute_list);
$attributes = array();
$i = 0;
foreach ($fields as $field) {
$base = explode(",", $field);
$title = array_shift($base);
$titlevar = str_replace(" ", "_", $title);
$prod_index = $product_id;
if ($prod_id) {
$prod_index = $prod_id;
}
$attributes[$i]['product_id'] = $prod_index;
$attributes[$i]['title'] = $title;
$attributes[$i]['titlevar'] = $titlevar;
$options_list = array();
foreach ($base as $base_value) {
$options_item = array();
// the Option Text
$attribtxt = substr($base_value, 0, strrpos($base_value, '['));
if ($attribtxt != "") {
$vorzeichen = substr($base_value, strrpos($base_value, '[') + 1, 1);
// negative, equal or positive?
if ($_SESSION["auth"]["show_price_including_tax"] == 1) {
$price = floatval(substr($base_value, strrpos($base_value, '[') + 2)) * (1 + @$_SESSION['product_sess'][$product_id]['tax_rate']);
// calculate Tax
} else {
$price = floatval(substr($base_value, strrpos($base_value, '[') + 2));
}
// Apply shopper group discount
$price *= 1 - $auth["shopper_group_discount"] / 100;
$price = $GLOBALS['CURRENCY']->convert($price, $productPrice['product_currency']);
if ($price == "0") {
$attribut_hint = "test";
}
$base_var = str_replace(" ", "_", $base_value);
$base_var = substr($base_var, 0, strrpos($base_var, '['));
$options_item['base_var'] = $base_var;
$options_item['base_value'] = $attribtxt;
if ($_SESSION['auth']['show_prices'] && _SHOW_PRICES) {
$options_item['sign'] = $vorzeichen;
$options_item['display_price'] = $CURRENCY_DISPLAY->getFullValue($price);
}
} else {
$base_var = str_replace(" ", "_", $base_value);
$options_item['base_var'] = $base_var;
$options_item['base_value'] = $base_value;
}
$options_list[] = $options_item;
}
$attributes[$i]['options_list'] = $options_list;
$i++;
}
}
if ($advanced_attribute_list) {
$tpl->set('attributes', $attributes);
return $tpl->fetch('product_details/includes/addtocart_advanced_attribute.tpl.php');
}
}
示例3:
function get_insurance_value($pid)
{
/* Read current Configuration */
require_once CLASSPATH . "shipping/" . __CLASS__ . ".cfg.php";
$db = new ps_DB();
/* XXX map shopper group 'DUTY' to sgid (shopper group id) */
$q = "SELECT shopper_group_id FROM #__{vm}_shopper_group ";
$q .= "WHERE shopper_group_name='" . DHL_INSURANCE_SHOPPER_GROUP . "'";
$db->query($q);
if (!$db->next_record()) {
/* no group was specific for insurnace value, use normal price */
$ps_product = new ps_product();
$p_array = $ps_product->get_price($pid);
$duty_value = $p_array['product_price'];
} else {
$sgid = $db->f("shopper_group_id");
$q = "SELECT product_price FROM #__{vm}_product_price ";
$q .= "WHERE product_id='" . $pid . "' ";
$q .= "AND shopper_group_id='" . $sgid . "'";
$db->query($q);
if ($db->next_record()) {
$duty_value = $db->f("product_price");
} else {
/* use the default product price */
$ps_product = new ps_product();
$p_array = $ps_product->get_price($pid);
$duty_value = $p_array['product_price'];
}
}
return $duty_value;
}