<div class="ice-vmimagearea"> <p><?php echo ps_product::image_tag($row->product_thumb_image, "alt=\"" . $row->product_name . "\""); ?> </p> <span class="ice-pprice"> <?php global $iceps_product; if (!$iceps_product) { $iceps_product = new ps_product(); } echo $iceps_product->show_price($row->product_id, true, false); ?> </span> <?php if (!trim(ps_product::product_has_attributes($row->product_id, true))) { ?> <div class="ice-addtocart"> <form action="<?php echo $row->addtocart_link; ?> " method="post" name="addtocart" id="addtocart<?php echo $row->product_id; ?> " onsubmit="handleAddToCart( this.id );return false;" > <input type="hidden" name="option" value="com_virtuemart" /> <input type="hidden" name="page" value="shop.cart" /> <input type="hidden" name="Itemid" value="<?php echo ps_session::getShopItemid(); ?> " />
} $product_s_desc = $db_browse->f("product_s_desc"); if (empty($product_s_desc) && $product_parent_id != 0) { $product_s_desc = $dbp->f("product_s_desc"); // Use product_s_desc from Parent Product } $product_details = $VM_LANG->_('PHPSHOP_FLYPAGE_LBL'); if (PSHOP_ALLOW_REVIEWS == '1' && @$_REQUEST['output'] != "pdf") { // Average customer rating: xxxxx // Total votes: x $product_rating = ps_reviews::allvotes($db_browse->f("product_id")); } else { $product_rating = ""; } // Add-to-Cart Button if (USE_AS_CATALOGUE != '1' && $product_price != "" && !stristr($product_price, $VM_LANG->_('PHPSHOP_PRODUCT_CALL')) && !ps_product::product_has_attributes($db_browse->f('product_id'), true) && $tpl->get_cfg('showAddtocartButtonOnProductList')) { $tpl->set('i', $i); $tpl->set('product_id', $db_browse->f('product_id')); $tpl->set('product_in_stock', $db_browse->f('product_in_stock')); $tpl->set('ps_product_attribute', $ps_product_attribute); $products[$i]['form_addtocart'] = $tpl->fetch('browse/includes/addtocart_form.tpl.php'); $products[$i]['has_addtocart'] = true; } else { $products[$i]['form_addtocart'] = ''; $products[$i]['has_addtocart'] = false; } $products[$i]['product_flypage'] = $url; $products[$i]['product_thumb_image'] = $product_thumb_image; $products[$i]['product_full_image'] = $product_full_image; $products[$i]['full_image_width'] = $full_image_width; $products[$i]['full_image_height'] = $full_image_height;
/** * 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; } }
/** * Handles special task selectors for pages * like the product list */ function LISTS_SPECIAL_TASKS($page) { global $mosConfig_live_site, $VM_LANG, $product_id, $vmIcons; switch ($page) { case "product.product_list": if (empty($_REQUEST['product_parent_id'])) { // add new attribute $alt = " " . $VM_LANG->_('PHPSHOP_ATTRIBUTE_FORM_MNU'); vmMenuBar::custom("", "product.product_attribute_form", $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt); vmMenuBar::spacer(); } // Go to Price list $alt = " " . $VM_LANG->_('PHPSHOP_PRICE_LIST_MNU'); vmMenuBar::custom("", "product.product_price_list", $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt); vmMenuBar::spacer(); // add product type $alt = " " . $VM_LANG->_('PHPSHOP_PRODUCT_PRODUCT_TYPE_FORM_MNU'); vmMenuBar::custom("", "product.product_product_type_form", $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt); vmMenuBar::spacer(); /*** 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'); vmMenuBar::custom("", "product.product_child_form", $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt); } vmMenuBar::divider(); vmMenuBar::spacer(); if (!empty($_REQUEST['category_id'])) { $alt = $VM_LANG->_('VM_PRODUCTS_MOVE_TOOLBAR'); vmMenuBar::custom('move', 'product.product_move', $mosConfig_live_site . '/administrator/images/move.png', $mosConfig_live_site . '/administrator/images/move_f2.png', $alt); vmMenuBar::spacer(); vmMenuBar::divider(); vmMenuBar::spacer(); } break; case "admin.country_list": $alt = " " . $VM_LANG->_('PHPSHOP_ADD_STATE'); vmMenuBar::custom("", "admin.country_state_form", $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt); vmMenuBar::spacer(); $alt = " " . $VM_LANG->_('PHPSHOP_LIST_STATES'); vmMenuBar::custom("", "admin.country_state_list", $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt); vmMenuBar::spacer(); vmMenuBar::divider(); vmMenuBar::spacer(); break; default: } }
/** * Returns HTML code for a snapshot of a product based on the product sku. * This was written to provide a quick way to display a product inside of modules * * @param string $product_sku The SKU identifying the product * @param boolean $show_price Show the product price? * @param boolean $show_addtocart Show the add-to-cart link? * @param boolean $show_product_name Show the product name? */ function product_snapshot($product_sku, $show_price = true, $show_addtocart = true, $show_product_name = true) { global $sess, $mm_action_url; $db = new ps_DB(); require_once CLASSPATH . 'ps_product_category.php'; $ps_product_category = new ps_product_category(); $q = "SELECT product_id, product_name, product_parent_id, product_thumb_image, product_in_stock, product_nobuy, cdate, top,\n\t\t\n\t\tIFNULL((SELECT SUM(product_in_stock) FROM `jos_vm_product` AS cp WHERE cp.`product_parent_id` = jos_vm_product.product_id AND product_publish = \"Y\" AND product_in_stock > 0 ), 0) AS product_in_stock_child\n\n\t\tFROM #__{vm}_product WHERE product_sku='{$product_sku}'"; $db->query($q); if ($db->next_record()) { $product_id = $db->f("product_id"); $tpl = new $GLOBALS['VM_THEMECLASS'](); $cid = $ps_product_category->get_cid($product_id); $novinka = ""; if (time() - $db->f("cdate") < 30 * 86400) { // 14 Days * (number of seconds in 24 hours) $novinka = 'Y'; } $tpl->set('product_id', $product_id); $tpl->set('product_name', $db->f("product_name")); //$tpl->set( 'product_in_stock', $db->f("product_in_stock") ); $tpl->set('product_in_stock', $db->f("product_in_stock_child") ? $db->f("product_in_stock_child") : $db->f("product_in_stock")); $tpl->set('product_nobuy', $db->f("product_nobuy")); $tpl->set('show_product_name', $show_product_name); $tpl->set('novinka', $novinka); $tpl->set('top', $db->f('top')); if ($db->f("product_parent_id")) { $url = "?page=shop.product_details&category_id={$cid}&flypage=" . $this->get_flypage($db->f("product_parent_id")); $url .= "&product_id=" . $db->f("product_parent_id"); } else { $url = "?page=shop.product_details&category_id={$cid}&flypage=" . $this->get_flypage($db->f("product_id")); $url .= "&product_id=" . $db->f("product_id"); } $product_link = $sess->url($mm_action_url . "index.php" . $url); $tpl->set('product_link', $product_link); $tpl->set('product_thumb_image', $db->f("product_thumb_image"), "alt=\"" . $db->f("product_name") . "\""); if (_SHOW_PRICES == '1' && $show_price) { // Show price, but without "including X% tax" $price = $this->show_price($db->f("product_id"), true); $tpl->set('price', $price); } if (USE_AS_CATALOGUE != 1 && $show_addtocart && isset($GLOBALS['product_info'][$product_id]['price']['product_price_id']) && !$this->product_has_attributes($product_id, true)) { $url = "?page=shop.cart&func=cartAdd&product_id=" . $db->f("product_id"); $addtocart_link = $sess->url($mm_action_url . "index.php" . $url); $tpl->set('addtocart_link', $addtocart_link); } $has_attributes = ps_product::product_has_attributes($product_id, true); $tpl->set('has_attributes', $has_attributes); require_once CLASSPATH . 'ps_product_attribute.php'; $ps_product_attribute = new ps_product_attribute(); $tpl->set('ps_product_attribute', $ps_product_attribute); return $tpl->fetch('common/productsnapshot.tpl.php'); } return ''; }