public static function number($number, $options = '') { static $default_currency = null; $config = TiendaConfig::getInstance(); $options = (array) $options; if (!$default_currency) { JModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/models'); $model = JModel::getInstance('Currencies', 'TiendaModel'); $model->SetId(TiendaConfig::getInstance()->get('default_currencyid', '1')); $default_currency = $model->getItem(); } $thousands = isset($options['thousands']) ? $options['thousands'] : $default_currency->thousands_separator; $decimal = isset($options['decimal']) ? $options['decimal'] : $default_currency->decimal_separator; $num_decimals = isset($options['num_decimals']) ? $options['num_decimals'] : $default_currency->currency_decimals; $return = number_format($number, $num_decimals, $decimal, $thousands); return $return; }
/** * Method to send a notice about low quantity of a product in the stock * * @param string productquantity_id * @return boolean */ function sendEmailLowQuanty($productquantity_id) { $mainframe = JFactory::getApplication(); $recipients = array(); $done = array(); $lang = JFactory::getLanguage(); $lang->load('com_tienda', JPATH_ADMINISTRATOR); $system_recipients = $this->getSystemEmailRecipients(); foreach ($system_recipients as $r) { if (!in_array($r->email, $recipients)) { $recipients[] = $r->email; } } $config = TiendaConfig::getInstance(); $fromname = $config->get('shop_name', 'SHOP'); $mailfrom = $config->get('shop_email', ''); if (!strlen($mailfrom)) { $mailfrom = $mainframe->getCfg('mailfrom'); } $vendor_name = $config->get('shop_owner_name', 'Admin'); $ProductQuantities_model = JTable::getInstance('ProductQuantities', 'TiendaTable'); $ProductQuantities_model->load(array('productquantity_id' => $productquantity_id)); $quantity = $ProductQuantities_model->quantity; $product_id = $ProductQuantities_model->product_id; $product_attributes_csv = $ProductQuantities_model->product_attributes; if (!empty($product_attributes_csv)) { $productattributeoption_id_array = explode(',', $product_attributes_csv); } else { $productattributeoption_id_array = NULL; } $productsTable = JTable::getInstance('Products', 'TiendaTable'); $productsTable->load($product_id, true, false); $product_name = $productsTable->product_name; $subject = "[" . $config->get('shop_name', 'SHOP') . " - " . JText::sprintf('COM_TIENDA_LOW_STOCK_MAIL_SUBJECT_NAME_AND_ID', $product_name, $product_id) . "]"; // set the email body $text = JText::sprintf('COM_TIENDA_EMAIL_DEAR', $vendor_name) . ",\n\n"; $text .= JText::sprintf("COM_TIENDA_LOW_STOCK_MAIL_PRODUCT_NAME_AND_ID", $product_name, $product_id) . "\n"; if (!empty($productattributeoption_id_array)) { foreach ($productattributeoption_id_array as $productattributeoption_id) { $productattributeoptionsTable = JTable::getInstance('Productattributeoptions', 'TiendaTable'); $productattributeoptionsTable->load($productattributeoption_id); $productattribute_id = $productattributeoptionsTable->productattribute_id; $productattributeoption_name = $productattributeoptionsTable->productattributeoption_name; $productattributesTable = JTable::getInstance('Productattributes', 'TiendaTable'); $productattributesTable->load($productattribute_id); $productattribute_name = $productattributesTable->productattribute_name; $text .= JText::sprintf("COM_TIENDA_LOW_STOCK_MAIL_OPTION_DETAILS", $productattribute_name, $productattributeoption_name) . "\n"; } } $text .= "\n------------------------------------------------------------------------------------------\n"; $text .= JText::sprintf("COM_TIENDA_LOW_STOCK_MAIL_ITEMS_AVAILABLE", $quantity) . "\n"; $text .= "------------------------------------------------------------------------------------------"; $text .= "\n\n"; if ($this->use_html) { $text = nl2br($text); } $success = false; for ($i = 0; $i < count($recipients); $i++) { $recipient = $recipients[$i]; if (!isset($done[$recipient])) { if ($send = $this->_sendMail($mailfrom, $fromname, $recipient, $subject, $text)) { $success = true; $done[$recipient] = $recipient; } } } return $success; }
<?php defined('_JEXEC') or die('Restricted access'); JHTML::_('script', 'tienda.js', 'media/com_tienda/js/'); JHTML::_('stylesheet', 'tienda.css', 'media/com_tienda/css/'); $row = @$this->address; JFilterOutput::objectHTMLSafe($row); $config = TiendaConfig::getInstance(); ?> <form action="<?php echo JRoute::_('index.php?option=com_tienda&view=pos&tmpl=component'); ?> " method="post" class="adminForm" name="adminForm" > <fieldset> <div class="header icon-48-tienda" style="float: left;"> <?php if ($row->address_id) { ?> <?php echo JText::_('EDIT ADDRESS') . ": " . $row->address_name; ?> <?php } else { ?> <?php echo JText::_('NEW ADDRESS'); ?> <?php
$qty = 0; foreach ($items as $item) { $qty = $qty + $item->orderitem_quantity; } $html .= '<span class="qty">' . $qty . '</span> ' . JText::_("Items"); } elseif ($display_null == '1') { $text = JText::_($null_text); $html .= $text; } $html .= '</span>'; $html .= '<span class="CartTotal">' . JText::_("Total") . ':<span>' . TiendaHelperBase::currency($orderTable->order_total) . '</span> ' . '</span> '; $html .= '<span class="CartView">'; if ($params->get('display_lightbox') == '1') { $lightbox_attribs = array(); $lightbox['update'] = false; if ($lightbox_width = TiendaConfig::getInstance()->get('lightbox_width')) { $lightbox_attribs['width'] = $lightbox_width; } $html .= Tienda::getClass("TiendaUrl", 'library.url')->popup("index.php?option=com_tienda&view=carts&task=confirmAdd&tmpl=component", JText::_("View Your Cart"), $lightbox_attribs); } else { $html .= '<a id="cartLink" class="readon" href="' . JRoute::_("index.php?option=com_tienda&view=carts") . '">' . JText::_("View Your Cart") . '</a>'; } $html .= '</span>'; $html .= '<span class="CartCheckout">' . '<a id="checkoutLink" class="button" href="' . JRoute::_("index.php?option=com_tienda&view=checkout") . '">' . JText::_("Checkout") . '</a>' . '</span>'; $html .= '<div class="reset"></div>'; if ($ajax) { $mainframe->setUserState('mod_usercart.isAjax', '0'); } else { $html .= '</div>'; } echo $html;