//set variables, usually set by shopfunctionsf::getLoginForm in case this layout is differently used if (!isset($this->show)) { $this->show = TRUE; } if (!isset($this->from_cart)) { $this->from_cart = FALSE; } if (!isset($this->order)) { $this->order = FALSE; } if (!class_exists('shopFunctionsF')) { require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php'; } $comUserOption = shopFunctionsF::getComUserOption(); if (empty($this->url)) { $url = vmURI::getCleanUrl(); } else { $url = $this->url; } $user = JFactory::getUser(); if ($this->show and $user->id == 0) { JHtml::_('behavior.formvalidation'); JHTML::_('behavior.modal'); //Extra login stuff, systems like openId and plugins HERE if (JPluginHelper::isEnabled('authentication', 'openid')) { $lang = JFactory::getLanguage(); $lang->load('plg_authentication_openid', JPATH_ADMINISTRATOR); $langScript = ' //<![CDATA[ ' . 'var JLanguage = {};' . ' JLanguage.WHAT_IS_OPENID = \'' . JText::_('WHAT_IS_OPENID') . '\';' . ' JLanguage.LOGIN_WITH_OPENID = \'' . JText::_('LOGIN_WITH_OPENID') . '\';' . ' JLanguage.NORMAL_LOGIN = \'' . JText::_('NORMAL_LOGIN') . '\';' . ' var comlogin = 1; //]]>
<?php // no direct access defined('_JEXEC') or die('Restricted access'); vmJsApi::jQuery(); vmJsApi::chosenDropDowns(); ?> <div class="vm-curency"> <!-- Currency Selector Module --> <?php echo $text_before; ?> <form action="<?php echo vmURI::getCleanUrl(); ?> " method="post"> <?php echo JHTML::_('select.genericlist', $currencies, 'virtuemart_currency_id', 'class="inputbox vm-chzn-select"', 'virtuemart_currency_id', 'currency_txt', $virtuemart_currency_id); ?> <input class="button" type="submit" name="submit" value="<?php echo vmText::_('MOD_VIRTUEMART_CURRENCIES_CHANGE_CURRENCIES'); ?> " /> </form> </div>
/** * Collect all data to show on the template * * @author RolandD, Max Milbers */ function display($tpl = null) { //TODO get plugins running // $dispatcher = JDispatcher::getInstance(); // $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); VmConfig::loadJLang('com_virtuemart', true); $show_prices = VmConfig::get('show_prices', 1); if ($show_prices == '1') { if (!class_exists('calculationHelper')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php'; } } $this->assignRef('show_prices', $show_prices); $document = JFactory::getDocument(); // add javascript for price and cart, need even for quantity buttons, so we need it almost anywhere vmJsApi::jPrice(); $mainframe = JFactory::getApplication(); $pathway = $mainframe->getPathway(); $task = JRequest::getCmd('task'); if (!class_exists('VmImage')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php'; } // Load the product //$product = $this->get('product'); //Why it is sensefull to use this construction? Imho it makes it just harder $product_model = VmModel::getModel('product'); $this->assignRef('product_model', $product_model); $virtuemart_product_idArray = JRequest::getVar('virtuemart_product_id', 0); if (is_array($virtuemart_product_idArray) and count($virtuemart_product_idArray) > 0) { $virtuemart_product_id = (int) $virtuemart_product_idArray[0]; } else { $virtuemart_product_id = (int) $virtuemart_product_idArray; } $quantityArray = JRequest::getVar('quantity', array()); //is sanitized then JArrayHelper::toInteger($quantityArray); $quantity = 1; if (!empty($quantityArray[0])) { $quantity = $quantityArray[0]; } $product = $product_model->getProduct($virtuemart_product_id, TRUE, TRUE, TRUE, $quantity); if (!class_exists('shopFunctionsF')) { require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php'; } $last_category_id = shopFunctionsF::getLastVisitedCategoryId(); if (empty($product->slug)) { //Todo this should be redesigned to fit better for SEO $mainframe->enqueueMessage(JText::_('COM_VIRTUEMART_PRODUCT_NOT_FOUND')); $categoryLink = ''; if (!$last_category_id) { $last_category_id = JRequest::getInt('virtuemart_category_id', false); } if ($last_category_id) { $categoryLink = '&virtuemart_category_id=' . $last_category_id; } if (VmConfig::get('handle_404', 1)) { $mainframe->redirect(JRoute::_('index.php?option=com_virtuemart&view=category' . $categoryLink . '&error=404', FALSE)); } else { JError::raise(E_ERROR, '404', 'Not found'); } return; } if (!empty($product->customfields)) { foreach ($product->customfields as $k => $custom) { if (!empty($custom->layout_pos)) { $product->customfieldsSorted[$custom->layout_pos][] = $custom; unset($product->customfields[$k]); } } $product->customfieldsSorted['normal'] = $product->customfields; unset($product->customfields); } $product->event = new stdClass(); $product->event->afterDisplayTitle = ''; $product->event->beforeDisplayContent = ''; $product->event->afterDisplayContent = ''; if (VmConfig::get('enable_content_plugin', 0)) { shopFunctionsF::triggerContentPlugin($product, 'productdetails', 'product_desc'); } $product_model->addImages($product); $this->assignRef('product', $product); if (isset($product->min_order_level) && (int) $product->min_order_level > 0) { $min_order_level = $product->min_order_level; } else { $min_order_level = 1; } $this->assignRef('min_order_level', $min_order_level); if (isset($product->step_order_level) && (int) $product->step_order_level > 0) { $step_order_level = $product->step_order_level; } else { $step_order_level = 1; } $this->assignRef('step_order_level', $step_order_level); // Load the neighbours if (VmConfig::get('product_navigation', 1)) { $product->neighbours = $product_model->getNeighborProducts($product); } // Load the category $category_model = VmModel::getModel('category'); shopFunctionsF::setLastVisitedCategoryId($product->virtuemart_category_id); if ($category_model) { $category = $category_model->getCategory($product->virtuemart_category_id); $category_model->addImages($category, 1); $this->assignRef('category', $category); //Seems we dont need this anylonger, destroyed the breadcrumb if ($category->parents) { foreach ($category->parents as $c) { if (is_object($c) and isset($c->category_name)) { $pathway->addItem(strip_tags($c->category_name), JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $c->virtuemart_category_id, FALSE)); } else { vmdebug('Error, parent category has no name, breadcrumb maybe broken, category', $c); } } } $category->children = $category_model->getChildCategoryList($product->virtuemart_vendor_id, $product->virtuemart_category_id); $category_model->addImages($category->children, 1); } if (!empty($tpl)) { $format = $tpl; } else { $format = JRequest::getWord('format', 'html'); } if ($format == 'html') { // Set Canonic link $document->addHeadLink($product->canonical, 'canonical', 'rel', ''); } $pathway->addItem(strip_tags($product->product_name)); // Set the titles // $document->setTitle should be after the additem pathway if ($product->customtitle) { $document->setTitle(strip_tags($product->customtitle)); } else { $document->setTitle(strip_tags(($category->category_name ? $category->category_name . ' : ' : '') . $product->product_name)); } $ratingModel = VmModel::getModel('ratings'); $allowReview = $ratingModel->allowReview($product->virtuemart_product_id); $this->assignRef('allowReview', $allowReview); $showReview = $ratingModel->showReview($product->virtuemart_product_id); $this->assignRef('showReview', $showReview); if ($showReview) { $review = $ratingModel->getReviewByProduct($product->virtuemart_product_id); $this->assignRef('review', $review); $rating_reviews = $ratingModel->getReviews($product->virtuemart_product_id); $this->assignRef('rating_reviews', $rating_reviews); } $showRating = $ratingModel->showRating($product->virtuemart_product_id); $this->assignRef('showRating', $showRating); if ($showRating) { $vote = $ratingModel->getVoteByProduct($product->virtuemart_product_id); $this->assignRef('vote', $vote); $rating = $ratingModel->getRatingByProduct($product->virtuemart_product_id); $this->assignRef('rating', $rating); } $allowRating = $ratingModel->allowRating($product->virtuemart_product_id); $this->assignRef('allowRating', $allowRating); // Check for editing access // @todo build edit page if (!class_exists('Permissions')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php'; } //if (Permissions::getInstance()->check("admin,storeadmin")) { $perm = Permissions::getInstance(); $admin = $perm->check("admin"); if (!$admin) { vmdebug('No admin'); } $storeadmin = $perm->check("admin,storeadmin"); if (!$storeadmin) { vmdebug('No $storeadmin'); } $superVendor = $perm->isSuperVendor(); if (!$superVendor) { vmdebug('No $superVendor'); } if ($admin or $perm->isSuperVendor() == $product->virtuemart_vendor_id and $storeadmin) { $edit_link = JURI::root() . 'index.php?option=com_virtuemart&tmpl=component&view=product&task=edit&virtuemart_product_id=' . $product->virtuemart_product_id; $edit_link = $this->linkIcon($edit_link, 'COM_VIRTUEMART_PRODUCT_FORM_EDIT_PRODUCT', 'edit', false, false); } else { $edit_link = ""; } $this->assignRef('edit_link', $edit_link); // todo: atm same form for "call for price" and "ask a question". Title of the form should be different $askquestion_url = JRoute::_('index.php?option=com_virtuemart&view=productdetails&task=askquestion&virtuemart_product_id=' . $product->virtuemart_product_id . '&virtuemart_category_id=' . $product->virtuemart_category_id . '&tmpl=component', FALSE); $this->assignRef('askquestion_url', $askquestion_url); // Load the user details $user = JFactory::getUser(); $this->assignRef('user', $user); // More reviews link $uri = JURI::getInstance(); $uri->setVar('showall', 1); $uristring = vmURI::getCleanUrl(); $this->assignRef('more_reviews', $uristring); if ($product->metadesc) { $document->setDescription($product->metadesc); } if ($product->metakey) { $document->setMetaData('keywords', $product->metakey); } if ($product->metarobot) { $document->setMetaData('robots', $product->metarobot); } if ($mainframe->getCfg('MetaTitle') == '1') { $document->setMetaData('title', $product->product_name); //Maybe better product_name } if ($mainframe->getCfg('MetaAuthor') == '1') { $document->setMetaData('author', $product->metaauthor); } $showBasePrice = Permissions::getInstance()->check('admin'); //todo add config settings $this->assignRef('showBasePrice', $showBasePrice); $productDisplayShipments = array(); $productDisplayPayments = array(); if (!class_exists('vmPSPlugin')) { require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php'; } JPluginHelper::importPlugin('vmshipment'); JPluginHelper::importPlugin('vmpayment'); $dispatcher = JDispatcher::getInstance(); $returnValues = $dispatcher->trigger('plgVmOnProductDisplayShipment', array($product, &$productDisplayShipments)); $returnValues = $dispatcher->trigger('plgVmOnProductDisplayPayment', array($product, &$productDisplayPayments)); $this->assignRef('productDisplayPayments', $productDisplayPayments); $this->assignRef('productDisplayShipments', $productDisplayShipments); if (empty($category->category_template)) { $category->category_template = VmConfig::get('categorytemplate'); } shopFunctionsF::setVmTemplate($this, $category->category_template, $product->product_template, $category->category_product_layout, $product->layout); shopFunctionsF::addProductToRecent($virtuemart_product_id); $currency = CurrencyDisplay::getInstance(); $this->assignRef('currency', $currency); if (JRequest::getCmd('layout', 'default') == 'notify') { $this->setLayout('notify'); } //Added by Seyi Awofadeju to catch notify layout parent::display($tpl); }
/** * Collect all data to show on the template * * @author RolandD, Max Milbers */ function display($tpl = null) { $show_prices = VmConfig::get('show_prices', 1); $this->assignRef('show_prices', $show_prices); $document = JFactory::getDocument(); $app = JFactory::getApplication(); $menus = $app->getMenu(); $menu = $menus->getActive(); if (!empty($menu->id)) { ShopFunctionsF::setLastVisitedItemId($menu->id); } else { if ($itemId = vRequest::getInt('Itemid', false)) { ShopFunctionsF::setLastVisitedItemId($itemId); } } $pathway = $app->getPathway(); $task = vRequest::getCmd('task'); if (!class_exists('VmImage')) { require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php'; } // Load the product //$product = $this->get('product'); //Why it is sensefull to use this construction? Imho it makes it just harder $product_model = VmModel::getModel('product'); $this->assignRef('product_model', $product_model); $virtuemart_product_idArray = vRequest::getInt('virtuemart_product_id', 0); if (is_array($virtuemart_product_idArray) and count($virtuemart_product_idArray) > 0) { $virtuemart_product_id = (int) $virtuemart_product_idArray[0]; } else { $virtuemart_product_id = (int) $virtuemart_product_idArray; } $quantityArray = vRequest::getInt('quantity', array()); //is sanitized then $quantity = 1; if (!empty($quantityArray[0])) { $quantity = $quantityArray[0]; } $ratingModel = VmModel::getModel('ratings'); $product_model->withRating = $this->showRating = $ratingModel->showRating($virtuemart_product_id); $product = $product_model->getProduct($virtuemart_product_id, TRUE, TRUE, TRUE, $quantity); if (!class_exists('shopFunctionsF')) { require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php'; } $last_category_id = shopFunctionsF::getLastVisitedCategoryId(); $customfieldsModel = VmModel::getModel('Customfields'); if ($product->customfields) { if (!class_exists('vmCustomPlugin')) { require JPATH_VM_PLUGINS . DS . 'vmcustomplugin.php'; } $customfieldsModel->displayProductCustomfieldFE($product, $product->customfields); } if (empty($product->slug)) { //Todo this should be redesigned to fit better for SEO $app->enqueueMessage(vmText::_('COM_VIRTUEMART_PRODUCT_NOT_FOUND')); $categoryLink = ''; if (!$last_category_id) { $last_category_id = vRequest::getInt('virtuemart_category_id', false); } if ($last_category_id) { $categoryLink = '&virtuemart_category_id=' . $last_category_id; } if (VmConfig::get('handle_404', 1)) { $app->redirect(JRoute::_('index.php?option=com_virtuemart&view=category' . $categoryLink . '&error=404', FALSE)); } else { JError::raise(E_ERROR, '404', 'Not found'); } return; } $isCustomVariant = false; if (!empty($product->customfields)) { foreach ($product->customfields as $k => $custom) { if ($custom->field_type == 'C' and $custom->virtuemart_product_id != $virtuemart_product_id) { $isCustomVariant = $custom; } if (!empty($custom->layout_pos)) { $product->customfieldsSorted[$custom->layout_pos][] = $custom; } else { $product->customfieldsSorted['normal'][] = $custom; } unset($product->customfields); } } $product->event = new stdClass(); $product->event->afterDisplayTitle = ''; $product->event->beforeDisplayContent = ''; $product->event->afterDisplayContent = ''; if (VmConfig::get('enable_content_plugin', 0)) { shopFunctionsF::triggerContentPlugin($product, 'productdetails', 'product_desc'); } $product_model->addImages($product); if (isset($product->min_order_level) && (int) $product->min_order_level > 0) { $this->min_order_level = $product->min_order_level; } else { $this->min_order_level = 1; } if (isset($product->step_order_level) && (int) $product->step_order_level > 0) { $this->step_order_level = $product->step_order_level; } else { $this->step_order_level = 1; } // Load the neighbours if (VmConfig::get('product_navigation', 1)) { $product->neighbours = $product_model->getNeighborProducts($product); } $this->assignRef('product', $product); if (VmConfig::get('show_manufacturers', 1) && !empty($this->product->virtuemart_manufacturer_id)) { $manModel = VmModel::getModel('manufacturer'); $mans = array(); // Gebe die Hersteller aus foreach ($this->product->virtuemart_manufacturer_id as $manufacturer_id) { $manufacturer = $manModel->getManufacturer($manufacturer_id); $manModel->addImages($manufacturer, 1); $mans[] = $manufacturer; } $this->product->manufacturers = $mans; } // Load the category $category_model = VmModel::getModel('category'); shopFunctionsF::setLastVisitedCategoryId($product->virtuemart_category_id); if ($category_model) { $category = $category_model->getCategory($product->virtuemart_category_id); $category_model->addImages($category, 1); $this->assignRef('category', $category); //Seems we dont need this anylonger, destroyed the breadcrumb if ($category->parents) { foreach ($category->parents as $c) { if (is_object($c) and isset($c->category_name)) { $pathway->addItem(strip_tags(vmText::_($c->category_name)), JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $c->virtuemart_category_id, FALSE)); } else { vmdebug('Error, parent category has no name, breadcrumb maybe broken, category', $c); } } } $category->children = $category_model->getChildCategoryList($product->virtuemart_vendor_id, $product->virtuemart_category_id); $category_model->addImages($category->children, 1); } $pathway->addItem(strip_tags(html_entity_decode($product->product_name, ENT_QUOTES))); if (!empty($tpl)) { $format = $tpl; } else { $format = vRequest::getCmd('format', 'html'); } if ($format == 'html') { // remove joomla canonical before adding it foreach ($document->_links as $k => $array) { if ($array['relation'] == 'canonical') { unset($document->_links[$k]); break; } } // Set Canonic link if ($isCustomVariant !== false and !empty($isCustomVariant->usecanonical) and !empty($product->product_parent_id)) { $parent = $product_model->getProduct($product->product_parent_id); $document->addHeadLink($parent->canonical, 'canonical', 'rel', ''); } else { $document->addHeadLink($product->canonical, 'canonical', 'rel', ''); } } else { if ($format == 'pdf') { defined('K_PATH_IMAGES') or define('K_PATH_IMAGES', VMPATH_ROOT); } } // Set the titles // $document->setTitle should be after the additem pathway if ($product->customtitle) { $document->setTitle(strip_tags(html_entity_decode($product->customtitle, ENT_QUOTES))); } else { $document->setTitle(strip_tags(html_entity_decode(($category->category_name ? vmText::_($category->category_name) . ' : ' : '') . $product->product_name, ENT_QUOTES))); } $this->allowReview = $ratingModel->allowReview($product->virtuemart_product_id); $this->showReview = $ratingModel->showReview($product->virtuemart_product_id); $this->rating_reviews = ''; if ($this->showReview) { $this->review = $ratingModel->getReviewByProduct($product->virtuemart_product_id); $this->rating_reviews = $ratingModel->getReviews($product->virtuemart_product_id); } if ($this->showRating) { $this->vote = $ratingModel->getVoteByProduct($product->virtuemart_product_id); } $this->allowRating = $ratingModel->allowRating($product->virtuemart_product_id); $superVendor = vmAccess::isSuperVendor(); if ($superVendor == 1 or $superVendor == $product->virtuemart_vendor_id or $superVendor) { $edit_link = JURI::root() . 'index.php?option=com_virtuemart&tmpl=component&manage=1&view=product&task=edit&virtuemart_product_id=' . $product->virtuemart_product_id; $this->edit_link = $this->linkIcon($edit_link, 'COM_VIRTUEMART_PRODUCT_FORM_EDIT_PRODUCT', 'edit', false, false); } else { $this->edit_link = ""; } // Load the user details $this->user = JFactory::getUser(); // More reviews link $uri = JURI::getInstance(); $uri->setVar('showall', 1); $uristring = vmURI::getCleanUrl(); $this->assignRef('more_reviews', $uristring); if ($product->metadesc) { $document->setDescription(strip_tags(html_entity_decode($product->metadesc, ENT_QUOTES))); } else { $document->setDescription(strip_tags(html_entity_decode($product->product_name, ENT_QUOTES)) . " " . $category->category_name . " " . strip_tags(html_entity_decode($product->product_s_desc, ENT_QUOTES))); } if ($product->metakey) { $document->setMetaData('keywords', $product->metakey); } if ($product->metarobot) { $document->setMetaData('robots', $product->metarobot); } if ($app->getCfg('MetaTitle') == '1') { $document->setMetaData('title', $product->product_name); //Maybe better product_name } if ($app->getCfg('MetaAuthor') == '1') { $document->setMetaData('author', $product->metaauthor); } $user = JFactory::getUser(); $showBasePrice = (vmAccess::manager() or vmAccess::isSuperVendor()); $this->assignRef('showBasePrice', $showBasePrice); $productDisplayShipments = array(); $productDisplayPayments = array(); if (!class_exists('vmPSPlugin')) { require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php'; } JPluginHelper::importPlugin('vmshipment'); JPluginHelper::importPlugin('vmpayment'); $dispatcher = JDispatcher::getInstance(); $returnValues = $dispatcher->trigger('plgVmOnProductDisplayShipment', array($product, &$productDisplayShipments)); $returnValues = $dispatcher->trigger('plgVmOnProductDisplayPayment', array($product, &$productDisplayPayments)); $this->assignRef('productDisplayPayments', $productDisplayPayments); $this->assignRef('productDisplayShipments', $productDisplayShipments); if (empty($category->category_template)) { $category->category_template = VmConfig::get('categorytemplate'); } shopFunctionsF::setVmTemplate($this, $category->category_template, $product->product_template, $category->category_product_layout, $product->layout); shopFunctionsF::addProductToRecent($virtuemart_product_id); $currency = CurrencyDisplay::getInstance(); $this->assignRef('currency', $currency); if (vRequest::getCmd('layout', 'default') == 'notify') { $this->setLayout('notify'); } //Added by Seyi Awofadeju to catch notify layout VmConfig::loadJLang('com_virtuemart'); vmJsApi::chosenDropDowns(); //This must be loaded after the customfields are rendered (they may need to overwrite the handlers) if (VmConfig::get('jdynupdate', TRUE) or $app->isAdmin()) { vmJsApi::jDynUpdate(); } if ($show_prices == '1') { if (!class_exists('calculationHelper')) { require VMPATH_ADMIN . DS . 'helpers' . DS . 'calculationh.php'; } vmJsApi::jPrice(); } parent::display($tpl); }
echo '<div class="checkoutStep" id="checkoutStep4">' . vmText::_('COM_VIRTUEMART_USER_FORM_CART_STEP4') . '</div>'; } ?> <div class="width50 floatleft vm-continue-shopping"> <?php // Continue Shopping Button if (!empty($this->continue_link_html)) { echo $this->continue_link_html; } ?> </div> <div class="clear"></div> </div> <?php $uri = vmURI::getCleanUrl(); $uri = str_replace('&tmpl=component', '', $uri); echo shopFunctionsF::getLoginForm($this->cart, FALSE, $uri); // This displays the form to change the current shopper if ($this->allowChangeShopper) { echo $this->loadTemplate('shopperform'); } $taskRoute = ''; ?> <form method="post" id="checkoutForm" name="checkoutForm" action="<?php echo JRoute::_('index.php?option=com_virtuemart&view=cart' . $taskRoute, $this->useXHTML, $this->useSSL); ?> "> <?php if (VmConfig::get('multixcart') == 'byselection') { if (!class_exists('ShopFunctions')) {
<?php // no direct access defined('_JEXEC') or die('Restricted access'); vmJsApi::jQuery(); //vmJsApi::chosenDropDowns(); $document = JFactory::getDocument(); $document->addScript(JURI::base().'templates/alpine/js/jquery.selectbox.js'); ?> <!-- Currency Selector Module --> <?php echo $text_before ?> <form action="<?php echo vmURI::getCleanUrl() ?>" method="post"> <?php echo JHTML::_('select.genericlist', $currencies, 'virtuemart_currency_id', 'class="inputbox vm-chzn-select" Onchange="this.form.submit()"', 'virtuemart_currency_id', 'currency_txt', $virtuemart_currency_id) ; ?> <noscript><input type="submit" value="Submit"></noscript> </form> <script type="text/javascript"> (function($){ $("#virtuemart_currency_id").selectbox(); })(jQuery); </script>