本文整理汇总了PHP中sprintQtyInStock函数的典型用法代码示例。如果您正苦于以下问题:PHP sprintQtyInStock函数的具体用法?PHP sprintQtyInStock怎么用?PHP sprintQtyInStock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sprintQtyInStock函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sprintQtyInStock
?>
"><?php
print $product->vendor->shop_name;
?>
</a></div>
<?php
}
?>
<?php
if ($this->config->product_list_show_qty_stock) {
?>
<div class="qty_in_stock"><?php
print _JSHOP_QTY_IN_STOCK;
?>
: <span><?php
print sprintQtyInStock($product->qty_in_stock);
?>
</span></div>
<?php
}
?>
<?php
print $product->_tmp_var_top_buttons;
?>
<div class="buttons">
<?php
if ($product->buy_link) {
?>
<a class="button_buy" href="<?php
print $product->buy_link;
?>
示例2: ajax_attrib_select_and_price
function ajax_attrib_select_and_price()
{
$db = JFactory::getDBO();
$jshopConfig = JSFactory::getConfig();
$display_price = JRequest::getVar('display_price');
$jshopConfig->setDisplayPriceFront($display_price);
$product_id = JRequest::getInt('product_id');
$change_attr = JRequest::getInt('change_attr');
if ($jshopConfig->use_decimal_qty) {
$qty = floatval(str_replace(",", ".", JRequest::getVar('qty', 1)));
} else {
$qty = JRequest::getInt('qty', 1);
}
if ($qty < 0) {
$qty = 1;
}
$attribs = JRequest::getVar('attr');
if (!is_array($attribs)) {
$attribs = array();
}
$freeattr = array();
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onBeforeLoadDisplayAjaxAttrib', array(&$product_id, &$change_attr, &$qty, &$attribs, &$freeattr));
$product = JSFactory::getTable('product', 'jshop');
$product->load($product_id);
$dispatcher->trigger('onBeforeLoadDisplayAjaxAttrib2', array(&$product));
$attributesDatas = $product->getAttributesDatas($attribs);
$product->setAttributeActive($attributesDatas['attributeActive']);
$attributeValues = $attributesDatas['attributeValues'];
$product->setFreeAttributeActive($freeattr);
$attributes = $product->getBuildSelectAttributes($attributeValues, $attributesDatas['attributeSelected'], 1);
$rows = array();
foreach ($attributes as $k => $v) {
$rows[] = '"id_' . $k . '":"' . json_value_encode($v->selects, 1) . '"';
}
$pricefloat = $product->getPrice($qty, 1, 1, 1);
$price = formatprice($pricefloat);
$available = intval($product->getQty() > 0);
$ean = $product->getEan();
$weight = $product->getWeight();
$rows[] = '"price":"' . json_value_encode($price) . '"';
$rows[] = '"pricefloat":"' . $pricefloat . '"';
$rows[] = '"available":"' . $available . '"';
$rows[] = '"ean":"' . json_value_encode($ean) . '"';
$rows[] = '"weight":"' . json_value_encode($weight) . '"';
$qty_in_stock = getDataProductQtyInStock($product);
$rows[] = '"qty":"' . json_value_encode(sprintQtyInStock($qty_in_stock)) . '"';
$product->updateOtherPricesIncludeAllFactors();
$dispatcher->trigger('onBeforeDisplayAjaxAttrib', array(&$rows, &$product));
print '{' . implode(",", $rows) . '}';
die;
}
示例3: sprintQtyInStock
?>
</div>
<?php
}
?>
<?php
if ($this->config->product_show_qty_stock) {
?>
<div class="qty_in_stock">
<?php
print _JSHOP_QTY_IN_STOCK;
?>
:
<span id="product_qty"><?php
print sprintQtyInStock($this->product->qty_in_stock);
?>
</span>
</div>
<?php
}
?>
<?php
print $this->_tmp_product_html_before_buttons;
?>
<?php
if (!$this->hide_buy) {
?>
示例4: getLoadProductData
public function getLoadProductData()
{
$jshopConfig = JSFactory::getConfig();
$dispatcher = JDispatcher::getInstance();
$product = $this->product;
$product->load($this->product_id);
$dispatcher->trigger('onBeforeLoadDisplayAjaxAttrib2', array(&$product));
$attributes = $product->getInitLoadAttribute($this->attribs);
$product->setFreeAttributeActive($this->freeattr);
$rows = array();
foreach ($attributes as $k => $v) {
$rows['id_' . $k] = $v->selects;
}
$pricefloat = $product->getPrice($this->qty, 1, 1, 1);
$price = formatprice($pricefloat);
$available = intval($product->getQty() > 0);
$displaybuttons = intval(intval($product->getQty() > 0) || $jshopConfig->hide_buy_not_avaible_stock == 0);
$ean = $product->getEan();
$weight = formatweight($product->getWeight());
$basicprice = formatprice($product->getBasicPrice());
$rows['price'] = $price;
$rows['pricefloat'] = $pricefloat;
$rows['available'] = $available;
$rows['ean'] = $ean;
if ($jshopConfig->admin_show_product_basic_price) {
$rows['basicprice'] = $basicprice;
}
if ($jshopConfig->product_show_weight) {
$rows['weight'] = $weight;
}
if ($jshopConfig->product_list_show_price_default && $product->product_price_default > 0) {
$rows['pricedefault'] = formatprice($product->product_price_default);
}
if ($jshopConfig->product_show_qty_stock) {
$qty_in_stock = getDataProductQtyInStock($product);
$rows['qty'] = sprintQtyInStock($qty_in_stock);
}
$product->updateOtherPricesIncludeAllFactors();
if (is_array($product->product_add_prices)) {
foreach ($product->product_add_prices as $k => $v) {
$rows['pq_' . $v->product_quantity_start] = formatprice($v->price);
}
}
if ($product->product_old_price) {
$old_price = formatprice($product->product_old_price);
$rows['oldprice'] = $old_price;
}
$rows['displaybuttons'] = $displaybuttons;
if ($jshopConfig->hide_delivery_time_out_of_stock) {
$rows['showdeliverytime'] = $product->getDeliveryTimeId();
}
if ($jshopConfig->use_extend_attribute_data) {
$template_path = $jshopConfig->template_path . $jshopConfig->template . "/product";
$images = $product->getImages();
$videos = $product->getVideos();
$demofiles = $product->getDemoFiles();
if (!file_exists($template_path . "/block_image_thumb.php")) {
$tmp = array();
foreach ($images as $img) {
$tmp[] = $img->image_name;
}
$displayimgthumb = intval(count($images) > 1 || count($videos) && count($images));
$rows['images'] = $tmp;
$rows['displayimgthumb'] = $displayimgthumb;
}
$view = $this->getView("product");
$view->setLayout("demofiles");
$view->assign('config', $jshopConfig);
$view->assign('demofiles', $demofiles);
$demofiles = $view->loadTemplate();
$rows['demofiles'] = $demofiles;
if (file_exists($template_path . "/block_image_thumb.php")) {
$product->getDescription();
$view = $this->getView("product");
$view->setLayout("block_image_thumb");
$view->assign('config', $jshopConfig);
$view->assign('images', $images);
$view->assign('videos', $videos);
$view->assign('image_product_path', $jshopConfig->image_product_live_path);
$dispatcher->trigger('onBeforeDisplayProductViewBlockImageThumb', array(&$view));
$block_image_thumb = $view->loadTemplate();
$view = $this->getView("product");
$view->setLayout("block_image_middle");
$view->assign('config', $jshopConfig);
$view->assign('images', $images);
$view->assign('videos', $videos);
$view->assign('product', $product);
$view->assign('noimage', $jshopConfig->noimage);
$view->assign('image_product_path', $jshopConfig->image_product_live_path);
$view->assign('path_to_image', $jshopConfig->live_path . 'images/');
$dispatcher->trigger('onBeforeDisplayProductViewBlockImageMiddle', array(&$view));
$block_image_middle = $view->loadTemplate();
$rows['block_image_thumb'] = $block_image_thumb;
$rows['block_image_middle'] = $block_image_middle;
}
}
$dispatcher->trigger('onBeforeDisplayAjaxAttribRows', array(&$rows, &$this));
return $rows;
}
示例5: ajax_attrib_select_and_price
/**
* get attributes html selects, price for select attribute
*/
function ajax_attrib_select_and_price()
{
$db = JFactory::getDBO();
$jshopConfig = JSFactory::getConfig();
$product_id = JRequest::getInt('product_id');
$change_attr = JRequest::getInt('change_attr');
if ($jshopConfig->use_decimal_qty) {
$qty = floatval(str_replace(",", ".", JRequest::getVar('qty', 1)));
} else {
$qty = JRequest::getInt('qty', 1);
}
if ($qty < 0) {
$qty = 0;
}
$attribs = JRequest::getVar('attr');
if (!is_array($attribs)) {
$attribs = array();
}
$freeattr = JRequest::getVar('freeattr');
if (!is_array($freeattr)) {
$freeattr = array();
}
JPluginHelper::importPlugin('jshoppingproducts');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onBeforeLoadDisplayAjaxAttrib', array(&$product_id, &$change_attr, &$qty, &$attribs, &$freeattr));
$product = JTable::getInstance('product', 'jshop');
$product->load($product_id);
$dispatcher->trigger('onBeforeLoadDisplayAjaxAttrib2', array(&$product));
$attributesDatas = $product->getAttributesDatas($attribs);
$product->setAttributeActive($attributesDatas['attributeActive']);
$attributeValues = $attributesDatas['attributeValues'];
$product->setFreeAttributeActive($freeattr);
$attributes = $product->getBuildSelectAttributes($attributeValues, $attributesDatas['attributeSelected']);
$rows = array();
foreach ($attributes as $k => $v) {
$v->selects = str_replace(array("\n", "\r", "\t"), "", $v->selects);
$rows[] = '"id_' . $k . '":"' . str_replace('"', '\\"', $v->selects) . '"';
}
$pricefloat = $product->getPrice($qty, 1, 1, 1);
$price = formatprice($pricefloat);
$available = intval($product->getQty() > 0);
$displaybuttons = intval(intval($product->getQty() > 0) || $jshopConfig->hide_buy_not_avaible_stock == 0);
$ean = $product->getEan();
$weight = formatweight($product->getWeight());
$basicprice = formatprice($product->getBasicPrice());
$rows[] = '"price":"' . $price . '"';
$rows[] = '"pricefloat":"' . $pricefloat . '"';
$rows[] = '"available":"' . $available . '"';
$rows[] = '"ean":"' . $ean . '"';
if ($jshopConfig->admin_show_product_basic_price) {
$rows[] = '"basicprice":"' . $basicprice . '"';
}
if ($jshopConfig->product_show_weight) {
$rows[] = '"weight":"' . $weight . '"';
}
if ($jshopConfig->product_list_show_price_default && $product->product_price_default > 0) {
$rows[] = '"pricedefault":"' . formatprice($product->product_price_default) . '"';
}
if ($jshopConfig->product_show_qty_stock) {
$qty_in_stock = getDataProductQtyInStock($product);
$rows[] = '"qty":"' . sprintQtyInStock($qty_in_stock) . '"';
}
$product->updateOtherPricesIncludeAllFactors();
if (is_array($product->product_add_prices)) {
foreach ($product->product_add_prices as $k => $v) {
$rows[] = '"pq_' . $v->product_quantity_start . '":"' . str_replace('"', '\\"', formatprice($v->price)) . '"';
}
}
if ($product->product_old_price) {
$old_price = formatprice($product->product_old_price);
$rows[] = '"oldprice":"' . $old_price . '"';
}
$rows[] = '"displaybuttons":"' . $displaybuttons . '"';
if ($jshopConfig->use_extend_attribute_data) {
$images = $product->getImages();
$videos = $product->getVideos();
$demofiles = $product->getDemoFiles();
$tmp = array();
foreach ($images as $img) {
$tmp[] = '"' . $img->image_name . '"';
}
$displayimgthumb = intval(count($images) > 1 || count($videos) && count($images));
$rows[] = '"images":[' . implode(",", $tmp) . '],"displayimgthumb":"' . $displayimgthumb . '"';
$view_name = "product";
$view_config = array("template_path" => JPATH_COMPONENT . "/templates/" . $jshopConfig->template . "/" . $view_name);
$view = $this->getView($view_name, getDocumentType(), '', $view_config);
$view->setLayout("demofiles");
$view->assign('config', $jshopConfig);
$view->assign('demofiles', $demofiles);
$demofiles = $view->loadTemplate();
$demofiles = str_replace(array("\n", "\r", "\t"), "", $demofiles);
$rows[] = '"demofiles":"' . str_replace('"', '\\"', $demofiles) . '"';
}
$dispatcher->trigger('onBeforeDisplayAjaxAttrib', array(&$rows, &$product));
print '{' . implode(",", $rows) . '}';
die;
}
示例6: ajax_attrib_select_and_price
/**
* get attributes html selects, price for select attribute
*/
function ajax_attrib_select_and_price()
{
$db = JFactory::getDBO();
$jshopConfig = JSFactory::getConfig();
$product_id = JRequest::getInt('product_id');
$change_attr = JRequest::getInt('change_attr');
if ($jshopConfig->use_decimal_qty) {
$qty = floatval(str_replace(",", ".", JRequest::getVar('qty', 1)));
} else {
$qty = JRequest::getInt('qty', 1);
}
if ($qty < 0) {
$qty = 0;
}
$attribs = JRequest::getVar('attr');
if (!is_array($attribs)) {
$attribs = array();
}
$freeattr = JRequest::getVar('freeattr');
if (!is_array($freeattr)) {
$freeattr = array();
}
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onBeforeLoadDisplayAjaxAttrib', array(&$product_id, &$change_attr, &$qty, &$attribs, &$freeattr));
$product = JSFactory::getTable('product', 'jshop');
$product->load($product_id);
$dispatcher->trigger('onBeforeLoadDisplayAjaxAttrib2', array(&$product));
$attributesDatas = $product->getAttributesDatas($attribs);
$product->setAttributeActive($attributesDatas['attributeActive']);
$attributeValues = $attributesDatas['attributeValues'];
$product->setFreeAttributeActive($freeattr);
$attributes = $product->getBuildSelectAttributes($attributeValues, $attributesDatas['attributeSelected']);
$rows = array();
foreach ($attributes as $k => $v) {
$rows[] = '"id_' . $k . '":"' . json_value_encode($v->selects, 1) . '"';
}
$pricefloat = $product->getPrice($qty, 1, 1, 1);
$price = formatprice($pricefloat);
$available = intval($product->getQty() > 0);
$displaybuttons = intval(intval($product->getQty() > 0) || $jshopConfig->hide_buy_not_avaible_stock == 0);
$ean = $product->getEan();
$weight = formatweight($product->getWeight());
$basicprice = formatprice($product->getBasicPrice());
$min_kolichestvo = $product->min_kolichestvo;
$rows[] = '"price":"' . json_value_encode($price) . '"';
$rows[] = '"pricefloat":"' . $pricefloat . '"';
$rows[] = '"available":"' . $available . '"';
$rows[] = '"min_kolichestvo":"' . $min_kolichestvo . '"';
$rows[] = '"ean":"' . json_value_encode($ean) . '"';
if ($jshopConfig->admin_show_product_basic_price) {
$rows[] = '"basicprice":"' . json_value_encode($basicprice) . '"';
}
if ($jshopConfig->product_show_weight) {
$rows[] = '"weight":"' . json_value_encode($weight) . '"';
}
if ($jshopConfig->product_list_show_price_default && $product->product_price_default > 0) {
$rows[] = '"pricedefault":"' . json_value_encode(formatprice($product->product_price_default)) . '"';
}
if ($jshopConfig->product_show_qty_stock) {
$qty_in_stock = getDataProductQtyInStock($product);
$rows[] = '"qty":"' . json_value_encode(sprintQtyInStock($qty_in_stock)) . '"';
}
$product->updateOtherPricesIncludeAllFactors();
if (is_array($product->product_add_prices)) {
foreach ($product->product_add_prices as $k => $v) {
$rows[] = '"pq_' . $v->product_quantity_start . '":"' . json_value_encode(formatprice($v->price)) . '"';
}
}
if ($product->product_old_price) {
$old_price = formatprice($product->product_old_price);
$rows[] = '"oldprice":"' . json_value_encode($old_price) . '"';
}
$rows[] = '"displaybuttons":"' . $displaybuttons . '"';
if ($jshopConfig->hide_delivery_time_out_of_stock) {
$rows[] = '"showdeliverytime":"' . $product->getDeliveryTimeId() . '"';
}
if ($jshopConfig->use_extend_attribute_data) {
$template_path = $jshopConfig->template_path . $jshopConfig->template . "/product";
$images = $product->getImages();
$videos = $product->getVideos();
$demofiles = $product->getDemoFiles();
$tmp = array();
foreach ($images as $img) {
$tmp[] = '"' . $img->image_name . '"';
}
if (!file_exists($template_path . "/block_image_thumb.php")) {
$displayimgthumb = intval(count($images) > 1 || count($videos) && count($images));
$rows[] = '"images":[' . implode(",", $tmp) . '],"displayimgthumb":"' . $displayimgthumb . '"';
}
$view_name = "product";
$view_config = array("template_path" => $template_path);
$view = $this->getView($view_name, getDocumentType(), '', $view_config);
$view->setLayout("demofiles");
$view->assign('config', $jshopConfig);
$view->assign('demofiles', $demofiles);
$demofiles = $view->loadTemplate();
$rows[] = '"demofiles":"' . json_value_encode($demofiles, 1) . '"';
//.........这里部分代码省略.........