/** * Send the Recommend to a friend email. * * @author Kohl Patrick, */ public function mailRecommend () { JRequest::checkToken () or jexit ('Invalid Token'); // Display it all $view = $this->getView ('recommend', 'html'); if(!VmConfig::get('show_emailfriend',false)){ $view->display (); } if (!class_exists ('shopFunctionsF')) { require(JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php'); } if(!class_exists('ShopFunctions')) require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'shopfunctions.php'); $mainframe = JFactory::getApplication (); $vars = array(); $virtuemart_product_idArray = JRequest::getInt ('virtuemart_product_id', 0); if (is_array ($virtuemart_product_idArray)) { $virtuemart_product_id = (int)$virtuemart_product_idArray[0]; } else { $virtuemart_product_id = (int)$virtuemart_product_idArray; } $productModel = VmModel::getModel ('product'); $vars['product'] = $productModel->getProduct ($virtuemart_product_id); $user = JFactory::getUser (); $vars['user'] = array('name' => $user->name, 'email' => $user->email); $vars['vendorEmail'] = $user->email; $vendorModel = VmModel::getModel ('vendor'); $vendor = $vendorModel->getVendor ($vars['product']->virtuemart_vendor_id); $vendorModel->addImages ($vars['vendor']); $vendor->vendorFields = $vendorModel->getVendorAddressFields(); $vars['vendor'] = $vendor; $vars['vendorAddress']= shopFunctions::renderVendorAddress($vars['product']->virtuemart_vendor_id); $vars['vendorEmail']= $user->email; $vars['vendor']->vendor_name =$user->name; $toMail = JRequest::getVar ('email'); //is sanitized then $toMail = str_replace (array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $toMail); if (shopFunctionsF::renderMail ('recommend', $toMail, $vars, 'productdetails', TRUE)) { $string = 'COM_VIRTUEMART_MAIL_SEND_SUCCESSFULLY'; } else { $string = 'COM_VIRTUEMART_MAIL_NOT_SEND_SUCCESSFULLY'; } $mainframe->enqueueMessage (JText::_ ($string)); // vmdebug('my email vars ',$vars,$TOMail); $view->setLayout ('mail_confirmed'); $view->display (); }
/** * Notify customers product is back in stock * @author RolandD * @author Christopher Rouseel * @todo Add Itemid &Itemid='.$sess->getShopItemid() * @todo Do something if the mail cannot be send * @todo Update mail from * @todo Get the from name/email from the vendor */ public function notifyList($virtuemart_product_id) { if (!$virtuemart_product_id) { return false; } //sanitize id $virtuemart_product_id = (int) $virtuemart_product_id; if (!class_exists('shopFunctionsF')) { require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php'; } $vars = array(); $db = JFactory::getDBO(); $q = "SELECT * FROM #__virtuemart_waitingusers "; $q .= "WHERE notified = '0' AND virtuemart_product_id = " . $virtuemart_product_id; $db->setQuery($q); $waiting_users = $db->loadObjectList(); /* Load the product details */ $q = "SELECT product_name FROM `#__virtuemart_products_" . VMLANG . "` WHERE virtuemart_product_id = " . $virtuemart_product_id; $db->setQuery($q); $vars['productName'] = $db->loadResult(); /*TODO old URL here Now get the url information */ $vars['url'] = JURI::root() . 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $virtuemart_product_id; foreach ($waiting_users as $key => $waiting_user) { $vars['user'] = $waiting_user; if (shopFunctionsF::renderMail('productdetails', $waiting_user->notify_email, $vars)) { $db->setQuery('UPDATE #__virtuemart_waitingusers SET notified=1 WHERE virtuemart_waitinguser_id=' . $waiting_user->virtuemart_waitinguser_id); $db->query(); } } return true; }
/** * Displays the view, collects needed data for the different layouts * * Okey I try now a completly new idea. * We make a function for every tab and the display is getting the right tabs by an own function * putting that in an array and after that we call the preparedataforlayoutBlub * * @author Max Milbers */ function display($tpl = null) { $document = JFactory::getDocument(); $mainframe = JFactory::getApplication(); $pathway = $mainframe->getPathway(); $layoutName = $this->getLayout(); $model = VmModel::getModel(); $virtuemart_vendor_id = JRequest::getInt('virtuemart_vendor_id'); // if ($layoutName=='default') { if (empty($virtuemart_vendor_id)) { $document->setTitle(JText::_('COM_VIRTUEMART_VENDOR_LIST')); $pathway->addItem(JText::_('COM_VIRTUEMART_VENDOR_LIST')); $vendors = $model->getVendors(); $model->addImages($vendors); $this->assignRef('vendors', $vendors); } else { $vendor = $model->getVendor($virtuemart_vendor_id); $model->addImages($vendor); if (VmConfig::get('enable_content_plugin', 0)) { if (!class_exists('shopFunctionsF')) { require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php'; } shopFunctionsF::triggerContentPlugin($vendor, 'vendor', 'vendor_store_desc'); shopFunctionsF::triggerContentPlugin($vendor, 'vendor', 'vendor_terms_of_service'); } $this->assignRef('vendor', $vendor); if (!class_exists('VirtueMartModelVendor')) { require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php'; } $userId = VirtueMartModelVendor::getUserIdByVendorId($virtuemart_vendor_id); //$usermodel = VmModel::getModel('user'); //$virtuemart_userinfo_id = $usermodel->getBTuserinfo_id($userId); //$usermodel->getVendor($virtuemart_vendor_id); //$userFields = $usermodel->getUserInfoInUserFields($layoutName, 'BT', $virtuemart_userinfo_id,true,true); //$this->assignRef('userFields', $userFields); if ($layoutName == 'tos') { $document->setTitle(JText::_('COM_VIRTUEMART_VENDOR_TOS')); $pathway->addItem(JText::_('COM_VIRTUEMART_VENDOR_TOS')); } elseif ($layoutName == 'contact') { $user = JFactory::getUser(); $document->setTitle(JText::_('COM_VIRTUEMART_VENDOR_CONTACT')); $pathway->addItem(JText::_('COM_VIRTUEMART_VENDOR_CONTACT')); $this->assignRef('user', $user); } else { $document->setTitle(JText::_('COM_VIRTUEMART_VENDOR_DETAILS')); $pathway->addItem(JText::_('COM_VIRTUEMART_VENDOR_DETAILS')); $this->setLayout('details'); } $linkdetails = '<a href="' . JRoute::_('index.php?option=com_virtuemart&view=vendor&layout=details&virtuemart_vendor_id=' . $virtuemart_vendor_id, FALSE) . '">' . JText::_('COM_VIRTUEMART_VENDOR_DETAILS') . '</a>'; $linkcontact = '<a href="' . JRoute::_('index.php?option=com_virtuemart&view=vendor&layout=contact&virtuemart_vendor_id=' . $virtuemart_vendor_id, FALSE) . '">' . JText::_('COM_VIRTUEMART_VENDOR_CONTACT') . '</a>'; $linktos = '<a href="' . JRoute::_('index.php?option=com_virtuemart&view=vendor&layout=tos&virtuemart_vendor_id=' . $virtuemart_vendor_id, FALSE) . '">' . JText::_('COM_VIRTUEMART_VENDOR_TOS') . '</a>'; //$this->assignRef('lineSeparator', $lineSeparator); $this->assignRef('linkdetails', $linkdetails); $this->assignRef('linkcontact', $linkcontact); $this->assignRef('linktos', $linktos); } parent::display($tpl); }
/** * Send the ask question email. * @author Kohl Patrick, Christopher Roussel */ public function mailAskquestion() { vRequest::vmCheckToken(); if (!class_exists('shopFunctionsF')) { require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php'; } $model = tmsModel::getModel('vendor'); $mainframe = JFactory::getApplication(); $vars = array(); $min = tsmConfig::get('asks_minimum_comment_length', 50) + 1; $max = tsmConfig::get('asks_maximum_comment_length', 2000) - 1; $commentSize = vRequest::getString('comment'); if (function_exists('mb_strlen')) { $commentSize = mb_strlen($commentSize); } else { $commentSize = strlen($commentSize); } $validMail = filter_var(vRequest::getVar('email'), FILTER_VALIDATE_EMAIL); $virtuemart_vendor_id = vRequest::getInt('virtuemart_vendor_id', 1); if (!class_exists('VirtueMartModelVendor')) { require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php'; } $userId = VirtueMartModelVendor::getUserIdByVendorId($virtuemart_vendor_id); //$vendorUser = JFactory::getUser($userId); if ($commentSize < $min || $commentSize > $max || !$validMail) { $this->setRedirect(JRoute::_('index.php?option=com_virtuemart&view=vendor&task=contact&virtuemart_vendor_id=' . $virtuemart_vendor_id, FALSE), tsmText::_('COM_VIRTUEMART_COMMENT_NOT_VALID_JS')); return; } $user = JFactory::getUser(); $fromMail = vRequest::getVar('email'); //is sanitized then $fromName = vRequest::getVar('name', ''); //is sanitized then $fromMail = str_replace(array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $fromMail); $fromName = str_replace(array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $fromName); if (!empty($user->id)) { if (empty($fromMail)) { $fromMail = $user->email; } if (empty($fromName)) { $fromName = $user->name; } } $vars['user'] = array('name' => $fromName, 'email' => $fromMail); $VendorEmail = $model->getVendorEmail($virtuemart_vendor_id); $vars['vendor'] = array('vendor_store_name' => $fromName); if (shopFunctionsF::renderMail('vendor', $VendorEmail, $vars, 'vendor')) { $string = 'COM_VIRTUEMART_MAIL_SEND_SUCCESSFULLY'; } else { $string = 'COM_VIRTUEMART_MAIL_NOT_SEND_SUCCESSFULLY'; } $mainframe->enqueueMessage(tsmText::_($string)); // Display it all $view = $this->getView('vendor', 'html'); $view->setLayout('mail_confirmed'); $view->display(); }
/** * Function Description * * @author RolandD * @author George * @access public */ public function display($cachable = false, $urlparams = false) { if (JRequest::getvar('search')) { $view = $this->getView('category', 'html'); $view->display(); } else { // Display it all $safeurlparams = array('virtuemart_category_id' => 'INT', 'virtuemart_manufacturer_id' => 'INT', 'virtuemart_currency_id' => 'INT', 'return' => 'BASE64', 'lang' => 'CMD', 'orderby' => 'CMD', 'limitstart' => 'CMD', 'order' => 'CMD', 'limit' => 'CMD'); parent::display(true, $safeurlparams); } if ($categoryId = JRequest::getInt('virtuemart_category_id', 0)) { shopFunctionsF::setLastVisitedCategoryId($categoryId); } }
function display($tpl = null) { $document = JFactory::getDocument(); $mainframe = JFactory::getApplication(); $pathway = $mainframe->getPathway(); if (!class_exists('VmImage')) { require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php'; } $virtuemart_manufacturer_id = vRequest::getInt('virtuemart_manufacturer_id', 0); $mf_category_id = vRequest::getInt('mf_category_id', 0); // get necessary models $model = VmModel::getModel('manufacturer'); if ($virtuemart_manufacturer_id != 0) { $manufacturer = $model->getManufacturer(); $model->addImages($manufacturer, 1); $manufacturerImage = $manufacturer->images[0]->displayMediaThumb('class="manufacturer-image"', false); if (VmConfig::get('enable_content_plugin', 0)) { if (!class_exists('shopFunctionsF')) { require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php'; } shopFunctionsF::triggerContentPlugin($manufacturer, 'manufacturer', 'mf_desc'); } $document->setTitle(vmText::_('COM_VIRTUEMART_MANUFACTURER_DETAILS') . ' ' . strip_tags($manufacturer->mf_name)); //added so that the canonical points to page with visible products thx to P2Peter // remove joomla canonical before adding it foreach ($document->_links as $k => $array) { if ($array['relation'] == 'canonical') { unset($document->_links[$k]); break; } } $document->addHeadLink(JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_manufacturer_id=' . $virtuemart_manufacturer_id, FALSE), 'canonical', 'rel', ''); $this->assignRef('manufacturerImage', $manufacturerImage); $this->assignRef('manufacturer', $manufacturer); $pathway->addItem(strip_tags($manufacturer->mf_name)); $this->setLayout('details'); } else { $document->setTitle(vmText::_('COM_VIRTUEMART_MANUFACTURER_PAGE')); $manufacturers = $model->getManufacturers(true, true, true); $model->addImages($manufacturers, 1); $this->assignRef('manufacturers', $manufacturers); $this->setLayout('default'); } parent::display($tpl); }
public function display($tpl = null) { $document = JFactory::getDocument(); $layoutName = $this->getLayout(); if (!$layoutName) { $layoutName = JRequest::getWord('layout', 'default'); } $this->assignRef('layoutName', $layoutName); $format = JRequest::getWord('format'); if (!class_exists('VirtueMartCart')) { require JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php'; } $cart = VirtueMartCart::getCart(); $this->assignRef('cart', $cart); $this->prepareContinueLink(); shopFunctionsF::setVmTemplate($this, 0, 0, $layoutName); parent::display($tpl); }
public function prepareContinueLink() { $virtuemart_category_id = shopFunctionsF::getLastVisitedCategoryId(); $categoryStr = ''; if ($virtuemart_category_id) { $categoryStr = '&virtuemart_category_id=' . $virtuemart_category_id; } $ItemidStr = ''; $Itemid = shopFunctionsF::getLastVisitedItemId(); if (!empty($Itemid)) { $ItemidStr = '&Itemid=' . $Itemid; } $this->continue_link = JRoute::_('index.php?option=com_virtuemart&view=category' . $categoryStr . $ItemidStr, FALSE); //$this->continue_link_html = '<a class="continue_link" href="' . $continue_link . '" ><span>' . JText::_('COM_VIRTUEMART_CONTINUE_SHOPPING') . '</span></a>'; $this->continue_link_html = '<a class="continue continue_link" href="' . $this->continue_link . '">' . JText::_('COM_VIRTUEMART_CONTINUE_SHOPPING') . '</a>'; $this->cart_link = JRoute::_('index.php?option=com_virtuemart&view=cart' . $ItemidStr, FALSE); return; }
private function prepareContinueLink() { // Get a continue link $menuid = JRequest::getVar('Itemid', ''); if (!empty($menuid)) { $menuid = '&Itemid=' . $menuid; } $virtuemart_category_id = shopFunctionsF::getLastVisitedCategoryId(); $categoryLink = ''; if ($virtuemart_category_id) { $categoryLink = '&virtuemart_category_id=' . $virtuemart_category_id; } $continue_link = JRoute::_('index.php?option=com_virtuemart&view=category' . $categoryLink . $menuid, FALSE); $continue_link_html = '<a class="continue_link" href="' . $continue_link . '" ><span>' . JText::_('COM_VIRTUEMART_CONTINUE_SHOPPING') . '</span></a>'; $this->assignRef('continue_link_html', $continue_link_html); $this->assignRef('continue_link', $continue_link); $cart_link = JRoute::_('index.php?option=com_virtuemart&view=cart' . $menuid, FALSE); $this->assignRef('cart_link', $cart_link); }
/** * Function Description * * @author RolandD * @author George * @access public */ public function display($cachable = false, $urlparams = false) { if (JRequest::getvar('search')) { $view = $this->getView('category', 'html'); $view->display(); } else { // Display it all $document = JFactory::getDocument(); $viewType = $document->getType(); $viewName = JRequest::getCmd('view', $this->default_view); $viewLayout = JRequest::getCmd('layout', 'default'); $view = $this->getView($viewName, $viewType, '', array('base_path' => $this->basePath, 'layout' => $viewLayout)); $view->assignRef('document', $document); $view->display(); } if ($categoryId = JRequest::getInt('virtuemart_category_id', 0)) { shopFunctionsF::setLastVisitedCategoryId($categoryId); } return $this; }
static function InvoiceNumberReserved($invoice_number) { if (!class_exists('ShopFunctionsF')) { require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php'; } return shopFunctionsF::InvoiceNumberReserved($invoice_number); }
echo shopFunctionsF::getInvoiceDownloadButton($row); ?> </td> <td align="left"> <?php echo vmJsApi::date($row->created_on, 'LC4', true); ?> </td> <!--td align="left"> <?php //echo vmJsApi::date($row->modified_on,'LC3',true); ?> </td --> <td align="left"> <?php echo shopFunctionsF::getOrderStatusName($row->order_status); ?> </td> <td align="left"> <?php echo $this->currency->priceDisplay($row->order_total, $row->currency); ?> </td> </tr> <?php $k = 1 - $k; } ?> </table> </div> <?php
/** * Notify customers product is back in stock * * @author RolandD * @author Christopher Rouseel * @todo Add Itemid * @todo Do something if the mail cannot be send * @todo Update mail from * @todo Get the from name/email from the vendor */ public function notifyList($virtuemart_product_id, $subject = '', $mailbody = '', $max_number = 0) { if (!$virtuemart_product_id) { return FALSE; } //sanitize id $virtuemart_product_id = (int) $virtuemart_product_id; $max_number = (int) $max_number; if (!class_exists('shopFunctionsF')) { require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php'; } $vars = array(); $waitinglistModel = VmModel::getModel('waitinglist'); $waiting_users = $waitinglistModel->getWaitingusers($virtuemart_product_id); /* Load the product details */ $db = JFactory::getDbo(); $q = "SELECT l.product_name,product_in_stock FROM `#__virtuemart_products_" . VMLANG . "` l\r\n\t\t\t\tJOIN `#__virtuemart_products` p ON p.virtuemart_product_id=l.virtuemart_product_id\r\n\t\t\t WHERE p.virtuemart_product_id = " . $virtuemart_product_id; $db->setQuery($q); $item = $db->loadObject(); $vars['productName'] = $item->product_name; /* if ($item->product_in_stock <= 0) { return FALSE; } */ $url = JURI::root() . 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $virtuemart_product_id; $vars['link'] = '<a href="' . $url . '">' . $item->product_name . '</a>'; if (empty($subject)) { $subject = JText::sprintf('COM_VIRTUEMART_PRODUCT_WAITING_LIST_EMAIL_SUBJECT', $item->product_name); } $vars['subject'] = $subject; $vars['mailbody'] = $mailbody; $virtuemart_vendor_id = 1; $vendorModel = VmModel::getModel('vendor'); $vendor = $vendorModel->getVendor($virtuemart_vendor_id); $vendorModel->addImages($vendor); $vars['vendor'] = $vendor; $vars['vendorAddress'] = shopFunctions::renderVendorAddress($virtuemart_vendor_id); $vendorEmail = $vendorModel->getVendorEmail($virtuemart_vendor_id); $vars['vendorEmail'] = $vendorEmail; $i = 0; foreach ($waiting_users as $waiting_user) { $vars['user'] = $waiting_user->name; if (shopFunctionsF::renderMail('productdetails', $waiting_user->notify_email, $vars, 'productdetails')) { $db->setQuery('UPDATE #__virtuemart_waitingusers SET notified=1 WHERE virtuemart_waitinguser_id=' . $waiting_user->virtuemart_waitinguser_id); $db->query(); $i++; } if (!empty($max_number) && $i >= $max_number) { break; } } return TRUE; }
public function display($tpl = NULL) { $show_prices = VmConfig::get('show_prices', 1); if ($show_prices == '1') { if (!class_exists('calculationHelper')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php'; } } $doc = JFactory::getDocument(); if (!class_exists('VmImage')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php'; } $productModel = VmModel::getModel('product'); $categoryId = JRequest::getInt('virtuemart_category_id', false); $feed_show_prices = VmConfig::get('feed_cat_show_prices', 0); $feed_show_images = VmConfig::get('feed_cat_show_images', 0); $feed_show_description = VmConfig::get('feed_cat_show_description', 0); $feed_description_type = VmConfig::get('feed_cat_description_type', 'product_s_desc'); $feed_max_text_length = VmConfig::get('feed_cat_max_text_length', 0); // Load the products in the given category $products = $productModel->getProductsInCategory($categoryId); if ($feed_show_images == 1) { $productModel->addImages($products, 1); } if ($products && $feed_show_prices == 1) { $currency = CurrencyDisplay::getInstance(); } foreach ($products as $product) { $title = $this->escape($product->product_name); $title = html_entity_decode($title, ENT_COMPAT, 'UTF-8'); $description = ""; if ($feed_show_images == 1) { $effect = " "; $return = true; $withDescr = false; $absUrl = true; $description = $product->images[0]->displayMediaThumb('style="margin-right: 10px; margin-bottom: 10px; float: left;"', false, $effect, $return, $withDescr, $absUrl); } if ($feed_show_description == 1) { if ($feed_description_type == 'product_s_desc') { $description .= $product->product_s_desc; } else { if ($feed_max_text_length > 0) { $description .= shopFunctionsF::limitStringByWord($product->product_desc, $feed_max_text_length); } else { $description .= $product->product_desc; } } } if ($feed_show_prices == 1 and $show_prices == 1) { $description .= $currency->createPriceDiv('variantModification', 'COM_VIRTUEMART_PRODUCT_VARIANT_MOD', $product->prices); if (round($product->prices['basePriceWithTax'], $currency->_priceConfig['salesPrice'][1]) != $product->prices['salesPrice']) { $description .= '<span class="price-crossed" >' . $currency->createPriceDiv('basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $product->prices) . "</span>"; } if (round($product->prices['salesPriceWithDiscount'], $currency->_priceConfig['salesPrice'][1]) != $product->prices['salesPrice']) { $description .= $currency->createPriceDiv('salesPriceWithDiscount', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT', $product->prices); } $description .= $currency->createPriceDiv('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $product->prices); $description .= $currency->createPriceDiv('priceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $product->prices); $description .= $currency->createPriceDiv('discountAmount', 'COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT', $product->prices); $description .= $currency->createPriceDiv('taxAmount', 'COM_VIRTUEMART_PRODUCT_TAX_AMOUNT', $product->prices); $unitPriceDescription = JText::sprintf('COM_VIRTUEMART_PRODUCT_UNITPRICE', $product->product_unit); $description .= $currency->createPriceDiv('unitPrice', $unitPriceDescription, $product->prices); } if ($feed_description_type == 'product_s_desc' or $feed_max_text_length > 0) { $description .= '<p class="feed-readmore"><a target="_blank" href ="' . rtrim(JURI::base(), "/") . str_replace(' ', '%20', $product->link) . '">' . JText::_('COM_VIRTUEMART_FEED_READMORE') . '</a></p>'; } $item = new JFeedItem(); $item->title = $title; $item->link = $product->link; $item->date = $product->created_on; $item->description = '<div class="feed-description">' . $description . '</div>'; $item->category = $categoryId; $doc->addItem($item); } }
public function display($tpl = null) { $app = JFactory::getApplication(); $this->prepareContinueLink(); if (VmConfig::get('use_as_catalog', 0)) { vmInfo('This is a catalogue, you cannot access the cart'); $app->redirect($this->continue_link); } $pathway = $app->getPathway(); $document = JFactory::getDocument(); $document->setMetaData('robots', 'NOINDEX, NOFOLLOW, NOARCHIVE, NOSNIPPET'); $layoutName = $this->getLayout(); if (!$layoutName) { $layoutName = vRequest::getCmd('layout', 'default'); } $this->assignRef('layoutName', $layoutName); $format = vRequest::getCmd('format'); if (!class_exists('VirtueMartCart')) { require VMPATH_SITE . DS . 'helpers' . DS . 'cart.php'; } $this->cart = VirtueMartCart::getCart(); $this->cart->prepareVendor(); //Why is this here, when we have view.raw.php if ($format == 'raw') { vRequest::setVar('layout', 'mini_cart'); $this->setLayout('mini_cart'); $this->prepareContinueLink(); } if ($layoutName == 'select_shipment') { $this->cart->prepareCartData(); $this->lSelectShipment(); $pathway->addItem(vmText::_('COM_VIRTUEMART_CART_OVERVIEW'), JRoute::_('index.php?option=com_virtuemart&view=cart', FALSE)); $pathway->addItem(vmText::_('COM_VIRTUEMART_CART_SELECTSHIPMENT')); $document->setTitle(vmText::_('COM_VIRTUEMART_CART_SELECTSHIPMENT')); } else { if ($layoutName == 'select_payment') { $this->cart->prepareCartData(); $this->lSelectPayment(); $pathway->addItem(vmText::_('COM_VIRTUEMART_CART_OVERVIEW'), JRoute::_('index.php?option=com_virtuemart&view=cart', FALSE)); $pathway->addItem(vmText::_('COM_VIRTUEMART_CART_SELECTPAYMENT')); $document->setTitle(vmText::_('COM_VIRTUEMART_CART_SELECTPAYMENT')); } else { if ($layoutName == 'order_done') { VmConfig::loadJLang('com_virtuemart_shoppers', true); $this->lOrderDone(); $pathway->addItem(vmText::_('COM_VIRTUEMART_CART_THANKYOU')); $document->setTitle(vmText::_('COM_VIRTUEMART_CART_THANKYOU')); } else { VmConfig::loadJLang('com_virtuemart_shoppers', true); $this->renderCompleteAddressList(); if (!class_exists('VirtueMartModelUserfields')) { require VMPATH_ADMIN . DS . 'models' . DS . 'userfields.php'; } $userFieldsModel = VmModel::getModel('userfields'); $userFieldsCart = $userFieldsModel->getUserFields('cart', array('captcha' => true, 'delimiters' => true), array('delimiter_userinfo', 'user_is_vendor', 'username', 'password', 'password2', 'agreed', 'address_type')); $this->userFieldsCart = $userFieldsModel->getUserFieldsFilled($userFieldsCart, $this->cart->cartfields); if (!class_exists('CurrencyDisplay')) { require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php'; } $currencyDisplay = CurrencyDisplay::getInstance($this->cart->pricesCurrency); $this->assignRef('currencyDisplay', $currencyDisplay); $customfieldsModel = VmModel::getModel('Customfields'); $this->assignRef('customfieldsModel', $customfieldsModel); $this->lSelectCoupon(); $totalInPaymentCurrency = $this->getTotalInPaymentCurrency(); $checkoutAdvertise = $this->getCheckoutAdvertise(); if ($this->cart->getDataValidated()) { if ($this->cart->_inConfirm) { $pathway->addItem(vmText::_('COM_VIRTUEMART_CANCEL_CONFIRM_MNU')); $document->setTitle(vmText::_('COM_VIRTUEMART_CANCEL_CONFIRM_MNU')); $text = vmText::_('COM_VIRTUEMART_CANCEL_CONFIRM'); $this->checkout_task = 'cancel'; } else { $pathway->addItem(vmText::_('COM_VIRTUEMART_ORDER_CONFIRM_MNU')); $document->setTitle(vmText::_('COM_VIRTUEMART_ORDER_CONFIRM_MNU')); $text = vmText::_('COM_VIRTUEMART_ORDER_CONFIRM_MNU'); $this->checkout_task = 'confirm'; } } else { $pathway->addItem(vmText::_('COM_VIRTUEMART_CART_OVERVIEW')); $document->setTitle(vmText::_('COM_VIRTUEMART_CART_OVERVIEW')); $text = vmText::_('COM_VIRTUEMART_CHECKOUT_TITLE'); $this->checkout_task = 'checkout'; } $this->checkout_link_html = '<button type="submit" id="checkoutFormSubmit" name="' . $this->checkout_task . '" value="1" class="vm-button-correct" ><span>' . $text . '</span> </button>'; if (VmConfig::get('oncheckout_opc', 1)) { if (!class_exists('vmPSPlugin')) { require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php'; } JPluginHelper::importPlugin('vmshipment'); JPluginHelper::importPlugin('vmpayment'); $this->lSelectShipment(); $this->lSelectPayment(); } else { $this->checkPaymentMethodsConfigured(); $this->checkShipmentMethodsConfigured(); } if ($this->cart->virtuemart_shipmentmethod_id) { $shippingText = vmText::_('COM_VIRTUEMART_CART_CHANGE_SHIPPING'); } else { $shippingText = vmText::_('COM_VIRTUEMART_CART_EDIT_SHIPPING'); } $this->assignRef('select_shipment_text', $shippingText); if ($this->cart->virtuemart_paymentmethod_id) { $paymentText = vmText::_('COM_VIRTUEMART_CART_CHANGE_PAYMENT'); } else { $paymentText = vmText::_('COM_VIRTUEMART_CART_EDIT_PAYMENT'); } $this->assignRef('select_payment_text', $paymentText); $this->cart->prepareAddressFieldsInCart(); $layoutName = $this->cart->layout; //set order language $lang = JFactory::getLanguage(); $order_language = $lang->getTag(); $this->assignRef('order_language', $order_language); } } } $this->useSSL = VmConfig::get('useSSL', 0); $this->useXHTML = false; $this->assignRef('totalInPaymentCurrency', $totalInPaymentCurrency); $this->assignRef('checkoutAdvertise', $checkoutAdvertise); shopFunctionsF::setVmTemplate($this, 0, 0, $layoutName); //We never want that the cart is indexed $document->setMetaData('robots', 'NOINDEX, NOFOLLOW, NOARCHIVE, NOSNIPPET'); if ($this->cart->_inConfirm) { vmInfo('COM_VIRTUEMART_IN_CONFIRM'); } if ($this->cart->layoutPath) { $this->addTemplatePath($this->cart->layoutPath); } $current = JFactory::getUser(); $this->allowChangeShopper = false; if (VmConfig::get('oncheckout_change_shopper')) { if ($current->authorise('core.admin', 'com_virtuemart') or $current->authorise('vm.user', 'com_virtuemart')) { $this->allowChangeShopper = true; } else { $adminID = JFactory::getSession()->get('vmAdminID', false); if ($adminID) { $adminIdUser = JFactory::getUser($adminID); if ($adminIdUser->authorise('core.admin', 'com_virtuemart') or $adminIdUser->authorise('vm.user', 'com_virtuemart')) { $this->allowChangeShopper = true; } } } } parent::display($tpl); }
if (!class_exists('VirtueMartCart')) { require VMPATH_SITE . DS . 'helpers' . DS . 'cart.php'; } $this->cart = VirtueMartCart::getCart(); $url = 0; if ($this->cart->_fromCart or $this->cart->getInCheckOut()) { $rview = 'cart'; } else { $rview = 'user'; } $task = ''; if ($this->cart->getInCheckOut()) { //$task = '&task=checkout'; } $url = JRoute::_('index.php?option=com_virtuemart&view=' . $rview . $task, $this->useXHTML, $this->useSSL); echo shopFunctionsF::getLoginForm(TRUE, FALSE, $url); $this->vmValidator(); ?> <form method="post" id="userForm" name="userForm" class="form-validate" action="<?php echo JRoute::_('index.php?option=com_virtuemart&view=user', $this->useXHTML, $this->useSSL); ?> " > <fieldset> <h2><?php if ($this->address_type == 'BT') { echo vmText::_('COM_VIRTUEMART_USER_FORM_EDIT_BILLTO_LBL'); } else { echo vmText::_('COM_VIRTUEMART_USER_FORM_ADD_SHIPTO_LBL'); } ?>
?> <tr> <td class="key"><strong><?php echo vmText::_('COM_VIRTUEMART_COUPON_CODE'); ?> </strong></td> <td><?php echo $this->orderbt->coupon_code; ?> </td> </tr> <?php } ?> <?php if ($this->orderbt->invoiceNumber and !shopFunctionsF::InvoiceNumberReserved($this->orderbt->invoiceNumber)) { $invoice_url = juri::root() . 'index.php?option=com_virtuemart&view=invoice&layout=invoice&format=pdf&tmpl=component&virtuemart_order_id=' . $this->orderbt->virtuemart_order_id . '&order_number=' . $this->orderbt->order_number . '&order_pass='******'COM_VIRTUEMART_INVOICE_PRINT') . "\" href=\"javascript:void window.open('{$invoice_url}', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');\" >"; $invoice_link .= $this->orderbt->invoiceNumber . '</a>'; ?> <tr> <td class="key"><strong><?php echo vmText::_('COM_VIRTUEMART_INVOICE'); ?> </strong></td> <td><?php echo $invoice_link; ?> </td> </tr> <?php
echo $currency->createPriceDiv('salesPrice', JText::_("Price: "), $price, false, false, 1.0, true); } if (!empty($item->prices['salesPriceWithDiscount'])) { echo $currency->createPriceDiv('salesPriceWithDiscount', JText::_("Price: "), $price, false, false, 1.0, true); } echo '</div>'; echo '</div>'; } ?> <?php if ($params->get('item_addtocart_display', 1)) { $_item['product'] = $item; ?> <div class="item-addtocart"> <?php echo shopFunctionsF::renderVmSubLayout('addtocart', $_item); ?> </div> <?php } ?> <div class="content-date-read"> <?php if ((int) $params->get('item_description_display', 1) && VMListingTabsHelper::_trimEncode($item->_description) != '') { ?> <div class="item-desc"> <?php echo $item->_description; ?> </div> <?php
} } $position = 'addtocart'; ?> <div class="addtocart-area"> <form method="post" class="product js-recalculate" action="<?php echo JRoute::_('index.php?option=com_virtuemart', false); ?> "> <?php if (!empty($rowHeights['customfields'])) { echo shopFunctionsF::renderVmSubLayout('customfields', array('product' => $product, 'position' => 'addtocart')); } if (!VmConfig::get('use_as_catalog', 0)) { echo shopFunctionsF::renderVmSubLayout('addtocartbar', array('product' => $product)); } ?> <input type="hidden" name="option" value="com_virtuemart"/> <input type="hidden" name="view" value="cart"/> <input type="hidden" name="virtuemart_product_id[]" value="<?php echo $product->virtuemart_product_id; ?> "/> <input type="hidden" class="pname" value="<?php echo $product->product_name; ?> "/> <?php $itemId = vRequest::getInt('Itemid', false); if ($itemId) {
} $step = 1; if (!empty($product->step_order_level)) { $step = $product->step_order_level; if (empty($product->min_order_level) and !isset($viewData['init'])) { $init = $step; } } $maxOrder = ''; if (!empty($product->max_order_level)) { $maxOrder = ' max="' . $product->max_order_level . '" '; } $addtoCartButton = ''; if (!VmConfig::get('use_as_catalog', 0)) { if (!$product->addToCartButton and $product->addToCartButton !== '') { $addtoCartButton = shopFunctionsF::getAddToCartButton($product->orderable); } else { $addtoCartButton = $product->addToCartButton; } } $position = 'addtocart'; //if (!empty($product->customfieldsSorted[$position]) or !empty($addtoCartButton)) { if (!VmConfig::get('use_as_catalog', 0)) { ?> <div class="addtocart-bar"> <?php // Display the quantity box $stockhandle = VmConfig::get('stockhandle', 'none'); if (($stockhandle == 'disableit' or $stockhandle == 'disableadd') and $product->product_in_stock - $product->product_ordered < 1) { ?>
/** * Notifies the customer that the Order Status has been changed * * @author RolandD, Christopher Roussel, Valérie Isaksen, Max Milbers * */ private function notifyCustomer($virtuemart_order_id, $newOrderData = 0) { // vmdebug('notifyCustomer', $newOrderData); if (isset($newOrderData['customer_notified']) && $newOrderData['customer_notified'] == 0) { return true; } if (!class_exists('shopFunctionsF')) { require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php'; } //Important, the data of the order update mails, payments and invoice should //always be in the database, so using getOrder is the right method $orderModel = VmModel::getModel('orders'); $order = $orderModel->getOrder($virtuemart_order_id); $payment_name = $shipment_name = ''; if (!class_exists('vmPSPlugin')) { require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php'; } JPluginHelper::importPlugin('vmshipment'); JPluginHelper::importPlugin('vmpayment'); $dispatcher = JDispatcher::getInstance(); $returnValues = $dispatcher->trigger('plgVmOnShowOrderFEShipment', array($order['details']['BT']->virtuemart_order_id, $order['details']['BT']->virtuemart_shipmentmethod_id, &$shipment_name)); $returnValues = $dispatcher->trigger('plgVmOnShowOrderFEPayment', array($order['details']['BT']->virtuemart_order_id, $order['details']['BT']->virtuemart_paymentmethod_id, &$payment_name)); $order['shipmentName'] = $shipment_name; $order['paymentName'] = $payment_name; if ($newOrderData != 0) { //We do not really need that $vars['newOrderData'] = (array) $newOrderData; } $vars['orderDetails'] = $order; //$vars['includeComments'] = JRequest::getVar('customer_notified', array()); //I think this is misleading, I think it should always ask for example $vars['newOrderData']['doVendor'] directly //Using this function garantue us that it is always there. If the vendor should be informed should be done by the plugins //We may add later something to the method, defining this better $vars['url'] = 'url'; if (!isset($vars['doVendor'])) { if (!isset($newOrderData['doVendor'])) { $vars['doVendor'] = false; } else { $vars['doVendor'] = $newOrderData['doVendor']; } } $virtuemart_vendor_id = 1; $vendorModel = VmModel::getModel('vendor'); $vendor = $vendorModel->getVendor($virtuemart_vendor_id); $vars['vendor'] = $vendor; $vendorEmail = $vendorModel->getVendorEmail($virtuemart_vendor_id); $vars['vendorEmail'] = $vendorEmail; /* $path = VmConfig::get('forSale_path',0); $orderstatusForInvoice = VmConfig::get('inv_os','C'); $pdfInvoice = VmConfig::get('pdf_invoice', 1); // backwards compatible */ // florian : added if pdf invoice are enabled //if ($this->getInvoiceNumber( $order['details']['BT']->virtuemart_order_id ) ){ $invoiceNumberDate = array(); if ($orderModel->createInvoiceNumber($order['details']['BT'], $invoiceNumberDate)) { $orderstatusForInvoice = VmConfig::get('inv_os', array()); if (!is_array($orderstatusForInvoice)) { $orderstatusForInvoice = array($orderstatusForInvoice); } // for backward compatibility 2.0.8e $pdfInvoice = (int) VmConfig::get('pdf_invoice', 0); // backwards compatible $force_create_invoice = JRequest::getInt('create_invoice', 0); //TODO we need an array of orderstatus if (in_array($order['details']['BT']->order_status, $orderstatusForInvoice) or $pdfInvoice == 1 or $force_create_invoice == 1) { if (!shopFunctions::InvoiceNumberReserved($invoiceNumberDate[0])) { if (!class_exists('VirtueMartControllerInvoice')) { require_once JPATH_VM_SITE . DS . 'controllers' . DS . 'invoice.php'; } $controller = new VirtueMartControllerInvoice(array('model_path' => JPATH_VM_SITE . DS . 'models', 'view_path' => JPATH_VM_SITE . DS . 'views')); $vars['mediaToSend'][] = $controller->checkStoreInvoice($order); } } } // Send the email if (shopFunctionsF::renderMail('invoice', $order['details']['BT']->email, $vars, null, $vars['doVendor'])) { $string = 'COM_VIRTUEMART_NOTIFY_CUSTOMER_SEND_MSG'; } else { $string = 'COM_VIRTUEMART_NOTIFY_CUSTOMER_ERR_SEND'; } vmInfo(JText::_($string, false) . ' ' . $order['details']['BT']->first_name . ' ' . $order['details']['BT']->last_name . ', ' . $order['details']['BT']->email); return true; }
/** * Collect all data to show on the template * * @author Max Milbers */ function display($tpl = NULL) { $app = JFactory::getApplication(); if (!VmConfig::get('ask_question', false) and !VmConfig::get('askprice', false)) { $app->redirect(JRoute::_('index.php?option=com_virtuemart', 'Disabled function')); } $this->login = ''; if (!VmConfig::get('recommend_unauth', false)) { $user = JFactory::getUser(); if ($user->guest) { $this->login = shopFunctionsF::getLoginForm(false); //$app->redirect(JRoute::_('index.php?option=com_virtuemart','JGLOBAL_YOU_MUST_LOGIN_FIRST')); } } $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(); $mainframe = JFactory::getApplication(); $pathway = $mainframe->getPathway(); $task = vRequest::getCmd('task'); if (!class_exists('VmImage')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php'; } // Load the product $product_model = VmModel::getModel('product'); $category_model = VmModel::getModel('Category'); $virtuemart_product_idArray = vRequest::getInt('virtuemart_product_id', 0); if (is_array($virtuemart_product_idArray)) { $virtuemart_product_id = $virtuemart_product_idArray[0]; } else { $virtuemart_product_id = $virtuemart_product_idArray; } if (empty($virtuemart_product_id)) { self::showLastCategory($tpl); return; } if (!class_exists('VirtueMartModelVendor')) { require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php'; } $product = $product_model->getProduct($virtuemart_product_id); // Set Canonic link $format = vRequest::getCmd('format', 'html'); if ($format == 'html') { $document->addHeadLink($product->canonical, 'canonical', 'rel', ''); } // Set the titles $document->setTitle(vmText::sprintf('COM_VIRTUEMART_PRODUCT_DETAILS_TITLE', $product->product_name . ' - ' . vmText::_('COM_VIRTUEMART_PRODUCT_ASK_QUESTION'))); $this->assignRef('product', $product); if (empty($product)) { self::showLastCategory($tpl); return; } $product_model->addImages($product, 1); /* Get the category ID */ $virtuemart_category_id = vRequest::getInt('virtuemart_category_id'); if ($virtuemart_category_id == 0 && !empty($product)) { if (array_key_exists('0', $product->categories)) { $virtuemart_category_id = $product->categories[0]; } } shopFunctionsF::setLastVisitedCategoryId($virtuemart_category_id); if ($category_model) { $category = $category_model->getCategory($virtuemart_category_id); $this->assignRef('category', $category); $pathway->addItem($category->category_name, JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $virtuemart_category_id, FALSE)); } //$pathway->addItem(vmText::_('COM_VIRTUEMART_PRODUCT_DETAILS'), $uri->toString(array('path', 'query', 'fragment'))); $pathway->addItem($product->product_name, JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $product->virtuemart_product_id, FALSE)); // for askquestion $pathway->addItem(vmText::_('COM_VIRTUEMART_PRODUCT_ASK_QUESTION')); $this->user = JFactory::getUser(); if ($product->metadesc) { $document->setDescription($product->metadesc); } if ($product->metakey) { $document->setMetaData('keywords', $product->metakey); } //We never want that ask a question is indexed $document->setMetaData('robots', 'NOINDEX, NOFOLLOW, NOARCHIVE, NOSNIPPET'); if ($mainframe->getCfg('MetaTitle') == '1') { $document->setMetaData('title', $product->product_s_desc); //Maybe better product_name } if ($mainframe->getCfg('MetaAuthor') == '1') { $document->setMetaData('author', $product->metaauthor); } parent::display($tpl); }
private function showLastCategory($tpl) { $virtuemart_category_id = shopFunctionsF::getLastVisitedCategoryId(); $categoryLink = ''; if ($virtuemart_category_id) { $categoryLink = '&virtuemart_category_id=' . $virtuemart_category_id; } $continue_link = JRoute::_('index.php?option=com_virtuemart&view=category' . $categoryLink, FALSE); $continue_link_html = '<a href="' . $continue_link . '" />' . JText::_('COM_VIRTUEMART_CONTINUE_SHOPPING') . '</a>'; $this->assignRef('continue_link_html', $continue_link_html); // Display it all parent::display($tpl); }
/** * This uses the shopFunctionsF::renderAndSendVmMail function, which uses a controller and task to render the content * and sents it then. * * * @author Oscar van Eijk * @author Max Milbers * @author Christopher Roussel * @author Valérie Isaksen */ private function sendRegistrationEmail($user, $password, $doUserActivation) { if (!class_exists('shopFunctionsF')) { require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php'; } $vars = array('user' => $user); // Send registration confirmation mail $password = preg_replace('/[\\x00-\\x1F\\x7F]/', '', $password); //Disallow control chars in the email $vars['password'] = $password; if ($doUserActivation) { jimport('joomla.user.helper'); $activationLink = 'index.php?option=com_users&task=registration.activate&token=' . $user->get('activation'); $vars['activationLink'] = $activationLink; } $vars['doVendor'] = true; // public function renderMail ($viewName, $recipient, $vars=array(),$controllerName = null) shopFunctionsF::renderMail('user', $user->get('email'), $vars); }
/** * This uses the shopFunctionsF::renderAndSendVmMail function, which uses a controller and task to render the content * and sents it then. * * * @author Oscar van Eijk * @author Max Milbers * @author Christopher Roussel * @author Valérie Isaksen */ private function sendRegistrationEmail($user, $password, $doUserActivation) { if (!class_exists('shopFunctionsF')) { require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php'; } $vars = array('user' => $user); // Send registration confirmation mail $password = preg_replace('/[\\x00-\\x1F\\x7F]/', '', $password); //Disallow control chars in the email $vars['password'] = $password; if ($doUserActivation) { jimport('joomla.user.helper'); $activationLink = 'index.php?option=com_users&task=registration.activate&token=' . $user->get('activation'); $vars['activationLink'] = $activationLink; } $vars['doVendor'] = true; // public function renderMail ($viewName, $recipient, $vars=array(),$controllerName = null) shopFunctionsF::renderMail('user', $user->get('email'), $vars); //get all super administrator //if(!defined('JVM_VERSION') or JVM_VERSION < 3){ $query = 'SELECT name, email, sendEmail' . ' FROM #__users' . ' WHERE sendEmail = 1'; /*} else { $query = 'SELECT `name`, `email`, `sendEmail` ' . ' FROM #__users as us '. ' INNER JOIN #__user_usergroup_map as um ON us.id = um.user_id ' . ' INNER JOIN #__usergroups as ug ON um.group_id = ug.id ' . ' WHERE ug.id = "8" '; }*/ $db = JFactory::getDBO(); $db->setQuery($query); $rows = $db->loadObjectList(); $vars['doVendor'] = false; // get superadministrators id foreach ($rows as $row) { if ($row->sendEmail) { //$message2 = sprintf ( vmText::_( 'COM_VIRTUEMART_SEND_MSG_ADMIN' ), $row->name, $sitename, $name, $email, $username); //$message2 = html_entity_decode($message2, ENT_QUOTES); //JUtility::sendMail($mailfrom, $fromname, $row->email, $subject2, $message2); //shopFunctionsF::renderMail('user', $row->email, $vars); } } }
public function __construct() { // Load the vendor, so we have the data for the header/footer... // The images are NOT loaded by default, so do it manually, just in case $vendorModel = VmModel::getModel('vendor'); $this->vendor = $vendorModel->getVendor($this->virtuemart_vendor_id); $vendorModel->addImages($this->vendor, 1); $this->vendor->vendorFields = $vendorModel->getVendorAddressFields($this->virtuemart_vendor_id); parent::__construct($this->vendor->vendor_letter_orientation, 'mm', $this->vendor->vendor_letter_format); $this->css = $this->vendor->vendor_letter_css; // set document information $this->SetCreator(vmText::_('COM_VIRTUEMART_PDF_CREATOR')); if (empty($this->vendor->images[0])) { vmError('Vendor image given path empty '); } else { if (empty($this->vendor->images[0]->file_url_folder) or empty($this->vendor->images[0]->file_name) or empty($this->vendor->images[0]->file_extension)) { vmError('Vendor image given image is not complete ' . $this->vendor->images[0]->file_url_folder . $this->vendor->images[0]->file_name . '.' . $this->vendor->images[0]->file_extension); } else { if (!empty($this->vendor->images[0]->file_extension) and strtolower($this->vendor->images[0]->file_extension) == 'png') { vmError('Warning extension of the image is a png, tpcdf has problems with that in the header, choose a jpg or gif'); } else { $imagePath = str_replace('/', DS, $this->vendor->images[0]->file_url_folder . $this->vendor->images[0]->file_name . '.' . $this->vendor->images[0]->file_extension); if (!file_exists(VMPATH_ROOT . DS . $imagePath)) { vmError('Vendor image missing ' . $imagePath); } else { $this->vendorImage = $imagePath; } } } } // Generate PDF header if (!class_exists('JFile')) { require VMPATH_LIBS . DS . 'joomla' . DS . 'filesystem' . DS . 'file.php'; } $this->tcpdf6 = JFile::exists(VMPATH_LIBS . DS . 'tcpdf' . DS . 'include' . DS . 'tcpdf_colors.php'); if ($this->tcpdf6) { $this->tcpdf6 = method_exists('TCPDF', 'getAllSpotColors'); } if ($this->tcpdf6) { $getAllSpotColors = TCPDF::getAllSpotColors(); $vlfooterlcolor = TCPDF_COLORS::convertHTMLColorToDec($this->vendor->vendor_letter_footer_line_color, $getAllSpotColors); } else { $vlfooterlcolor = $this->convertHTMLColorToDec($this->vendor->vendor_letter_footer_line_color); } $this->setHeaderData($this->vendor->vendor_letter_header_image ? $this->vendorImage : '', $this->vendor->vendor_letter_header_image ? $this->vendor->vendor_letter_header_imagesize : 0, '', $this->vendor->vendor_letter_header_html, array(0, 0, 0), $vlfooterlcolor); $this->vendorAddress = shopFunctionsF::renderVendorAddress($this->vendor->virtuemart_vendor_id, "<br/>"); // Trim the final <br/> from the address, which is inserted by renderVendorAddress automatically! if (substr($this->vendorAddress, -5, 5) == '<br/>') { $this->vendorAddress = substr($this->vendorAddress, 0, -5); } $vmFont = $this->vendor->vendor_letter_font; $this->SetFont($vmFont, '', $this->vendor->vendor_letter_font_size, '', 'false'); $this->setHeaderFont(array($vmFont, '', $this->vendor->vendor_letter_header_font_size)); $this->setFooterFont(array($vmFont, '', $this->vendor->vendor_letter_footer_font_size)); // Remove all vertical margins and padding from the HTML cells (default is excessive padding): $this->SetCellPadding(0); $tagvs = array('p' => array(0 => array('h' => 0, 'n' => 0), 1 => array('h' => 0, 'n' => 0)), 'div' => array(0 => array('h' => 0, 'n' => 0), 1 => array('h' => 0, 'n' => 0)), 'h1' => array(0 => array('h' => 0, 'n' => 0), 1 => array('h' => 0, 'n' => 0)), 'h2' => array(0 => array('h' => 0, 'n' => 0), 1 => array('h' => 0, 'n' => 0)), 'h3' => array(0 => array('h' => 0, 'n' => 0), 1 => array('h' => 0, 'n' => 0)), 'table' => array(0 => array('h' => 0, 'n' => 0), 1 => array('h' => 0, 'n' => 0))); $this->setHtmlVSpace($tagvs); // set default font subsetting mode $this->setFontSubsetting(true); // set default monospaced font // $this->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //set margins $this->SetMargins($this->vendor->vendor_letter_margin_left, $this->vendor->vendor_letter_margin_top, $this->vendor->vendor_letter_margin_right); $this->SetHeaderMargin($this->vendor->vendor_letter_margin_header); $this->SetFooterMargin($this->vendor->vendor_letter_margin_footer); $this->SetAutoPageBreak(TRUE, $this->vendor->vendor_letter_margin_bottom); //set image scale factor $this->setImageScale(PDF_IMAGE_SCALE_RATIO); //TODO include the right file (in libraries/tcpdf/config/lang set some language-dependent strings $l = ''; $this->setLanguageArray($l); }
static function addtocart($product) { echo shopFunctionsF::renderVmSubLayout('addtocart', array('product' => $product)); }
// Check to ensure this file is included in Joomla! defined('_JEXEC') or die('Restricted access'); //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[
} } ?> "/> </span> <span class="quantity-controls js-recalculate"> <input type="button" class="quantity-controls quantity-plus" /> <input type="button" class="quantity-controls quantity-minus" /> </span> <?php // Display the quantity box END // Display the add to cart button ?> <span class="addtocart-button"> <?php echo shopFunctionsF::getAddToCartButton($this->product->orderable); // Display the add to cart button END ?> </span> <noscript><input type="hidden" name="task" value="add"/></noscript> <?php } ?> <?php } ?> <div class="clear"></div> </div> <?php }
</div> <div class="clear"></div> </div> <!-- end of orderby-displaynumber --> <!--<h1><?php //echo $this->category->category_name; ?> </h1>--> <?php if (!empty($this->products)) { $products = array(); $products[0] = $this->products; echo shopFunctionsF::renderVmSubLayout($this->productsLayout, array('products' => $products, 'currency' => $this->currency, 'products_per_row' => $this->perRow, 'showRating' => $this->showRating)); ?> <div class="orderby-displaynumber bottom"> <div class="vm-view-list col-md-2 col-sm-3 col-xs-12"> <div class="icon-list-grid"> <div class="vm-view vm-grid active" data-view="vm-grid"><i class="listing-icon"></i></div> <div class="vm-view vm-list" data-view="vm-list"><i class="listing-icon"></i></div> </div> </div> <div class="toolbar-center col-md-6 col-sm-5 col-xs-12"> <div class="vm-order-list"> <?php echo $this->orderByList['orderby']; ?>