Ejemplo n.º 1
0
 public static function getImage($id, $by = 'id', $alt = '', $type = 'thumb', $url = false)
 {
     switch ($type) {
         case "full":
             $path = 'manufacturers_images';
             break;
         case "thumb":
         default:
             $path = 'manufacturers_thumbs';
             break;
     }
     $tmpl = "";
     if (strpos($id, '.')) {
         // then this is a filename, return the full img tag if file exists, otherwise use a default image
         $src = JFile::exists(Citruscart::getPath($path) . '/' . $id) ? Citruscart::getUrl($path) . $id : 'media/citruscart/images/noimage.png';
         // if url is true, just return the url of the file and not the whole img tag
         $tmpl = $url ? $src : "<img src='" . $src . "' alt='" . JText::_($alt) . "' title='" . JText::_($alt) . "' name='" . JText::_($alt) . "' align='center' border='0' >";
     } else {
         if (!empty($id)) {
             // load the item, get the filename, create tmpl
             JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/tables');
             $row = JTable::getInstance('Manufacturers', 'CitruscartTable');
             $row->load((int) $id);
             $id = $row->manufacturer_image;
             $src = JFile::exists(Citruscart::getPath($path) . '/' . $row->manufacturer_image) ? Citruscart::getUrl($path) . $id : 'media/citruscart/images/noimage.png';
             // if url is true, just return the url of the file and not the whole img tag
             $tmpl = $url ? $src : "<img src='" . $src . "' alt='" . JText::_($alt) . "' title='" . JText::_($alt) . "' name='" . JText::_($alt) . "' align='center' border='0' >";
         }
     }
     return $tmpl;
 }
Ejemplo n.º 2
0
 /**
  * Protected! Use the getInstance
  */
 protected function CitruscartHelperImage()
 {
     // Parent Helper Construction
     parent::__construct();
     $config = Citruscart::getInstance();
     // Load default Parameters
     $this->product_img_height = $config->get('product_img_height');
     $this->product_img_width = $config->get('product_img_width');
     $this->category_img_height = $config->get('category_img_height');
     $this->category_img_width = $config->get('category_img_width');
     $this->manufacturer_img_width = $config->get('manufacturer_img_width');
     $this->manufacturer_img_height = $config->get('manufacturer_img_height');
     $this->product_img_path = Citruscart::getPath('products_images');
     $this->category_img_path = Citruscart::getPath('categories_images');
     $this->manufacturer_img_path = Citruscart::getPath('manufacturers_images');
     $this->product_thumb_path = Citruscart::getPath('products_thumbs');
     $this->category_thumb_path = Citruscart::getPath('categories_thumbs');
     $this->manufacturer_thumb_path = Citruscart::getPath('manufacturers_thumbs');
 }
Ejemplo n.º 3
0
 function getList()
 {
     static $list;
     // Only process the list once per request
     if (is_array($list)) {
         return $list;
     }
     // Get current path from request
     $current = $this->getState('folder');
     // If undefined, set to empty
     if ($current == 'undefined') {
         $current = '';
     }
     // Initialize variables
     if (strlen($current) > 0) {
         $basePath = Citruscart::getPath('images') . DS . $current;
     } else {
         $basePath = Citruscart::getPath('images');
     }
     $mediaBase = str_replace(DS, '/', Citruscart::getPath('images') . '/');
     $images = array();
     $folders = array();
     $docs = array();
     // Get the list of files and folders from the given folder
     $fileList = JFolder::files($basePath);
     $folderList = JFolder::folders($basePath);
     // Iterate over the files if they exist
     if ($fileList !== false) {
         foreach ($fileList as $file) {
             if (is_file($basePath . DS . $file) && substr($file, 0, 1) != '.' && strtolower($file) !== 'index.html') {
                 $tmp = new JObject();
                 $tmp->name = $file;
                 $tmp->path = str_replace(DS, '/', JPath::clean($basePath . DS . $file));
                 $tmp->path_relative = str_replace($mediaBase, '', $tmp->path);
                 $tmp->size = filesize($tmp->path);
                 $ext = strtolower(JFile::getExt($file));
                 switch ($ext) {
                     // Image
                     case 'jpg':
                     case 'png':
                     case 'gif':
                     case 'xcf':
                     case 'odg':
                     case 'bmp':
                     case 'jpeg':
                         $info = getimagesize($tmp->path);
                         $tmp->width = $info[0];
                         $tmp->height = $info[1];
                         $tmp->type = $info[2];
                         $tmp->mime = $info['mime'];
                         $filesize = MediaHelper::parseSize($tmp->size);
                         if ($info[0] > 60 || $info[1] > 60) {
                             $dimensions = MediaHelper::imageResize($info[0], $info[1], 60);
                             $tmp->width_60 = $dimensions[0];
                             $tmp->height_60 = $dimensions[1];
                         } else {
                             $tmp->width_60 = $tmp->width;
                             $tmp->height_60 = $tmp->height;
                         }
                         if ($info[0] > 16 || $info[1] > 16) {
                             $dimensions = MediaHelper::imageResize($info[0], $info[1], 16);
                             $tmp->width_16 = $dimensions[0];
                             $tmp->height_16 = $dimensions[1];
                         } else {
                             $tmp->width_16 = $tmp->width;
                             $tmp->height_16 = $tmp->height;
                         }
                         $images[] = $tmp;
                         break;
                         // Non-image document
                     // Non-image document
                     default:
                         $iconfile_32 = JPATH_ADMINISTRATOR . "/components/com_media/images/mime-icon-32/" . $ext . ".png";
                         if (file_exists($iconfile_32)) {
                             $tmp->icon_32 = "components/com_media/images/mime-icon-32/" . $ext . ".png";
                         } else {
                             $tmp->icon_32 = "components/com_media/images/con_info.png";
                         }
                         $iconfile_16 = JPATH_ADMINISTRATOR . "/components/com_media/images/mime-icon-16/" . $ext . ".png";
                         if (file_exists($iconfile_16)) {
                             $tmp->icon_16 = "components/com_media/images/mime-icon-16/" . $ext . ".png";
                         } else {
                             $tmp->icon_16 = "components/com_media/images/con_info.png";
                         }
                         $docs[] = $tmp;
                         break;
                 }
             }
         }
     }
     // Iterate over the folders if they exist
     if ($folderList !== false) {
         foreach ($folderList as $folder) {
             $tmp = new JObject();
             $tmp->name = basename($folder);
             $tmp->path = str_replace(DS, '/', JPath::clean($basePath . DS . $folder));
             $tmp->path_relative = str_replace($mediaBase, '', $tmp->path);
             $count = MediaHelper::countFiles($tmp->path);
             $tmp->files = $count[0];
             $tmp->folders = $count[1];
             $folders[] = $tmp;
         }
     }
     $list = array('folders' => $folders, 'docs' => $docs, 'images' => $images);
     return $list;
 }
Ejemplo n.º 4
0
# com_citruscart - citruscart
# ------------------------------------------------------------------------
# author    Citruscart Team - Citruscart http://www.citruscart.com
# copyright Copyright (C) 2014 - 2019 Citruscart.com All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://citruscart.com
# Technical Support:  Forum - http://citruscart.com/forum/index.html
-------------------------------------------------------------------------*/
defined('_JEXEC') or die('Restricted access');
$user = JFactory::getUser();
JHtml::_('script', 'media/citruscart/js/citruscart.js', false, false);
JHtml::_('script', 'media/citruscart/js/citruscart_checkout.js', false, false);
JHtml::_('script', 'media/citruscart/js/citruscart_checkout_onepage.js', false, false);
JHtml::_('stylesheet', 'media/citruscart/css/citruscart_checkout_onepage.css');
Citruscart::load('CitruscartHelperImage', 'helpers.image');
$image = CitruscartHelperImage::getLocalizedName("help_tooltip.png", Citruscart::getPath('images'));
$enable_tooltips = Citruscart::getInstance()->get('one_page_checkout_tooltips_enabled', 0);
$display_credits = Citruscart::getInstance()->get('display_credits', '0');
$guest_enabled = Citruscart::getInstance()->get('guest_checkout_enabled', 0);
$this->section = 1;
$js_strings = array('COM_CITRUSCART_UPDATING_PAYMENT_METHODS', 'COM_CITRUSCART_CHECKING_COUPON', 'COM_CITRUSCART_UPDATING_BILLING', 'COM_CITRUSCART_UPDATING_SHIPPING_RATES', 'COM_CITRUSCART_UPDATING_CART', 'COM_CITRUSCART_UPDATING_ADDRESS', 'COM_CITRUSCART_VALIDATING');
CitruscartHelperImage::addJsTranslationStrings($js_strings);
?>
<a name="citruscart-method"></a>

<div id="citruscart_checkout_pane">
<a name="citruscartRegistration" id="citruscartRegistration"></a>

<?php 
// login link
if (!$this->user->id) {
Ejemplo n.º 5
0
						<?php 
echo CitruscartSelect::btbooleanlist('manufacturer_enabled', '', $row->manufacturer_enabled);
?>
					</td>
				</tr>
				<tr>
					<td style="width: 100px; text-align: right;" class="key">
						<?php 
echo JText::_('COM_CITRUSCART_CURRENT_IMAGE');
?>
:
					</td>
					<td>
						<?php 
jimport('joomla.filesystem.file');
if (!empty($row->manufacturer_image) && JFile::exists(Citruscart::getPath('manufacturers_images') . DS . $row->manufacturer_image)) {
    echo CitruscartUrl::popup(CitruscartHelperManufacturer::getImage($row->manufacturer_id, '', '', 'full', true), CitruscartHelperManufacturer::getImage($row->manufacturer_id), array('update' => false, 'img' => true));
}
?>
						<br />
						<input type="text" name="manufacturer_image" id="manufacturer_image" value="<?php 
echo $row->manufacturer_image;
?>
" size="48" maxlength="250" />
					</td>
				</tr>
				<tr>
					<td style="width: 100px; text-align: right;" class="key">
						<?php 
echo JText::_('COM_CITRUSCART_UPLOAD_NEW_IMAGE');
?>
Ejemplo n.º 6
0
?>
    					</td>
    				</tr>
    				<tr>
    					<td style="width: 100px; text-align: right;" class="key">
    						<label for="category_full_image">
    						<?php 
echo JText::_('COM_CITRUSCART_CURRENT_IMAGE');
?>
:
    						</label>
    					</td>
    					<td>
    						<?php 
jimport('joomla.filesystem.file');
if (!empty($row->category_full_image) && JFile::exists(Citruscart::getPath('categories_images') . DS . $row->category_full_image)) {
    echo CitruscartUrl::popup(Citruscart::getClass('CitruscartHelperCategory', 'helpers.category')->getImage($row->category_id, '', '', 'full', true), CitruscartHelperCategory::getImage($row->category_id), array('update' => false, 'img' => true));
}
?>
    						<br />
    						<input type="text" name="category_full_image" id="category_full_image" size="48" maxlength="250" value="<?php 
echo $row->category_full_image;
?>
" />
    					</td>
    				</tr>
    				<tr>
    					<td style="width: 100px; text-align: right;" class="key">
    						<label for="category_full_image_new">
    						<?php 
echo JText::_('COM_CITRUSCART_UPLOAD_NEW_IMAGE');
Ejemplo n.º 7
0
/*------------------------------------------------------------------------
# com_citruscart
# ------------------------------------------------------------------------
# author   Citruscart Team  - Citruscart http://www.citruscart.com
# copyright Copyright (C) 2014 Citruscart.com All Rights Reserved.
# license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://citruscart.com
# Technical Support:  Forum - http://citruscart.com/forum/index.html
-------------------------------------------------------------------------*/
/** ensure this file is being included by a parent file */
defined('_JEXEC') or die('Restricted access');
JHtml::_('script', 'media/citruscart/js/citruscart.js', false, false);
$items = $this->product_relations_data->items;
$form = $this->form;
Citruscart::load('CitruscartHelperImage', 'helpers.image');
$image_addtocart = CitruscartHelperImage::getLocalizedName("addcart.png", Citruscart::getPath('images'));
?>

<form action="<?php 
echo JRoute::_($form['action']);
?>
" method="post" class="adminform" name="adminFormChildren" enctype="multipart/form-data" >

    <div class="reset"></div>

    <div id="product_children">
        <div id="product_children_header" class="citruscart_header">
            <span><?php 
echo JText::_('COM_CITRUSCART_SELECT_THE_ITEMS_TO_ADD_TO_YOUR_CART');
?>
</span>
Ejemplo n.º 8
0
 /**
  * Displays a single product
  * (non-PHPdoc)
  * @see Citruscart/site/CitruscartController#view()
  */
 function view()
 {
     $session = JFactory::getSession();
     $app = JFactory::getApplication();
     $input = JFactory::getApplication()->input;
     $this->display_cartbutton = true;
     $input->set('view', $this->get('suffix'));
     $model = $this->getModel($this->get('suffix'));
     $model->getId();
     Citruscart::load('CitruscartHelperUser', 'helpers.user');
     $user_id = JFactory::getUser()->id;
     $filter_group = CitruscartHelperUser::getUserGroup($user_id, $model->getId());
     $model->setState('filter_group', $filter_group);
     $model->setState('product.qty', 1);
     $model->setState('user.id', $user_id);
     $row = $model->getItem(false, false, false);
     // use the state
     $filter_category = $model->getState('filter_category', $input->getString('filter_category'));
     if (empty($filter_category)) {
         $categories = Citruscart::getClass('CitruscartHelperProduct', 'helpers.product')->getCategories($row->product_id);
         if (!empty($categories)) {
             $filter_category = $categories[0];
         }
     }
     $unpublished = false;
     if ($row->unpublish_date != JFactory::getDbo()->getNullDate()) {
         $unpublished = strtotime($row->unpublish_date) < time();
     }
     if (!$unpublished && $row->publish_date != JFactory::getDbo()->getNullDate()) {
         $unpublished = strtotime($row->publish_date) > time();
     }
     if (empty($row->product_enabled) || $unpublished) {
         $redirect = "index.php?option=com_citruscart&view=products&task=display&filter_category=" . $filter_category;
         $redirect = JRoute::_($redirect, false);
         $this->message = JText::_('COM_CITRUSCART_CANNOT_VIEW_DISABLED_PRODUCT');
         $this->messagetype = 'notice';
         $this->setRedirect($redirect, $this->message, $this->messagetype);
         return;
     }
     Citruscart::load('CitruscartArticle', 'library.article');
     $product_description = CitruscartArticle::fromString($row->product_description);
     $product_description_short = CitruscartArticle::fromString($row->product_description_short);
     JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/models');
     $cmodel = JModelLegacy::getInstance('Categories', 'CitruscartModel');
     $cat = $cmodel->getTable();
     $cat->load($filter_category);
     // if product browsing enabled on detail pages, get surrounding items based on browsing state
     $ns = $app->getName() . '::' . 'com.citruscart.products.state';
     $session_state = $session->get($ns);
     $surrounding = array();
     // Only do this if product browsing is enabled on product detail pages
     if ($this->defines->get('enable_product_detail_nav') && $session_state) {
         $products_model = $this->getModel($this->get('suffix'));
         $products_model->emptyState();
         foreach ((array) $session_state as $key => $value) {
             $products_model->setState($key, $value);
         }
         $surrounding = $products_model->getSurrounding($model->getId());
     }
     $view = $this->getView($this->get('suffix'), JFactory::getDocument()->getType());
     $view->set('_doTask', true);
     $view->assign('row', $row);
     $view->assign('surrounding', $surrounding);
     // breadcrumb support
     $pathway = $app->getPathway();
     // does this item have its own itemid?  if so, let joomla handle the breadcrumb,
     // otherwise, help it out a little bit
     $category_itemid = $input->getInt('Itemid', Citruscart::getClass("CitruscartHelperRoute", 'helpers.route')->category($filter_category, true));
     if (!($product_itemid = $this->router->findItemid(array('view' => 'products', 'task' => 'view', 'id' => $row->product_id)))) {
         $items = Citruscart::getClass("CitruscartHelperCategory", 'helpers.category')->getPathName($filter_category, 'array');
         if (!empty($items)) {
             // add the categories to the pathway
             Citruscart::getClass("CitruscartHelperPathway", 'helpers.pathway')->insertCategories($items, $category_itemid);
         }
         // add the item being viewed to the pathway
         $pathway->addItem($row->product_name);
     }
     $cat->itemid = $category_itemid;
     $view->assign('cat', $cat);
     // Check If the inventroy is set then it will go for the inventory product quantities
     if ($row->product_check_inventory) {
         $inventoryList = Citruscart::getClass('CitruscartHelperProduct', 'helpers.product')->getProductQuantities($row->product_id);
         if (!Citruscart::getInstance()->get('display_out_of_stock') && empty($inventoryList)) {
             // redirect
             $redirect = "index.php?option=com_citruscart&view=products&task=display&filter_category=" . $filter_category;
             $redirect = JRoute::_($redirect, false);
             $this->message = JText::_('COM_CITRUSCART_CANNOT_VIEW_PRODUCT');
             $this->messagetype = 'notice';
             $this->setRedirect($redirect, $this->message, $this->messagetype);
             return;
         }
         // if there is no entry of product in the productquantities
         if (count($inventoryList) == 0) {
             $inventoryList[''] = '0';
         }
         $view->assign('inventoryList', $inventoryList);
     }
     $view->product_comments = $this->getComments($view, $row->product_id);
     $view->files = $this->getFiles($view, $row->product_id);
     $view->product_relations = $this->getRelationshipsHtml($view, $row->product_id, 'relates');
     $view->product_children = $this->getRelationshipsHtml($view, $row->product_id, 'parent');
     $view->product_requirements = $this->getRelationshipsHtml($view, $row->product_id, 'requires');
     $view->product_description = $product_description;
     $view->product_description_short = $product_description_short;
     $view->setModel($model, true);
     // we know the product, set the meta info
     $doc = JFactory::getDocument();
     $doc->setTitle(str_replace(array("&apos;", "&amp;"), array("'", "&"), htmlspecialchars_decode($row->product_name)));
     $doc->setDescription(htmlspecialchars_decode($product_description));
     // add the media/templates folder as a valid path for templates
     $view->addTemplatePath(Citruscart::getPath('products_templates'));
     // but add back the template overrides folder to give it priority
     $template_overrides = JPATH_BASE . '/templates/' . $app->getTemplate() . '/html/com_citruscart/' . $view->getName();
     $view->addTemplatePath($template_overrides);
     // using a helper file, we determine the product's layout
     $layout = Citruscart::getClass('CitruscartHelperProduct', 'helpers.product')->getLayout($row->product_id, array('category_id' => $cat->category_id));
     $view->setLayout($layout);
     JPluginHelper::importPlugin('citruscart');
     ob_start();
     $app->triggerEvent('onBeforeDisplayProduct', array($row->product_id));
     $view->assign('onBeforeDisplayProduct', ob_get_contents());
     ob_end_clean();
     ob_start();
     $app->triggerEvent('onBeforeDisplayProductDescription', array());
     $view->assign('onBeforeDisplayProductDescription', ob_get_contents());
     ob_end_clean();
     ob_start();
     $app->triggerEvent('onAfterDisplayProduct', array($row->product_id));
     $view->assign('onAfterDisplayProduct', ob_get_contents());
     ob_end_clean();
     ob_start();
     $html = $app->triggerEvent('onAfterDisplayProductDescription', array());
     $view->assign('onAfterDisplayProductDescription', $html[0]);
     ob_end_clean();
     $view->display();
     $this->footer();
     return;
 }
Ejemplo n.º 9
0
 /**
  * Get the URL to the path to images
  * @return unknown_type
  */
 function getImageUrl()
 {
     // Check where we should upload the file
     // This is the default one
     $dir = Citruscart::getPath('products_images');
     $url = Citruscart::getUrl('products_images');
     $helper = CitruscartHelperBase::getInstance();
     // is the image path overridden?
     if (!empty($this->product_images_path) && $helper->checkDirectory($this->product_images_path, false)) {
         $url = str_replace(JPATH_SITE . DIRECTORY_SEPARATOR, JURI::root(), $this->product_images_path);
     } else {
         // try with the SKU
         if (Citruscart::getInstance()->get('sha1_images', '0')) {
             if (!empty($this->product_sku)) {
                 $subdirs = $this->getSha1Subfolders($this->product_sku, '/');
                 $image_dir = $url . $subdirs . $this->product_sku . '/';
             }
         } else {
             $image_dir = $url . $this->product_sku . '/';
         }
         // try with the SKU
         if (!empty($this->product_sku)) {
             $url = $image_dir;
         } else {
             if (Citruscart::getInstance()->get('sha1_images', '0')) {
                 $subdirs = $this->getSha1Subfolders($this->product_id, '/');
                 $image_dir = $url . $subdirs . $this->product_id . '/';
             } else {
                 $image_dir = $url . $this->product_id . '/';
             }
             $url = $image_dir;
         }
     }
     return $url;
 }
Ejemplo n.º 10
0
    function display()
    {
        $mainframe = JFactory::getApplication();
        // Initialize variables
        $db = JFactory::getDBO();
        $nullDate = $db->getNullDate();
        $document = JFactory::getDocument();
        $document->setTitle('Image Selection');
        JHTML::_('behavior.modal');
        $template = $mainframe->getTemplate();
        $document->addStyleSheet("templates/{$template}/css/general.css");
        $app = JFactory::getApplication();
        $append = '';
        if ($app->getClientId() == 1) {
            $append = 'administrator/';
        }
        JHTML::_('script', 'popup-imagemanager.js', $append . 'components/com_media/assets/');
        JHTML::_('stylesheet', 'popup-imagemanager.css', $append . 'components/com_media/assets/');
        $limitstart = JRequest::getVar('limitstart', '0', '', 'int');
        $lists = $this->_getLists();
        $rows = $this->get('List');
        $page = $this->get('Pagination');
        JHTML::_('behavior.tooltip');
        $config = JComponentHelper::getParams('com_media');
        /*
         * Display form for FTP credentials?
         * Don't set them here, as there are other functions called before this one if there is any file write operation
         */
        jimport('joomla.client.helper');
        $ftp = !JClientHelper::hasCredentials('ftp');
        //$model = JModelLegacy::getInstance('ElementImage', 'CitruscartModel');
        $this->assign('session', JFactory::getSession());
        $this->assign('config', $config);
        $this->assign('state', $this->get('state'));
        $this->assign('folderList', $this->get('folderList'));
        $this->assign('require_ftp', $ftp);
        $object = JRequest::getVar('object');
        $link = 'index.php?option=com_citruscart&task=elementImage&tmpl=component&object=' . $object;
        ?>
		<script type='text/javascript'>
		var image_base_path = '<?php 
        echo Citruscart::getPath('images');
        ?>
/';
		</script>
		<form action="<?php 
        echo $link;
        ?>
" id="imageForm" method="post" enctype="multipart/form-data">
			<div id="messages" style="display: none;">
				<span id="message"></span><img src="<?php 
        echo JURI::base();
        ?>
components/com_media/images/dots.gif" width="22" height="12" alt="..." />
			</div>
			<fieldset>
				<div style="float: left">
					<label for="folder"><?php 
        echo JText::_('COM_CITRUSCART_DIRECTORY');
        ?>
</label>
					<?php 
        echo $this->folderList;
        ?>
					<button type="button" id="upbutton" title="<?php 
        echo JText::_('COM_CITRUSCART_DIRECTORY_UP');
        ?>
"><?php 
        echo JText::_('COM_CITRUSCART_UP');
        ?>
</button>
				</div>
				<div style="float: right">
					<button type="button" onclick="ImageManager.onok();window.parent.document.getElementById('sbox-window').close();"><?php 
        echo JText::_('COM_CITRUSCART_INSERT');
        ?>
</button>
					<button type="button" onclick="window.parent.document.getElementById('sbox-window').close();"><?php 
        echo JText::_('COM_CITRUSCART_CANCEL');
        ?>
</button>
				</div>
			</fieldset>
			<iframe id="imageframe" name="imageframe" src="index.php?option=com_media&amp;view=imagesList&amp;tmpl=component&amp;folder=<?php 
        echo $this->state->folder;
        ?>
"></iframe>
		
			<fieldset>
				<table class="properties">
					<tr>
						<td><label for="f_url"><?php 
        echo JText::_('COM_CITRUSCART_IMAGE_URL');
        ?>
</label></td>
						<td><input type="text" id="f_url" value="" /></td>
						<td><label for="f_align"><?php 
        echo JText::_('COM_CITRUSCART_ALIGN');
        ?>
</label></td>
						<td>
							<select size="1" id="f_align" title="Positioning of this image">
								<option value="" selected="selected"><?php 
        echo JText::_('COM_CITRUSCART_NOT_SET');
        ?>
</option>
								<option value="left"><?php 
        echo JText::_('COM_CITRUSCART_LEFT');
        ?>
</option>
								<option value="right"><?php 
        echo JText::_('COM_CITRUSCART_RIGHT');
        ?>
</option>
							</select>
						</td>
					</tr>
					<tr>
						<td><label for="f_alt"><?php 
        echo JText::_('COM_CITRUSCART_IMAGE_DESCRIPTION');
        ?>
</label></td>
						<td><input type="text" id="f_alt" value="" /></td>
					</tr>
					<tr>
						<td><label for="f_title"><?php 
        echo JText::_('COM_CITRUSCART_TITLE');
        ?>
</label></td>
						<td><input type="text" id="f_title" value="" /></td>
						<td><label for="f_caption"><?php 
        echo JText::_('COM_CITRUSCART_CAPTION');
        ?>
</label></td>
						<td><input type="checkbox" id="f_caption" /></td>
					</tr>
				</table>
			</fieldset>
			<input type="hidden" id="dirPath" name="dirPath" />
			<input type="hidden" id="f_file" name="f_file" />
			<input type="hidden" id="tmpl" name="component" />
		</form>
		
		<form action="<?php 
        echo JURI::base();
        ?>
index.php?option=com_media&amp;task=file.upload&amp;tmpl=component&amp;<?php 
        echo $this->session->getName() . '=' . $this->session->getId();
        ?>
&amp;pop_up=1&amp;<?php 
        echo JSession::getFormToken();
        ?>
=1" id="uploadForm" method="post" enctype="multipart/form-data">
			<fieldset>
				<legend><?php 
        echo JText::_('COM_CITRUSCART_UPLOAD');
        ?>
</legend>
				<fieldset class="actions">
					<input type="file" id="file-upload" name="Filedata" />
					<input type="submit" id="file-upload-submit" value="<?php 
        echo JText::_('COM_CITRUSCART_START_UPLOAD');
        ?>
"/>
					<span id="upload-clear"></span>
				</fieldset>
				<ul class="upload-queue" id="upload-queue">
					<li style="display: none" />
				</ul>
			</fieldset>
			<input type="hidden" name="return-url" value="<?php 
        echo base64_encode('index.php?option=com_media&view=images&tmpl=component&e_name=' . JRequest::get('e_name'));
        ?>
" />
		</form>
		<?php 
    }
Ejemplo n.º 11
0
 /**
  * Uploads a file to associate to an item
  *
  * @return unknown_type
  */
 function addfile($fieldname = 'createproductfile_file', $path = 'products_files')
 {
     Citruscart::load('CitruscartFile', 'library.file');
     $upload = new CitruscartFile();
     // handle upload creates upload object properties
     $upload->handleUpload($fieldname);
     // then save image to appropriate folder
     if ($path == 'products_files') {
         $path = Citruscart::getPath('products_files');
     }
     $upload->setDirectory($path);
     $dest = $upload->getDirectory() . DS . $upload->getPhysicalName();
     // delete the file if dest exists
     if ($fileexists = JFile::exists($dest)) {
         JFile::delete($dest);
     }
     // save path and filename or just filename
     if (!JFile::upload($upload->file_path, $dest)) {
         $this->setError(sprintf(JText::_('COM_CITRUSCART_MOVE_FAILED_FROM'), $upload->file_path, $dest));
         return false;
     }
     $upload->full_path = $dest;
     return $upload;
 }
Ejemplo n.º 12
0
    function display()
    {
        $mainframe = JFactory::getApplication();
        // Initialize variables
        $db = JFactory::getDBO();
        $nullDate = $db->getNullDate();
        $document = JFactory::getDocument();
        $document->setTitle('Product Selection');
        JHTML::_('behavior.modal');
        $template = $mainframe->getTemplate();
        $document->addStyleSheet("templates/{$template}/css/general.css");
        $document->addScript('media/citruscart/js/citruscart.js');
        $limitstart = JRequest::getVar('limitstart', '0', '', 'int');
        $lists = $this->_getLists();
        //Ordering allowed ?
        // $ordering = ($lists['order'] == 'section_name' && $lists['order_Dir'] == 'ASC');
        $rows =& $this->get('List');
        $page =& $this->get('Pagination');
        JHTML::_('behavior.tooltip');
        $object = JRequest::getVar('object');
        $link = 'index.php?option=com_citruscart&task=elementproductmultiple&tmpl=component&object=' . $object;
        Citruscart::load('CitruscartGrid', 'library.grid');
        ?>
		<?php 
        JHtml::_('script', 'media/citruscart/js/citruscart.js', false, false);
        ?>

<form action="<?php 
        echo $link;
        ?>
" method="post" name="adminForm">

<table>
	<tr>
		<td width="100%"><?php 
        echo JText::_('COM_CITRUSCART_FILTER');
        ?>
: <input
			type="text" name="search" id="search"
			value="<?php 
        echo $lists['search'];
        ?>
" class="text_area"
			onchange="document.adminForm.submit();" />
		<button onclick="this.form.submit();"><?php 
        echo JText::_('COM_CITRUSCART_GO');
        ?>
</button>
		<button
			onclick="document.getElementById('search').value='';this.form.submit();"><?php 
        echo JText::_('COM_CITRUSCART_RESET');
        ?>
</button>
		</td>
		<td nowrap="nowrap">
    		<button onclick="CitruscartSetItemsToOrder(<?php 
        echo count($rows);
        ?>
, '<?php 
        echo JText::_('COM_CITRUSCART_UNABLE_TO_RETRIEVE_PRODUCT_SELECTION');
        ?>
');return false;"><?php 
        echo JText::_('COM_CITRUSCART_ADD_SELECTED_PRODUCTS_TO_ORDER');
        ?>
</button>
		</td>
	</tr>
</table>

<table class="adminlist" cellspacing="1">
	<thead>
		<tr>
			<th width="5"><?php 
        echo JText::_('COM_CITRUSCART_NUM');
        ?>
</th>
			<th style="width: 20px;"><input type="checkbox" name="toggle"
				value="" onclick="checkAll(<?php 
        echo count($rows);
        ?>
);" /></th>
			<th width="2%" class="title"><?php 
        echo JHTML::_('grid.sort', 'ID', 'tbl.product_id', @$lists['order_Dir'], @$lists['order']);
        ?>
			</th>
			<th style="width:50px;"><?php 
        echo JText::_('COM_CITRUSCART_IMAGE');
        ?>
</th>
			<th class="title"><?php 
        echo JHTML::_('grid.sort', 'Name', 'tbl.product_name', @$lists['order_Dir'], @$lists['order']);
        ?>
			</th>
			<th class="title"><?php 
        echo JHTML::_('grid.sort', 'Price', 'pp.product_price', @$lists['order_Dir'], @$lists['order']);
        ?>
			</th>
			<th class="title"><?php 
        echo JText::_('COM_CITRUSCART_QTY');
        ?>
</th>
		</tr>
	</thead>
	<tfoot>
		<tr>
			<td colspan="15"><?php 
        echo $page->getListFooter();
        ?>
</td>
		</tr>
	</tfoot>
	<tbody>
	<?php 
        $k = 0;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row =& $rows[$i];
            $onclick = "\r\n\t\t\t\t\twindow.parent.jSelectProducts(\r\n\t\t\t\t\t'{$row->product_id}', '" . str_replace(array("'", "\""), array("\\'", ""), $row->product_name) . "', '" . JRequest::getVar('object') . "'\r\n\t\t\t\t\t);";
            ?>
		<tr class="<?php 
            echo "row{$k}";
            ?>
">
			<td><?php 
            echo $page->getRowOffset($i);
            ?>
</td>
			<td style="text-align: center;"><?php 
            echo CitruscartGrid::checkedout($row, $i, 'product_id');
            ?>
			</td>
			<td style="text-align: center;"><a style="cursor: pointer;"
				onclick="<?php 
            echo $onclick;
            ?>
"> <?php 
            echo $row->product_id;
            ?>
 </a>
			</td>
			<td>
			<?php 
            jimport('joomla.filesystem.file');
            if (!empty($row->product_thumb_image) && JFile::exists(Citruscart::getPath('products_thumbs') . DS . $row->product_thumb_image)) {
                ?>
					<img src="<?php 
                echo Citruscart::getURL('products_thumbs') . $row->product_thumb_image;
                ?>
" style="display: block;" />
					<?php 
            }
            ?>
	
			</td>				
			<td><a style="cursor: pointer;"
				onclick="<?php 
            echo $onclick;
            ?>
"> <?php 
            echo htmlspecialchars($row->product_name, ENT_QUOTES, 'UTF-8');
            ?>
			</a></td>
			<td style="text-align: center;"><a style="cursor: pointer;"
				onclick="<?php 
            echo $onclick;
            ?>
"> <?php 
            echo $row->product_price;
            ?>
			</a></td>
			<td style="text-align: center;"><input id="<?php 
            echo "qty{$i}";
            ?>
" name="<?php 
            echo "qty{$i}";
            ?>
" type="text" value="1" style="width: 30px;" /></td>
		</tr>
		<?php 
            $k = 1 - $k;
        }
        ?>
	</tbody>
</table>

<input type="hidden" name="boxchecked" value="0" /> <input type="hidden"
	name="filter_order" value="<?php 
        echo $lists['order'];
        ?>
" /> <input
	type="hidden" name="filter_order_Dir"
	value="<?php 
        echo $lists['order_Dir'];
        ?>
" /></form>
	<?php 
    }
 private function _migrateImages($prefix = 'jos_', $vm_prefix = 'vm_', &$results, $internal = true)
 {
     $p = $prefix . $vm_prefix;
     // Fetch the VM full image
     if ($internal) {
         $db = JFactory::getDBO();
     } else {
         $db = $this->_verifyDB();
     }
     $query = "SELECT product_id as id, product_full_image as image FROM {$p}product";
     $db->setQuery($query);
     $products = $db->loadAssocList();
     Citruscart::load('CitruscartImage', 'library.image');
     if ($internal) {
         $vm_image_path = JPATH_SITE . "/components/com_virtuemart/shop_image/product/";
     } else {
         $state = $this->_getState();
         $url = $state->external_site_url;
         $vm_image_path = $url . "/components/com_virtuemart/shop_image/product/";
     }
     $n = count($results);
     $results[$n]->title = 'Product Images';
     $results[$n]->query = 'Copy Product Images & Resize';
     $results[$n]->error = '';
     $results[$n]->affectedRows = 0;
     foreach ($products as $result) {
         $check = false;
         if ($internal) {
             $check = JFile::exists($vm_image_path . $result['image']);
         } else {
             $check = $this->url_exists($vm_image_path) && $result['image'];
         }
         if ($check) {
             if ($internal) {
                 $img = new CitruscartImage($vm_image_path . $result['image']);
             } else {
                 $tmp_path = JFactory::getApplication()->getCfg('tmp_path');
                 $file = fopen($vm_image_path . $result['image'], 'r');
                 $file_content = stream_get_contents($file);
                 fclose($file);
                 $file = fopen($tmp_path . DIRECTORY_SEPARATOR . $result['image'], 'w');
                 fwrite($file, $file_content);
                 fclose($file);
                 $img = new CitruscartImage($tmp_path . DS . $result['image']);
             }
             Citruscart::load('CitruscartTableProducts', 'tables.products');
             $product = JTable::getInstance('Products', 'CitruscartTable');
             $product->load($result['id']);
             $path = $product->getImagePath();
             $type = $img->getExtension();
             $img->load();
             $name = $img->getPhysicalName();
             // Save full Image
             if (!$img->save($path . $name)) {
                 $results[$n]->error .= '::Could not Save Product Image- From: ' . $vm_image_path . $result['image'] . ' To: ' . $path . $result['image'];
             }
             $img->setDirectory($path);
             // Save Thumb
             Citruscart::load('CitruscartHelperImage', 'helpers.image');
             $imgHelper = CitruscartHelperBase::getInstance('Image', 'CitruscartHelper');
             if (!$imgHelper->resizeImage($img, 'product')) {
                 $results[$n]->error .= '::Could not Save Product Thumb';
             }
             // Save correct image naming
             $product->product_full_image = $name;
             $product->save();
             $results[$n]->affectedRows++;
         }
     }
     $n++;
     // CATEGORIES
     // Fetch the VM full image
     $query = "SELECT category_id as id, category_full_image as image FROM {$p}category";
     $db->setQuery($query);
     $products = $db->loadAssocList();
     Citruscart::load('CitruscartImage', 'library.image');
     if ($internal) {
         $vm_image_path = JPATH_SITE . "/components/com_virtuemart/shop_image/category/";
     } else {
         $state = $this->_getState();
         $url = $state->external_site_url;
         $vm_image_path = $url . "/components/com_virtuemart/shop_image/category/";
     }
     $results[$n]->title = 'Category Images';
     $results[$n]->query = 'Copy Category Images & Resize';
     $results[$n]->error = '';
     $results[$n]->affectedRows = 0;
     foreach ($products as $result) {
         $check = false;
         if ($internal) {
             $check = JFile::exists($vm_image_path . $result['image']);
         } else {
             $check = $this->url_exists($vm_image_path) && $result['image'];
         }
         if ($check) {
             if ($internal) {
                 $img = new CitruscartImage($vm_image_path . $result['image']);
             } else {
                 $tmp_path = JFactory::getApplication()->getCfg('tmp_path');
                 $file = fopen($vm_image_path . $result['image'], 'r');
                 $file_content = stream_get_contents($file);
                 fclose($file);
                 $file = fopen($tmp_path . DS . $result['image'], 'w');
                 fwrite($file, $file_content);
                 fclose($file);
                 $img = new CitruscartImage($tmp_path . DS . $result['image']);
             }
             $img->load();
             $path = Citruscart::getPath('categories_images') . DS;
             $name = $img->getPhysicalName();
             // Save full Image
             if (!$img->save($path . $name)) {
                 $results[$n]->error .= '::Could not Save Category Image - From: ' . $vm_image_path . $result['image'] . ' To: ' . $path . $result['image'];
             }
             $img->setDirectory($path);
             // Save Thumb
             Citruscart::load('CitruscartHelperImage', 'helpers.image');
             $imgHelper = CitruscartHelperBase::getInstance('Image', 'CitruscartHelper');
             if (!$imgHelper->resizeImage($img, 'category')) {
                 $results[$n]->error .= '::Could not Save Category Thumb';
             }
             // Save correct image name
             Citruscart::load('CitruscartTableCategories', 'tables.categories');
             $category = JTable::getInstance('Categories', 'CitruscartTable');
             $category->load($result['id']);
             $category->category_full_image = $name;
             $category->save();
             $results[$n]->affectedRows++;
         }
     }
 }
Ejemplo n.º 14
0
 /**
  * Gets a category's image
  *
  * @param $id
  * @param $by
  * @param $alt
  * @param $type
  * @param $url
  * @return unknown_type
  */
 public static function getImage($id, $by = 'id', $alt = '', $type = 'thumb', $url = false)
 {
     $app = JFactory::getApplication();
     switch ($type) {
         case "full":
             $path = 'categories_images';
             break;
         case "thumb":
         default:
             if ($app->isSite()) {
                 $path = "categories_images";
             } else {
                 $path = 'categories_thumbs';
             }
             break;
     }
     $tmpl = "";
     if (!empty($id) && is_numeric($id) && strpos($id, '.') === false) {
         $model = Citruscart::getClass('CitruscartModelCategories', 'models.categories');
         $item = $model->getItem((int) $id);
         $full_image = !empty($item->category_full_image) ? $item->category_full_image : null;
         if (filter_var($full_image, FILTER_VALIDATE_URL) !== false) {
             // $full_image contains a valid URL
             $src = $full_image;
         } elseif (JFile::exists(Citruscart::getPath($path) . "/" . $full_image)) {
             $src = Citruscart::getUrl($path) . $full_image;
         } else {
             $src = JURI::root(true) . '/media/citruscart/images/placeholder_239.gif';
         }
         if ($url) {
             return $src;
         } elseif (!empty($src)) {
             $tmpl = "<img src='" . $src . "' alt='" . JText::_($alt) . "' title='" . JText::_($alt) . "'/>";
         }
         return $tmpl;
     }
     if (strpos($id, '.')) {
         // then this is a filename, return the full img tag if file exists, otherwise use a default image
         $src = JFile::exists(Citruscart::getPath($path) . '/' . $id) ? Citruscart::getUrl($path) . $id : JURI::root(true) . '/media/citruscart/images/placeholder_239.gif';
         // if url is true, just return the url of the file and not the whole img tag
         $tmpl = $url ? $src : "<img src='" . $src . "' alt='" . JText::_($alt) . "' title='" . JText::_($alt) . "' />";
     }
     return $tmpl;
 }
Ejemplo n.º 15
0
 /**
  * Batch resize of thumbs
  * @author Skullbock
  */
 function recreateThumbs()
 {
     $app = JFactory::getApplication();
     $per_step = 100;
     $from_id = $app->input->getInt('from_id', 0);
     $to = $from_id + $per_step;
     Citruscart::load('CitruscartHelperManufacturer', 'helpers.manufacturer');
     Citruscart::load('CitruscartImage', 'library.image');
     $width = Citruscart::getInstance()->get('manufacturer_img_width', '0');
     $height = Citruscart::getInstance()->get('manufacturer_img_height', '0');
     $model = $this->getModel('Manufacturers', 'CitruscartModel');
     $model->setState('limistart', $from_id);
     $model->setState('limit', $to);
     $row = $model->getTable();
     $count = $model->getTotal();
     $manufacturers = $model->getList();
     $i = 0;
     $last_id = $from_id;
     foreach ($manufacturers as $p) {
         $i++;
         $image = $p->manufacturer_full_image;
         if ($image != '') {
             $img = new CitruscartImage($image, 'manufacturer');
             $img->setDirectory(Citruscart::getPath('manufacturers_images'));
             // Thumb
             Citruscart::load('CitruscartHelperImage', 'helpers.image');
             $imgHelper = CitruscartHelperBase::getInstance('Image', 'CitruscartHelper');
             $imgHelper->resizeImage($img, 'manufacturer');
         }
         $last_id = $p->manufacturer_id;
     }
     if ($i < $count) {
         $redirect = "index.php?option=com_citruscart&controller=manufacturers&task=recreateThumbs&from_id=" . ($last_id + 1);
     } else {
         $redirect = "index.php?option=com_citruscart&view=config";
     }
     $redirect = JRoute::_($redirect, false);
     $this->setRedirect($redirect, JText::_('COM_CITRUSCART_DONE'), 'notice');
     return;
 }
Ejemplo n.º 16
0
    ?>
 </span>
	</div> -->
	<?php 
    $i = 1;
    ?>
	<ul class="citruscart_product_gallery_thumb" id="citruscart-product-gallery-list<?php 
    $product_id;
    ?>
">
	<?php 
    foreach ($gallery_data->images as $image) {
        ?>
		<?php 
        $src = $gallery_data->uri . $image;
        if (JFile::exists(Citruscart::getPath('products_thumbs') . DS . $image)) {
            $src = $gallery_data->uri . "thumbs/" . $image;
        }
        $product_image = $gallery_data->uri . "/" . $image;
        $id = "citruscart_alt_image" . $product_id . "_" . $i;
        $alt_id = "citruscart_product_image_alt" . $product_id . "_" . $i;
        $onclick = "changeAltImage('/ {$i} /')";
        ?>
		<li class="zoom_gallery">
		<a href="#" data-image="<?php 
        echo JRoute::_($src);
        ?>
" >
		<!-- id="citruscart_alt_image<?php 
        echo $i;
        ?>
Ejemplo n.º 17
0
							<?php 
echo CitruscartGrid::boolean($row->product_enabled);
?>
						</td>
					</tr>
					<tr>
						<td width="100" align="right" class="key">
							<?php 
echo JText::_('COM_CITRUSCART_CURRENT_IMAGE');
?>
:
						</td>
						<td>
							<?php 
jimport('joomla.filesystem.file');
if (!empty($row->product_full_image) && JFile::exists(Citruscart::getPath('products_images') . '/' . $row->product_full_image)) {
    ?>
								<img src="<?php 
    echo Citruscart::getURL('products_images') . $row->product_full_image;
    ?>
" style="display: block;" />
								<?php 
}
?>
						</td>
					</tr>
				</table>
		</fieldset>

            <?php 
$modules = JModuleHelper::getModules("citruscart_product_dashboard_main");
Ejemplo n.º 18
0
 /**
  * Get the cart button form for a specific product
  *
  * @param int $product_id 	The id of the product
  * @return html	The add to cart form
  */
 public static function getCartButton($product_id, $layout = 'product_buy', $values = array(), &$callback_js = '')
 {
     /*  Get the application */
     $app = JFactory::getApplication();
     if (is_array($values) && !count($values)) {
         $values = $app->input->get('request');
         //$values = JRequest::get( 'request' );
     }
     $html = '';
     $page = $app->input->get('page', 'product');
     //$page = JRequest::getVar( 'page', 'product' );
     $isPOS = $page == 'pos';
     if ($isPOS) {
         JLoader::register("CitruscartViewPOS", JPATH_ADMINISTRATOR . "/components/com_citruscart/views/pos/view.html.php");
         $view = new CitruscartViewPOS();
     } else {
         JLoader::register("CitruscartViewProducts", JPATH_SITE . "/components/com_citruscart/views/products/view.html.php");
         $view = new CitruscartViewProducts();
     }
     $model = JModelLegacy::getInstance('Products', 'CitruscartModel');
     $model->setId($product_id);
     $model->setState('task', 'product_buy');
     Citruscart::load('CitruscartHelperBase', 'helpers._base');
     $helper_product = CitruscartHelperBase::getInstance('Product');
     Citruscart::load('CitruscartHelperUser', 'helpers.user');
     $user_id = JFactory::getUser()->id;
     if ($isPOS) {
         $user_id = $app->input->getInt('user_id', $user_id);
         //$user_id = JRequest::getInt( 'user_id', $user_id );
     }
     $filter_group = CitruscartHelperUser::getUserGroup($user_id, $product_id);
     $qty = isset($values['product_qty']) && !empty($values['product_qty']) ? $values['product_qty'] : 1;
     $model->setState('filter_group', $filter_group);
     $model->setState('product.qty', $qty);
     $model->setState('user.id', $user_id);
     $row = $model->getItem(false, true, false);
     if ($row->product_notforsale || Citruscart::getInstance()->get('shop_enabled') == '0') {
         return $html;
     }
     // This enable this helper method to be used outside of Citruscart
     if ($isPOS) {
         $view->set('_controller', 'pos');
         $view->set('_view', 'pos');
     } else {
         $view->addTemplatePath(JPATH_SITE . '/components/com_citruscart/views/products/tmpl');
         $view->addTemplatePath(JPATH_SITE . '/templates/' . JFactory::getApplication('site')->getTemplate() . '/html/com_citruscart/products/');
         // add extra templates
         $view->addTemplatePath(Citruscart::getPath('product_buy_templates'));
         $view->set('_controller', 'products');
         $view->set('_view', 'products');
     }
     $view->set('_doTask', true);
     $view->set('hidemenu', true);
     $view->setModel($model, true);
     $view->setLayout($layout);
     $view->product_id = $product_id;
     $view->values = $values;
     $filter_category = $model->getState('filter_category', $app->input->getInt('filter_category', 0));
     //$filter_category = $model->getState( 'filter_category', JRequest::getInt( 'filter_category', ( int ) $values['filter_category'] ) );
     $view->filter_category = $filter_category;
     if ($isPOS) {
         $view->validation = "index.php?option=com_citruscart&view=pos&task=validate&format=raw";
     } else {
         $view->validation = "index.php?option=com_citruscart&view=products&task=validate&format=raw";
     }
     $config = Citruscart::getInstance();
     // TODO What about this??
     $show_shipping = $config->get('display_prices_with_shipping');
     if ($show_shipping) {
         $article_link = $config->get('article_shipping', '');
         $shipping_cost_link = JRoute::_('index.php?option=com_content&view=article&id=' . $article_link);
         $view->shipping_cost_link = $shipping_cost_link;
     }
     $quantity_min = 1;
     if ($row->quantity_restriction) {
         $quantity_min = $row->quantity_min;
     }
     $invalidQuantity = '0';
     $attributes = array();
     $attr_orig = array();
     if (empty($values)) {
         $product_qty = $quantity_min;
         // get the default set of attribute_csv
         if (!isset($row->default_attributes)) {
             $default_attributes = $helper_product->getDefaultAttributes($product_id);
         } else {
             $default_attributes = $row->default_attributes;
         }
         sort($default_attributes);
         $attributes_csv = implode(',', $default_attributes);
         $availableQuantity = $helper_product->getAvailableQuantity($product_id, $attributes_csv);
         if ($availableQuantity->product_check_inventory && $product_qty > $availableQuantity->quantity) {
             $invalidQuantity = '1';
         }
         $attr_orig = $attributes = $default_attributes;
     } else {
         $product_qty = !empty($values['product_qty']) ? (int) $values['product_qty'] : $quantity_min;
         // TODO only display attributes available based on the first selected attribute?
         foreach ($values as $key => $value) {
             if (substr($key, 0, 10) == 'attribute_') {
                 if (empty($value)) {
                     $attributes[$key] = 0;
                 } else {
                     $attributes[$key] = $value;
                 }
             }
         }
         if (!count($attributes)) {
             // no attributes are selected -> use default
             if (!isset($row->default_attributes)) {
                 $attributes = $helper_product->getDefaultAttributes($product_id);
             } else {
                 $attributes = $row->default_attributes;
             }
         }
         $attr_orig = $attributes;
         sort($attributes);
         // Add 0 to attributes to include all the root attributes
         //$attributes[] = 0;//remove this one. its causing the getAvailableQuantity to not get quantity because of wrong csv
         // For getting child opts
         $view->selected_opts = json_encode(array_merge($attributes, array('0')));
         $attributes_csv = implode(',', $attributes);
         // Integrity checks on quantity being added
         if ($product_qty < 0) {
             $product_qty = '1';
         }
         // using a helper file to determine the product's information related to inventory
         $availableQuantity = $helper_product->getAvailableQuantity($product_id, $attributes_csv);
         if ($availableQuantity->product_check_inventory && $product_qty > $availableQuantity->quantity) {
             $invalidQuantity = '1';
         }
     }
     // adjust the displayed price based on the selected or default attributes
     CitruscartHelperProduct::calculateProductAttributeProperty($row, $attr_orig, 'price', 'product_weight');
     $show_tax = $config->get('display_prices_with_tax');
     $show_product = $config->get('display_category_cartbuttons');
     $view->show_tax = $show_tax;
     $row->tax = '0';
     $row->taxtotal = '0';
     if ($show_tax) {
         // finish CitruscartHelperUser::getGeoZone -- that's why this isn't working
         Citruscart::load('CitruscartHelperUser', 'helpers.user');
         $geozones_user = CitruscartHelperUser::getGeoZones($user_id);
         if (empty($geozones_user)) {
             $geozones = array(Citruscart::getInstance()->get('default_tax_geozone'));
         } else {
             $geozones = array();
             foreach ($geozones_user as $value) {
                 $geozones[] = $value->geozone_id;
             }
         }
         Citruscart::load('CitruscartHelperTax', 'helpers.tax');
         $product = new stdClass();
         $product->product_price = $row->price;
         $product->product_id = $product_id;
         $tax = CitruscartHelperTax::calculateGeozonesTax(array($product), 2, $geozones);
         $row->taxtotal = $tax->tax_total;
         $row->tax = $tax->tax_total;
     }
     $row->_product_quantity = $product_qty;
     if ($page == 'product' || $isPOS) {
         $display_cartbutton = Citruscart::getInstance()->get('display_product_cartbuttons', '1');
     } else {
         $display_cartbutton = Citruscart::getInstance()->get('display_category_cartbuttons', '1');
     }
     $view->page = $page;
     $view->display_cartbutton = $display_cartbutton;
     $view->availableQuantity = $availableQuantity;
     $view->invalidQuantity = $invalidQuantity;
     if ($isPOS) {
         $view->product = $row;
     } else {
         $view->item = $row;
     }
     $dispatcher = JDispatcher::getInstance();
     ob_start();
     JFactory::getApplication()->triggerEvent('onDisplayProductAttributeOptions', array($row->product_id));
     $view->onDisplayProductAttributeOptions = ob_get_contents();
     ob_end_clean();
     $html = $view->loadTemplate();
     if (isset($view->callback_js) && !empty($view->callback_js)) {
         $callback_js = $view->callback_js;
     }
     return $html;
 }