本文整理汇总了PHP中ps_product类的典型用法代码示例。如果您正苦于以下问题:PHP ps_product类的具体用法?PHP ps_product怎么用?PHP ps_product使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ps_product类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: genHTML
function genHTML($catid)
{
require_once JPATH_BASE . '/components/com_virtuemart/virtuemart_parser.php';
require_once CLASSPATH . 'ps_product.php';
$this->loadProduct($catid);
$ps_product = new ps_product();
$i = 0;
foreach ($this->_listPro as $pro) {
$temp = $ps_product->product_snapshot($pro, $this->show_price, $this->show_addtocart);
echo "<div class=\"vm_element\">" . $temp . "</div>";
$i++;
}
}
示例2: getProductBySku
function getProductBySku($sku)
{
global $database, $logger;
$logger->debug(get_class($this) . "::getProductBySku({$sku})");
$prod = new Product();
$ps_prod = new ps_product();
$ps_cat = new ps_product_category();
$query = "select product_id from #__vm_product where product_sku=" . $sku;
$database->loadQuery($query);
$id = $db->loadResult();
$prod->setOid($id);
$prod->setName($ps_prod->get_field('product_name'));
$prod->setFlypage($ps_prod->get_flypage($id));
$prod->setCategoryId($ps_cat->get_cid($id));
return $prod;
}
示例3: mm_showMyFileName
* @copyright Copyright (C) 2004-2009 soeren - All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
mm_showMyFileName(__FILE__);
global $ps_order_status;
require_once CLASSPATH . 'ps_checkout.php';
require_once CLASSPATH . 'ps_userfield.php';
require_once CLASSPATH . 'ps_product.php';
$ps_product = new ps_product();
$registrationfields = ps_userfield::getUserFields('registration', false, '', true, true);
$shippingfields = ps_userfield::getUserFields('shipping', false, '', true, true);
$order_id = vmRequest::getInt('order_id', 0);
if (empty($order_id)) {
vmRedirect($_SERVER['SCRIPT_NAME'] . '?option=com_virtuemart&page=order.order_list');
}
$dbc = new ps_DB();
$q = "SELECT * FROM #__{vm}_orders WHERE order_id={$order_id} and vendor_id = {$ps_vendor_id}";
$db->query($q);
$db->next_record();
echo "<style type='text/css' media='print'>.vmNoPrint { display: none }</style>";
?>
<br />
<?php
echo vmCommonHTML::PrintIcon();
示例4: getItems
function getItems(&$params) {
global $CURRENCY_DISPLAY, $sess, $mm_action_url, $VM_LANG;
$db = new ps_DB;
if($rows = $this->getProductSKU( $this->NumberOfProducts, $this->SortMethod, $this->vmcategories, $this->featuredProducts, $this->specific_product_ids, $this->source, $this->catfilter ))
{
$ps_product = new ps_product;
$ps_product_category = new ps_product_category;
$pro_skus = implode("','", $rows);
$limit = $this->NumberOfProducts;
if($limit>0) {
$limit = "LIMIT $limit";
} else {
$limit = "";
}
$q = "SELECT product_id, product_name, product_parent_id, product_thumb_image, product_desc, product_full_image FROM #__{vm}_product AS p WHERE product_sku in ('$pro_skus')";
switch( $this->SortMethod ) {
case 'random':
$q .= "\n ORDER BY RAND() $limit";
break;
case 'newest':
$q .= "\n ORDER BY p.cdate DESC $limit";
break;
case 'oldest':
$q .= "\n ORDER BY p.cdate ASC $limit";
break;
default:
$q .= "\n ORDER BY p.cdate DESC $limit";
break;
}
$db->setQuery( $q );
$items = $db->loadObjectList();
//var_dump($items);die;
foreach($items as &$item) {
$product_id = $item->product_id;
$cid = $ps_product_category->get_cid( $product_id );
$product_name = $item->product_name;
$item->title = $product_name;
if ($item->product_parent_id) {
$url = "?page=shop.product_details&category_id=$cid&flypage=".$ps_product->get_flypage($item->product_parent_id);
$url .= "&product_id=" . $item->product_parent_id;
} else {
$url = "?page=shop.product_details&category_id=$cid&flypage=".$ps_product->get_flypage($item->product_id);
$url .= "&product_id=" . $item->product_id;
}
$product_link = $sess->url($mm_action_url. "index.php" . $url);
$item->link = $product_link;
$product_thumb_image = $item->product_full_image;
//$img = $this->image_url( $product_thumb_image, "alt=\"".$product_name."\"");
$item->image = IMAGEPATH.'product/'.$product_thumb_image;
$item->fulltext = $item->product_desc;
$item->introtext = $item->product_desc;
$price_base = $this->get_price($ps_product, $item->product_id);
$price_ps = $ps_product->get_price($item->product_id, true);
if (_SHOW_PRICES == '1' && $this->show_price) {
// Show price, but without "including X% tax"
$item->price = $CURRENCY_DISPLAY->getFullValue($price_base[1]);
}
if (USE_AS_CATALOGUE != 1 && $this->show_addtocart
&& isset($price_ps) && $price_ps['product_price'] // Product must have a price to add it to cart
/*&& !$ps_product->product_has_attributes($item->product_id, true) // Parent Products and Products with attributes can't be added to cart this way*/
) {
$url = "?page=shop.cart&func=cartAdd&product_id=" . $item->product_id;
$addtocart_link = $sess->url($mm_action_url. "index.php" . $url);
$item->addtocart_link = $addtocart_link;
}
}
return $this->update($params, $items);
} else return array();
}
示例5:
</a>
</td>
</tr>
<tr>
<td align="left" nowrap ><?php
echo $product_price;
?>
</td>
</tr>
<tr>
<td ><a href="<?php
echo $product_flypage;
?>
">
<?php
echo ps_product::image_tag($product_thumb_image, 'class="browseProductImage" border="0" title="' . $product_name . '" alt="' . $product_name . '"');
?>
</a>
</td>
</tr>
<tr>
<td height="80" valign="top"><?php
echo $product_s_desc;
?>
<br />
<a style="font-size: 9px; font-weight: bold;" href="<?php
echo $product_flypage;
?>
">[<?php
echo $product_details;
?>
示例6: product_order_levels
/**
* Retrieves the maximum and minimum quantity for the product specified by $product_id
*
* @param int $product_id
* @return array
*/
function product_order_levels($product_id)
{
$min_order = 0;
$max_order = 0;
$product_order_levels = ps_product::get_field($product_id, 'product_order_levels');
$product_parent_id = ps_product::get_field($product_id, 'product_parent_id');
if ($product_order_levels != ',') {
$order_levels = $product_order_levels;
$levels = explode(",", $order_levels);
$min_order = array_shift($levels);
$max_order = array_shift($levels);
} else {
if ($product_parent_id > 0) {
//check parent if product_parent_id != 0
$product_order_levels = ps_product::get_field($product_parent_id, 'product_order_levels');
$product_parent_id = ps_product::get_field($product_parent_id, 'product_parent_id');
if ($product_order_levels != ",") {
$order_levels = $product_order_levels;
$levels = explode(",", $order_levels);
$min_order = array_shift($levels);
$max_order = array_shift($levels);
}
}
}
return array($min_order, $max_order);
}
示例7: mm_showMyFileName
* @package VirtueMart
* @subpackage html
* @copyright Copyright (C) 2004-2008 soeren - All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
mm_showMyFileName(__FILE__);
// load important class files
require_once CLASSPATH . "ps_product.php";
$ps_product = new ps_product();
require_once CLASSPATH . "ps_product_category.php";
$ps_product_category = new ps_product_category();
require_once CLASSPATH . "ps_product_files.php";
require_once CLASSPATH . "ps_reviews.php";
require_once CLASSPATH . "imageTools.class.php";
require_once CLASSPATH . "PEAR/Table.php";
require_once CLASSPATH . 'ps_product_attribute.php';
$ps_product_attribute = new ps_product_attribute();
$Itemid = $sess->getShopItemid();
$keyword1 = $vmInputFilter->safeSQL(urldecode(vmGet($_REQUEST, 'keyword1', null)));
$keyword2 = $vmInputFilter->safeSQL(urldecode(vmGet($_REQUEST, 'keyword2', null)));
$search_op = $vmInputFilter->safeSQL(vmGet($_REQUEST, 'search_op', null));
$search_limiter = $vmInputFilter->safeSQL(vmGet($_REQUEST, 'search_limiter', null));
if (empty($category_id)) {
$category_id = $search_category;
示例8: show_quantity_box
/**
* Creates the Quantity Input Boxes/Radio Buttons/Lists for Products
*
* @param int $product_id The Parent Product ID
* @param int $prod_id The actual Product ID
* @param string $child
* @param string $use_parent
* @return string
*/
function show_quantity_box($product_id, $prod_id, $child = false, $use_parent = 'N')
{
global $VM_LANG;
$tpl = vmTemplate::getInstance();
if ($child == 'Y') {
//We have a child list so get the current quantity;
$quantity = 0;
for ($i = 0; $i < $_SESSION["cart"]["idx"]; $i++) {
if ($_SESSION['cart'][$i]["product_id"] == $prod_id) {
$quantity = $_SESSION['cart'][$i]["quantity"];
}
}
} else {
$quantity = vmrequest::getInt('quantity', 1);
}
// Detremine which style to use
if ($use_parent == 'Y' && !empty($product_id)) {
$id = $product_id;
} else {
$id = $prod_id;
}
//Get style to use
$product_in_stock = ps_product::get_field($id, 'product_in_stock');
$quantity_options = ps_product::get_quantity_options($id);
extract($quantity_options);
//Start output of quantity
//Check for incompatabilities and reset to normal
if (CHECK_STOCK == '1' && !$product_in_stock) {
$display_type = 'hide';
}
if (empty($display_type) || @$display_type == "hide" && $child == 'Y' || @$display_type == "radio" && $child == 'YM' || @$display_type == "radio" && !$child) {
$display_type = "none";
}
unset($quantity_options['display_type']);
$tpl->set('prod_id', $prod_id);
$tpl->set('quantity', $quantity);
$tpl->set('display_type', $display_type);
$tpl->set('child', $child);
$tpl->set('quantity_options', $quantity_options);
//Determine if label to be used
$html = $tpl->fetch('product_details/includes/quantity_box_general.tpl.php');
return $html;
}
示例9: vmlistAdditionalImages
/**
* Builds a list of all additional images
*
* @param int $product_id
* @param array $images
* @return string
*/
function vmlistAdditionalImages($product_id, $images, $title = '', $limit = 1000)
{
global $sess;
$html = '';
$i = 0;
foreach ($images as $image) {
$thumbtag = ps_product::image_tag($image->file_name, 'class="browseProductImage"', 1, 'product', $image->file_image_thumb_width, $image->file_image_thumb_height);
$fulladdress = $sess->url('index2.php?page=shop.view_images&image_id=' . $image->file_id . '&product_id=' . $product_id . '&pop=1');
if ($this->get_cfg('useLightBoxImages', 1)) {
$html .= vmCommonHTML::getLightboxImageLink($image->file_url, $thumbtag, $title ? $title : stripslashes(htmlentities($image->file_title, ENT_QUOTES)), 'product' . $product_id);
} else {
$html .= vmPopupLink($fulladdress, $thumbtag, 640, 550);
}
$html .= ' ';
if (++$i > $limit) {
break;
}
}
return $html;
}
示例10: delete_record
/**
* Deletes one Record.
*/
function delete_record($record_id, &$d)
{
global $db;
$record_id = intval($record_id);
if ($this->validate_delete($record_id)) {
$dbu = new ps_db();
// Get the order items and update the stock level
// to the number before the order was placed
$q = "SELECT order_status, product_id, product_quantity FROM #__{vm}_order_item WHERE order_id={$record_id}";
$db->query($q);
require_once CLASSPATH . 'ps_product.php';
// Now update each ordered product
while ($db->next_record()) {
if (in_array($db->f('order_status'), array('P', 'X', 'R'))) {
continue;
}
if (ENABLE_DOWNLOADS == '1' && ps_product::is_downloadable($db->f("product_id")) && VM_DOWNLOADABLE_PRODUCTS_KEEP_STOCKLEVEL == '1') {
$q = "UPDATE #__{vm}_product \n\t\t\t\t\t\t\tSET product_sales=product_sales-" . $db->f("product_quantity") . " \n\t\t\t\t\t\tWHERE product_id=" . $db->f("product_id");
$dbu->query($q);
} else {
$q = "UPDATE #__{vm}_product \n\t\t\t\t\t\tSET product_in_stock=product_in_stock+" . $db->f("product_quantity") . ",\n\t\t\t\t\t\t\tproduct_sales=product_sales-" . $db->f("product_quantity") . " \n\t\t\t\t\t\tWHERE product_id=" . $db->f("product_id");
$dbu->query($q);
}
}
$q = "DELETE from #__{vm}_orders where order_id='{$record_id}'";
$db->query($q);
$q = "DELETE from #__{vm}_order_item where order_id='{$record_id}'";
$db->query($q);
$q = "DELETE from #__{vm}_order_payment where order_id='{$record_id}'";
$db->query($q);
$q = "DELETE from #__{vm}_product_download where order_id='{$record_id}'";
$db->query($q);
$q = "DELETE from #__{vm}_order_history where order_id='{$record_id}'";
$db->query($q);
$q = "DELETE from #__{vm}_order_user_info where order_id='{$record_id}'";
$db->query($q);
$q = "DELETE FROM #__{vm}_shipping_label where order_id={$record_id}";
$db->query($q);
return True;
} else {
return False;
}
}
示例11: change_product_item_price
function change_product_item_price()
{
require_once CLASSPATH . 'ps_product.php';
global $VM_LANG, $vmLogger, $mosConfig_offset;
$ps_product = new ps_product();
$order_item_id = vmGet($_REQUEST, 'order_item_id');
$product_item_price_new = trim(vmGet($_REQUEST, 'product_item_price'));
$product_final_price_new = trim(vmGet($_REQUEST, 'product_final_price'));
$db = new ps_DB();
// Added, to read user_info_id
$q = "SELECT user_info_id, product_id, product_quantity, product_final_price, product_item_price, product_final_price - product_item_price AS item_tax ";
$q .= "FROM #__{vm}_order_item WHERE order_id = '" . $this->order_id . "' ";
$q .= "AND order_item_id = '" . addslashes($order_item_id) . "'";
$db->query($q);
$db->next_record();
$product_id = $db->f('product_id');
$timestamp = time() + $mosConfig_offset * 60 * 60;
$user_info_id = $db->f('user_info_id');
$prod_weight = $ps_product->get_weight($product_id);
$my_taxrate = $ps_product->get_product_taxrate($product_id, $prod_weight, $user_info_id);
$product_item_price = $db->f('product_item_price');
$product_final_price = $db->f('product_final_price');
$quantity = $db->f('product_quantity');
if (is_numeric($product_item_price_new)) {
$product_final_price_new = round($product_item_price_new * ($my_taxrate + 1), 2);
}
$product_item_price_new = $product_final_price_new / ($my_taxrate + 1);
$q = "UPDATE #__{vm}_order_item ";
$q .= "SET product_item_price = " . $product_item_price_new . ", ";
$q .= "product_final_price = " . $product_final_price_new . ", ";
$q .= "mdate = " . $timestamp . " ";
$q .= "WHERE order_item_id = '" . addslashes($order_item_id) . "'";
$db->query($q);
$db->next_record();
$this->recalc_order($this->order_id);
$this->reload_from_db = 1;
$vmLogger->info($VM_LANG->_('PHPSHOP_ORDER_PRINT_PRICE') . $VM_LANG->_('PHPSHOP_ORDER_EDIT_SOMETHING_HAS_CHANGED'));
}
示例12: LISTS_SPECIAL_TASKS
/**
* Handles special task selectors for pages
* like the product list
*/
function LISTS_SPECIAL_TASKS($page)
{
global $mosConfig_live_site, $VM_LANG, $product_id;
$bar =& vmToolBar::getInstance('virtuemart');
switch ($page) {
case "product.product_list":
if (empty($_REQUEST['product_parent_id'])) {
// add new attribute
$alt = $VM_LANG->_('PHPSHOP_ATTRIBUTE_FORM_MNU');
$bar->custom('new', "product.product_attribute_form", 'new', $alt);
}
// Go to Price list
$alt = $VM_LANG->_('PHPSHOP_PRICE_LIST_MNU');
$bar->custom('new', "product.product_price_list", 'new', $alt);
// add product type
$alt = $VM_LANG->_('PHPSHOP_PRODUCT_PRODUCT_TYPE_FORM_MNU');
$bar->custom('new', "product.product_product_type_form", 'new', $alt);
/*** Adding an item is only pssible, if the product has attributes ***/
if (ps_product::product_has_attributes($product_id)) {
// Add Item
$alt = $VM_LANG->_('PHPSHOP_PRODUCT_FORM_NEW_ITEM_LBL');
$bar->custom('new', "product.product_child_form", 'new', $alt);
}
$bar->divider();
if (!empty($_REQUEST['category_id'])) {
$alt = $VM_LANG->_('VM_PRODUCTS_MOVE_TOOLBAR');
$bar->custom('move', 'product.product_move', 'move', $alt);
$bar->divider();
}
break;
case "admin.country_list":
$alt = $VM_LANG->_('PHPSHOP_ADD_STATE');
$bar->custom('new', "admin.country_state_form", 'new', $alt);
$alt = $VM_LANG->_('PHPSHOP_LIST_STATES');
$bar->custom('new', "admin.country_state_list", 'new', $alt);
$bar->divider();
break;
}
}
示例13:
?>
<div class="vmRecent">
<?php
echo $recent_products;
?>
</div>
<?php
// Show Featured Products
if ($this->get_cfg('showFeatured', 1)) {
/* featuredproducts(random, no_of_products,category_based) no_of_products 0 = all else numeric amount
edit featuredproduct.tpl.php to edit layout */
echo $ps_product->featuredProducts(true, 10, false);
}
// Show Latest Products
if ($this->get_cfg('showlatest', 1)) {
/* latestproducts(random, no_of_products,month_based,category_based) no_of_products 0 = all else numeric amount
edit latestproduct.tpl.php to edit layout */
ps_product::latestProducts(true, 10, false, false);
}
?>
<?php
if (isset($paypalLogo)) {
?>
<div class="vmRecent" style="padding: 10px; text-align: center;">
<?php
echo $paypalLogo;
?>
</div>
<?php
}
示例14: get_insurance_value
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;
}
示例15: displayScroller
/**
* Display Product Data
*/
function displayScroller(&$rows)
{
global $mosConfig_absolute_path;
$database = new ps_DB();
require_once CLASSPATH . "ps_product.php";
$ps_product = new ps_product();
$cnt = 0;
if ($this->ScrollCSSOverride == 'yes') {
$txt_size = $this->ScrollTextSize . 'px';
$margin = $this->ScrollMargin . 'px';
//$height=($height-intval($margin+0));
//$width=($width-intval($margin+30));
echo $this->params->get('pretext', "");
echo " <div style=\"text-align:" . $this->ScrollAlign . ";background-color: " . $this->ScrollBGColor . "; width:" . $this->ScrollWidth . "px;\n margin-top: {$margin}; margin-right: {$margin}; margin-bottom: {$margin}; margin-left: {$margin};\" >\n <marquee behavior=\"" . $this->ScrollBehavior . "\" \n direction=\"" . $this->ScrollDirection . "\" \n height=\"" . $this->ScrollHeight . "\"\n width=\"" . $this->ScrollWidth . "\"\n scrollamount=\"" . $this->ScrollAmount . "\"\n scrolldelay=\"" . $this->ScrollDelay . "\"\n truespeed=\"true\" onmouseover=\"this.stop()\" onmouseout=\"this.start()\"\n style=\"text-align: " . $this->ScrollTextAlign . "; color: " . $this->ScrollTextColor . "; font-weight: " . $this->ScrollTextWeight . "; font-size: {$txt_size};\" >";
} else {
echo " <div style=\"width:" . $this->ScrollWidth . "px;text-align:" . $this->ScrollAlign . ";\">\n <marquee behavior=\"" . $this->ScrollBehavior . "\" \n direction=\"" . $this->ScrollDirection . "\" \n height=\"" . $this->ScrollHeight . "\"\n width=\"" . $this->ScrollWidth . "\"\n scrollamount=\"" . $this->ScrollAmount . "\"\n scrolldelay=\"" . $this->ScrollDelay . "\"\n truespeed=\"true\" onmouseover=\"this.stop()\" onmouseout=\"this.start()\">";
}
$show_product_name = $this->show_product_name == "yes" ? true : false;
$show_addtocart = $this->show_addtocart == "yes" ? true : false;
$show_price = $this->show_price == "yes" ? true : false;
if ($this->ScrollDirection == 'left' || $this->ScrollDirection == 'right') {
echo '<table border="0"><tr>';
}
foreach ($rows as $row) {
if ($this->ScrollDirection == 'left' || $this->ScrollDirection == 'right') {
echo '<td style="vertical-align:top;padding: 2px 5px 2px 5px;">';
}
$ps_product->show_snapshot($row->product_sku, $show_price, $show_addtocart, $show_product_name);
if ($this->ScrollDirection == 'left' || $this->ScrollDirection == 'right') {
echo '</td>';
} else {
for ($i = 0; $i < $this->ScrollLineCharTimes; $i++) {
echo $this->ScrollLineChar;
}
}
}
if ($this->ScrollDirection == 'left' || $this->ScrollDirection == 'right') {
echo '</tr></table>';
}
echo " </marquee>\n </div>";
}