Spade

Mini Shell

Directory:~$ /proc/self/root/home/lmsyaran/www/pusher/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ //proc/self/root/home/lmsyaran/www/pusher/com_phocacart.tar

assets/index.html000064400000000054151167552070010053
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>controller.php000064400000003136151167552070007454
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.application.component.controller' );

class PhocaCartController extends JControllerLegacy
{

	public function display($cachable = false, $urlparams = false)
	{

	
		if ( ! JFactory::getApplication()->input->get('view') ) {
			JFactory::getApplication()->input->set('view',
'categories' );
		}
		/*if (JFactory::getApplication()->input->get('view')
&& JFactory::getApplication()->input->get('view')
== 'feed') {
			// Default view for Feed is XML
			// Don't forget, this settings needs to have set router.php too -
in method PhocacartParseRoute()
			$this->getView('feed', 'xml');
		}*/


		//$paramsC 	= PhocacartUtils::getComponentParameters();
		$app		= JFactory::getApplication();
		$paramsC 	= $app->getParams();

		$cache 		= $paramsC->get( 'enable_cache', 0 );
		$cachable 	= false;
		if ($cache == 1) {
			$cachable 	= true;
		}

		$document 	= JFactory::getDocument();

		$safeurlparams =
array('catid'=>'INT','id'=>'INT','cid'=>'ARRAY','year'=>'INT','month'=>'INT','limit'=>'INT','limitstart'=>'INT',
			'showall'=>'INT','return'=>'BASE64','filter'=>'STRING','filter_order'=>'CMD','filter_order_Dir'=>'CMD','filter-search'=>'STRING','print'=>'BOOLEAN','lang'=>'CMD');

		parent::display($cachable,$safeurlparams);

		return $this;
	}
}
?>
controllers/account.php000064400000007530151167552070011275
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

class PhocaCartControllerAccount extends JControllerForm
{

	public function saveprofile()
	{
		// Check for request forgeries.
		JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));

		$app	= JFactory::getApplication();
		$model	= $this->getModel('Profile', 'UsersModel');
		$user	= PhocacartUser::getUser();
		$userId	= (int) $user->get('id');

		// Get the user data.
		$data 		= $app->input->post->get('jform', array(),
'array');
		$returnUrl 	= $app->input->post->get('return',
'', 'string');


		$lang = JFactory::getLanguage();
		//$lang->load('com_users.sys');
		$lang->load('com_users');

		// PHOCAEDIT
		jimport('joomla.application.component.model');
		//JLoader::import('user',JPATH_SITE.'/components/com_users/models');
		JModelLegacy::addIncludePath(JPATH_SITE.'/components/com_users/models');
		$model = JModelLegacy::getInstance( 'Profile',
'UsersModel' );
		$this->data	  = $model->getData();
		$loadformpath = JPATH_SITE.'/components/com_users/models';
		JForm::addFormPath($loadformpath.'/forms');
		JForm::addFieldPath($loadformpath.'/fields');
		//$this->form	  = $model->getForm();


		// Force the ID to this user.
		$data['id'] = $userId;

		// Validate the posted data.
		$form = $model->getForm();

		if (!$form)
		{
			throw new Exception($model->getError(), 500);
			return false;
		}

		// Validate the posted data.
		$data = $model->validate($form, $data);

		// Check for errors.
		if ($data === false)
		{
			// Get the validation messages.
			$errors	= $model->getErrors();

			// Push up to three validation messages out to the user.
			for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++)
			{
				if ($errors[$i] instanceof Exception)
				{
					$app->enqueueMessage($errors[$i]->getMessage(),
'warning');
				}
				else
				{
					$app->enqueueMessage($errors[$i], 'warning');
				}
			}

			// Save the data in the session.
			$app->setUserState('com_users.edit.profile.data', $data);

			// Redirect back to the edit screen.
			$userId = (int)
$app->getUserState('com_users.edit.profile.id');
			$this->setRedirect(base64_decode($returnUrl));
			return false;
		}

		// Attempt to save the data.
		$return	= $model->save($data);

		// Check for errors.
		if ($return === false)
		{
			// Save the data in the session.
			$app->setUserState('com_users.edit.profile.data', $data);

			// Redirect back to the edit screen.
			$userId = (int)
$app->getUserState('com_users.edit.profile.id');
			$this->setMessage(JText::sprintf('COM_USERS_PROFILE_SAVE_FAILED',
$model->getError()), 'warning');
			$this->setRedirect(base64_decode($returnUrl));
			return false;
		}

		// Redirect the user and adjust session state based on the chosen task.
		switch ($this->getTask())
		{
			case 'apply':
				// Check out the profile.
				$app->setUserState('com_users.edit.profile.id', $return);
				$model->checkout($return);

				// Redirect back to the edit screen.
				$this->setMessage(JText::_('COM_USERS_PROFILE_SAVE_SUCCESS'));
				$this->setRedirect(base64_decode($returnUrl));
				break;

			default:
				// Check in the profile.
				$userId = (int)
$app->getUserState('com_users.edit.profile.id');
				if ($userId)
				{
					$model->checkin($userId);
				}

				// Clear the profile id from the session.
				$app->setUserState('com_users.edit.profile.id', null);

				// Redirect to the list screen.
				$this->setMessage(JText::_('COM_USERS_PROFILE_SAVE_SUCCESS'));
				$this->setRedirect(base64_decode($returnUrl));
				break;
		}

		// Flush the data from the session.
		$app->setUserState('com_users.edit.profile.data', null);
	}

}
?>
controllers/checkout.json.php000064400000101774151167552070012423
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license   http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license   http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

class PhocaCartControllerCheckout extends JControllerForm
{
    // Set Region
    public function setregion() {

        if (!JSession::checkToken('request')) {
            $response = array(
                'status' => '0',
                'error' => '<div class="alert
alert-danger">' . JText::_('JINVALID_TOKEN') .
'</div>');
            echo json_encode($response);
            exit;
        }

        $app = JFactory::getApplication();
        $id  = $app->input->get('countryid', 0,
'int');

        //$model = $this->getModel('checkout');
        //$options = $model->getRegions($id);
        $options = PhocacartRegion::getRegionsByCountry($id);
        $o       = '';
        if (!empty($options)) {

            $o .= '<option value="">-&nbsp;'
. JText::_('COM_PHOCACART_SELECT_REGION') .
'&nbsp;-</option>';
            foreach ($options as $k => $v) {
                $o .= '<option value="' . $v->id .
'">' . htmlspecialchars($v->title) .
'</option>';
            }
        }
        $response = array(
            'status' => '1',
            'content' => $o);
        echo json_encode($response);
        exit;

    }

    // Change Data Box
    // a) Price Box
    // b) Stock Box
    // c) ID Box (SKU, EAN, ...)

	// We use common "data" for different parts (price box, stock
box, id box) so we need replace -data- class to specific for each case
	// e.g. -data- ==> -price-, -data- ==> -stock-, ... (not used in JS
but it can be used there)

    function changedatabox($tpl = null) {

        if (!JSession::checkToken('request')) {
            $response = array(
                'status' => '0',
                'error' => '<span
class="ph-result-txt ph-error-txt">' .
JText::_('JINVALID_TOKEN') . '</span>');
            echo json_encode($response);
            return;
        }

        $paramsC              = PhocacartUtils::getComponentParameters();
        $dynamic_change_price =
$paramsC->get('dynamic_change_price', 0);
        $dynamic_change_stock =
$paramsC->get('dynamic_change_stock', 0);
        $dynamic_change_id    =
$paramsC->get('dynamic_change_id', 0);
        $dynamic_change_image   =
$paramsC->get('dynamic_change_image', 0);

        $hide_add_to_cart_stock   =
$paramsC->get('hide_add_to_cart_stock', 0);
        $hide_add_to_cart_zero_price   =
$paramsC->get('hide_add_to_cart_zero_price', 0);



        $app       = JFactory::getApplication();
        $s         = PhocacartRenderStyle::getStyles();
        $attribute = $app->input->get('attribute',
'', 'array');
        $id        = $app->input->get('id', 0,
'int');
        $class     = $app->input->get('class',
'', 'string');
        $typeView  = $app->input->get('typeview',
'', 'string');

        $oA = array();

        // Sanitanize data and do the same level for all attributes:
        $aA = PhocacartAttribute::sanitizeAttributeArray($attribute);



        if ((int)$id > 0) {

            $price = new PhocacartPrice();
            $item  = PhocacartProduct::getProduct((int)$id);// We
don't need catid
            //$priceO = array();

            if (!empty($item)) {

                // ==================
                // PRICE
                $priceP = $price->getPriceItems($item->price,
$item->taxid, $item->taxrate, $item->taxcalculationtype,
$item->taxtitle, 0, '', 1, 1, $item->group_price);
                $price->getPriceItemsChangedByAttributes($priceP, $aA,
$price, $item, 1);


                $price->correctMinusPrice($priceP);


                if ($dynamic_change_price == 1) {


                    $d               = array();
                    $d['type']       = $item->type;
                    $d['s']          = $s;
                    $d['class']      =
str_replace('-data-', '-price-', $class);// change
common "data" class to specific one
                    $d['zero_price'] = 1;// Apply zero price if
possible
                    // Original Price
                   
$d['priceitemsorig']['bruttoformat'] = '';
                    if (isset($item->price_original) &&
$item->price_original != '' &&
(int)$item->price_original > 0) {
                       
$d['priceitemsorig']['bruttoformat'] =
$price->getPriceFormat($item->price_original);
                    }

                    $d['priceitems'] = $priceP;
                    $d['product_id'] = (int)$item->id;
                    $d['typeview']   = $typeView;


                    // Display discount price
                    // Move standard prices to new variable (product price
-> product discount)
                    $d['priceitemsdiscount'] =
$d['priceitems'];
                    $d['discount']           =
PhocacartDiscountProduct::getProductDiscountPrice($item->id,
$d['priceitemsdiscount']);

                    // Display cart discount (global discount) in product
views - under specific conditions only
                    // Move product discount prices to new variable
(product price -> product discount -> product discount cart)
                    $d['priceitemsdiscountcart'] =
$d['priceitemsdiscount'];
                    $d['discountcart']           =
PhocacartDiscountCart::getCartDiscountPriceForProduct($item->id,
$item->catid, $d['priceitemsdiscountcart']);

                    // Render the layout
                    $layoutP     = new
JLayoutFile('product_price', null, array('component'
=> 'com_phocacart'));

                    $oA['price'] = $layoutP->render($d);
                    $oA['priceitems'] =
$d['priceitems'];
                }


                // ==================
                // STOCK
                $stockStatus = array();
                $stock       =
PhocacartStock::getStockItemsChangedByAttributes($stockStatus, $aA, $item,
1);

                if ($dynamic_change_stock == 1) {


                    $o = '';
                    if ($stockStatus['stock_status'] ||
$stockStatus['stock_count'] !== false) {
                        $layoutS                  = new
JLayoutFile('product_stock', null, array('component'
=> 'com_phocacart'));
                        $d                        = array();
                        $d['s']                   = $s;
                        $d['class']               =
str_replace('-data-', '-stock-', $class);// change
common "data" class to specific one
                        $d['product_id']          = (int)$id;
                        $d['typeview']            = $typeView;
                        $d['stock_status_output'] =
PhocacartStock::getStockStatusOutput($stockStatus);

                        $oA['stock'] = $layoutS->render($d);

                        //$stock						=
(int)$stockStatus['stock_count'];// return stock anyway to enable
disable add to cart button if set
                    }
                    $oA['stockvalue'] = (int)$stock;
                }

                // ==================
                // ID (EAN, SKU, ...)
                if ($dynamic_change_id == 1) {
                    $id = new PhocacartId();
                    $id->getIdItemsChangedByAttributes($item, $aA, 1);

                    $d               = array();
                    $d['type']       = $item->type;
                    $d['s']          = $s;
                    $d['class']      =
str_replace('-data-', '-id-', $class);// change common
"data" class to specific one
                    $d['x']          = $item;
                    $d['product_id'] = (int)$item->id;
                    $d['typeview']   = $typeView;

                    // Render the layout
                    $layoutID = new JLayoutFile('product_id',
null, array('component' => 'com_phocacart'));
                    $oA['id'] = $layoutID->render($d);
                }

                // ================
                // IMAGE
                if ($dynamic_change_image == 2) {

                    $params = array();
                    $params['typeview'] = $typeView;

                    PhocacartImage::getImageItemsChangedByAttributes($item,
$aA, $params, 1);
                    $oA['image'] = $item->image;

                }


                // Should add to cart be displayed
                $oA['hideaddtocart'] = 1;
                $rights				= new PhocacartAccessRights();

                $priceA = isset($priceP['brutto']) ?
$priceP['brutto'] : 0;


                if($rights->canDisplayAddtocartAdvanced($item)
&& $rights->canDisplayAddtocartPrice($item, $priceA)  &&
$rights->canDisplayAddtocartStock($item, $stock)) {
		            $oA['hideaddtocart'] = 0;
                }

                $response = array(
                    'status' => '1',
                    'item' => $oA);
                echo json_encode($response);
                return;
            }
        }

        $response = array(
            'status' => '0',
            'items' => '');
        echo json_encode($response);
        return;


    }

    /*
    // Change pricebox
    function changepricebox($tpl = null) {

        if (!JSession::checkToken('request')) {
            $response = array(
                'status' => '0',
                'error' => '<span
class="ph-result-txt ph-error-txt">' .
JText::_('JINVALID_TOKEN') . '</span>');
            echo json_encode($response);
            return;
        }


        $app       = JFactory::getApplication();
        $s         = PhocacartRenderStyle::getStyles();
        $attribute = $app->input->get('attribute',
'', 'array');
        $id        = $app->input->get('id', 0,
'int');
        $class     = $app->input->get('class',
'', 'string');
        $typeView  = $app->input->get('typeview',
'', 'string');

        // Sanitanize data and do the same level for all attributes:
        $aA = PhocacartAttribute::sanitizeAttributeArray($attribute);




        if ((int)$id > 0) {
            $price = new PhocacartPrice();
            $item  = PhocacartProduct::getProduct((int)$id);// We
don't need catid
            //$priceO = array();

            if (!empty($item)) {

                $priceP = $price->getPriceItems($item->price,
$item->taxid, $item->taxrate, $item->taxcalculationtype,
$item->taxtitle, 0, '', 1, 1, $item->group_price);

                $price->getPriceItemsChangedByAttributes($priceP, $aA,
$price, $item, 1);


                $d               = array();
                $d['type']       = $item->type;
                $d['s']          = $s;
                $d['class']      = $class;
                $d['zero_price'] = 1;// Apply zero price if
possible
                // Original Price
                $d['priceitemsorig']['bruttoformat'] =
'';
                if (isset($item->price_original) &&
$item->price_original != '' &&
(int)$item->price_original > 0) {
                   
$d['priceitemsorig']['bruttoformat'] =
$price->getPriceFormat($item->price_original);
                }

                $d['priceitems'] = $priceP;
                $d['product_id'] = (int)$item->id;
                $d['typeview']   = $typeView;


                // Display discount price
                // Move standard prices to new variable (product price
-> product discount)
                $d['priceitemsdiscount'] =
$d['priceitems'];
                $d['discount']           =
PhocacartDiscountProduct::getProductDiscountPrice($item->id,
$d['priceitemsdiscount']);

                // Display cart discount (global discount) in product views
- under specific conditions only
                // Move product discount prices to new variable (product
price -> product discount -> product discount cart)
                $d['priceitemsdiscountcart'] =
$d['priceitemsdiscount'];
                $d['discountcart']           =
PhocacartDiscountCart::getCartDiscountPriceForProduct($item->id,
$item->catid, $d['priceitemsdiscountcart']);

                // Render the layout
                $layoutP = new JLayoutFile('product_price', null,
array('component' => 'com_phocacart'));
                //ob_start();
                $o = $layoutP->render($d);
                //$o = ob_get_contents();
                //ob_end_clean();


                $response = array(
                    'status' => '1',
                    'item' => $o);
                echo json_encode($response);
                return;
            }
        }

        $response = array(
            'status' => '0',
            'items' => '');
        echo json_encode($response);
        return;


    }

    // Change idbox (SKU, EAN, ...)
    function changeidbox($tpl = null) {

        if (!JSession::checkToken('request')) {
            $response = array(
                'status' => '0',
                'error' => '<span
class="ph-result-txt ph-error-txt">' .
JText::_('JINVALID_TOKEN') . '</span>');
            echo json_encode($response);
            return;
        }


        $app       = JFactory::getApplication();
        $s         = PhocacartRenderStyle::getStyles();
        $attribute = $app->input->get('attribute',
'', 'array');
        $id        = $app->input->get('id', 0,
'int');
        $class     = $app->input->get('class',
'', 'string');
        $typeView  = $app->input->get('typeview',
'', 'string');

        // Sanitanize data and do the same level for all attributes:
        $aA = PhocacartAttribute::sanitizeAttributeArray($attribute);

        if ((int)$id > 0) {
            $item = PhocacartProduct::getProduct((int)$id);// We don't
need catid
            if (!empty($item)) {

                $id = new PhocacartId();
                $id->getIdItemsChangedByAttributes($item, $aA, 1);

                $d               = array();
                $d['type']       = $item->type;
                $d['s']          = $s;
                $d['class']      = $class;
                $d['x']          = $item;
                $d['product_id'] = (int)$item->id;
                $d['typeview']   = $typeView;

                // Render the layout
                $layoutID = new JLayoutFile('product_id', null,
array('component' => 'com_phocacart'));
                //ob_start();
                $o = $layoutID->render($d);
                //$o = ob_get_contents();
                //ob_end_clean();

                $response = array(
                    'status' => '1',
                    'item' => $o);
                echo json_encode($response);
                return;
            }
        }

        $response = array(
            'status' => '0',
            'items' => '');
        echo json_encode($response);
        return;

    }

    // Change stockbox
    function changestockbox($tpl = null) {


        if (!JSession::checkToken('request')) {
            $response = array(
                'status' => '0',
                'error' => '<span
class="ph-result-txt ph-error-txt">' .
JText::_('JINVALID_TOKEN') . '</span>');
            echo json_encode($response);
            return;
        }

        $app       = JFactory::getApplication();
        $s         = PhocacartRenderStyle::getStyles();
        $attribute = $app->input->get('attribute',
'', 'array');
        $id        = $app->input->get('id', 0,
'int');
        $class     = $app->input->get('class',
'', 'string');
        $typeView  = $app->input->get('typeview',
'', 'string');

        // Sanitanize data and do the same level for all attributes:
        $aA = PhocacartAttribute::sanitizeAttributeArray($attribute);


        if ((int)$id > 0) {

            $item = PhocacartProduct::getProduct((int)$id);// We don't
need catid

            $stockStatus = array();
            $stock       =
PhocacartStock::getStockItemsChangedByAttributes($stockStatus, $aA, $item,
1);

            $o = '';
            if ($stockStatus['stock_status'] ||
$stockStatus['stock_count'] !== false) {
                $layoutS                  = new
JLayoutFile('product_stock', null, array('component'
=> 'com_phocacart'));
                $d                        = array();
                $d['s']                   = $s;
                $d['class']               = $class;
                $d['product_id']          = (int)$id;
                $d['typeview']            = $typeView;
                $d['stock_status_output'] =
PhocacartStock::getStockStatusOutput($stockStatus);

                $o = $layoutS->render($d);

                //$stock						=
(int)$stockStatus['stock_count'];// return stock anyway to enable
disable add to cart button if set
            }


            $response = array(
                'status' => '1',
                'stock' => (int)$stock,
                'item' => $o);
            echo json_encode($response);
            return;
        }


        $response = array(
            'status' => '0',
            'items' => '');
        echo json_encode($response);
        return;

    }*/

    // Add item to cart
    function add($tpl = null) {

        if (!JSession::checkToken('request')) {
            $response = array(
                'status' => '0',
                'error' => '<span
class="ph-result-txt ph-error-txt">' .
JText::_('JINVALID_TOKEN') . '</span>');
            echo json_encode($response);
            return;
        }


        $app                  = JFactory::getApplication();
        $s                    = PhocacartRenderStyle::getStyles();
        $item                 = array();
        $item['id']           =
$this->input->get('id', 0, 'int');
        $item['catid']        =
$this->input->get('catid', 0, 'int');
        $item['quantity']     =
$this->input->get('quantity', 0, 'int');
        $item['return']       =
$this->input->get('return', '',
'string');
        $item['attribute']    =
$this->input->get('attribute', array(), 'array');
        $item['checkoutview'] =
$this->input->get('checkoutview', 0, 'int');

        if ((int)$item['id'] > 0) {

            $itemP =
PhocacartProduct::getProduct((int)$item['id'],
$item['catid']);

            if (!empty($itemP)) {

                // Price (don't display add to cart when price is
zero)
                $price  = new PhocacartPrice();
                $priceP = $price->getPriceItems($itemP->price,
$itemP->taxid, $itemP->taxrate, $itemP->taxcalculationtype,
$itemP->taxtitle, 0, '', 1, 1, $itemP->group_price);
                $aA     =
PhocacartAttribute::sanitizeAttributeArray($item['attribute']);
                $price->getPriceItemsChangedByAttributes($priceP, $aA,
$price, $itemP, 1);
                $price->correctMinusPrice($priceP);
                $priceA = isset($priceP['brutto']) ?
$priceP['brutto'] : 0;

                // Stock (don't display add to cart when stock is
zero)
                $stockStatus = array();
                $stock       =
PhocacartStock::getStockItemsChangedByAttributes($stockStatus, $aA, $itemP,
1);

                $rights                                 = new
PhocacartAccessRights();
                $this->t['can_display_addtocart']       =
$rights->canDisplayAddtocartAdvanced($itemP);
                $this->t['can_display_addtocart_price'] =
$rights->canDisplayAddtocartPrice($itemP, $priceA);
                $this->t['can_display_addtocart_stock'] =
$rights->canDisplayAddtocartStock($itemP, $stock);

                $canDisplay = 1;
                if (!$this->t['can_display_addtocart']) {
                   
$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_NOT_ALLOWED_TO_ADD_PRODUCTS_TO_SHOPPING_CART'),
'error');
                    $canDisplay = 0;
                }

                if (!$this->t['can_display_addtocart_price'])
{
                   
$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_NOT_ALLOWED_TO_ADD_PRODUCTS_TO_SHOPPING_CART'),
'error');
                   
$app->enqueueMessage(JText::_('COM_PHOCACART_PRICE_IS_ZERO'),
'error');
                    $canDisplay = 0;
                }

                if (!$this->t['can_display_addtocart_stock'])
{
                   
$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_NOT_ALLOWED_TO_ADD_PRODUCTS_TO_SHOPPING_CART'),
'error');
                   
$app->enqueueMessage(JText::_('COM_PHOCACART_STOCK_IS_EMPTY'),
'error');
                    $canDisplay = 0;
                }

                if ($canDisplay == 0) {
                    $d             = array();
                    $d['s']        = $s;
                    $d['info_msg'] =
PhocacartRenderFront::renderMessageQueue();
                    $layoutPE      = new
JLayoutFile('popup_error', null, array('component'
=> 'com_phocacart'));
                    $oE            = $layoutPE->render($d);
                    $response      = array(
                        'status' => '0',
                        'popup' => $oE,
                        'error' => $d['info_msg']);
                    echo json_encode($response);
                    return;
                }

                $cart = new PhocacartCartRendercart();// is subclass of
PhocacartCart, so we can use only subclass

                // Get Phoca Cart Cart Module Parameters
                $module                                =
JModuleHelper::getModule('mod_phocacart_cart');
                $paramsM                               = new
JRegistry($module->params);
                $cart->params['display_image']         =
$paramsM->get('display_image', 0);
                $cart->params['display_checkout_link'] =
$paramsM->get('display_checkout_link', 1);

                $added = $cart->addItems((int)$item['id'],
(int)$item['catid'], (int)$item['quantity'],
$item['attribute']);

                if (!$added) {
                    $d             = array();
                    $d['s']        = $s;
                    $d['info_msg'] =
PhocacartRenderFront::renderMessageQueue();

                    $layoutPE = new JLayoutFile('popup_error',
null, array('component' => 'com_phocacart'));
                    $oE       = $layoutPE->render($d);
                    $response = array(
                        'status' => '0',
                        'popup' => $oE,
                        'error' => $d['info_msg']);
                    echo json_encode($response);
                    return;
                }

                //$catid	=
PhocacartProduct::getCategoryByProductId((int)$item['id']);
                $cart->setFullItems();

                $o = $o2 = '';
                // Content of the cart


                ob_start();
                echo $cart->render();
                $o = ob_get_contents();
                ob_end_clean();


                // Render the layout
                $d       = array();
                $d['s']  = $s;
                $layoutP = new JLayoutFile('popup_add_to_cart',
null, array('component' => 'com_phocacart'));

                $d['link_checkout'] =
JRoute::_(PhocacartRoute::getCheckoutRoute((int)$item['id'],
(int)$item['catid']));
                $d['link_continue'] = '';
                // It can happen that add to cart button will be e.g. in
module and when the module will be displayed on checkout site:
                // If yes and one item will be added per AJAX, we need to
refresh checkout site
                // If now and one item will be added per AJAX, everything
is OK, nothing needs to be refreshed
                $d['checkout_view'] =
(int)$item['checkoutview'];

                if ($added) {
                    $d['info_msg'] =
JText::_('COM_PHOCACART_PRODUCT_ADDED_TO_SHOPPING_CART');
                } else {
                    $d['info_msg'] =
JText::_('COM_PHOCACART_PRODUCT_NOT_ADDED_TO_SHOPPING_CART');
                }

                // Popup with info - Continue,Proceed to Checkout
                //ob_start();

                //$o2 = ob_get_contents();
                //ob_end_clean();


                $count  = $cart->getCartCountItems();
                $total  = "";
                $totalA = $cart->getCartTotalItems();
                if (!empty($totalA)) {
                     $layoutT = new JLayoutFile('cart_total',
null, array('component' => 'com_phocacart'));
                     $dT = array();
                     $dT['s']  = $s;
                     $dT['total'] = $totalA;

                     $total = $layoutT->render($dT);
                    //$total =
$price->getPriceFormat($totalA[0]['brutto']);
                    //$total = $totalA[0]['brutto'];
                }

                // Get the complete calculation total
                /*   $shippingEdit	= 0;
                   $shippingEdit	=
$app->input->get('shippingedit', 0, 'int');
                   $shippingId 	= $cart->getShippingId();
                   if (isset($shippingId) && (int)$shippingId >
0 && $shippingEdit == 0) {
                       $cart->addShippingCosts($shippingId);
                   }
                   // PAYMENT
                   $paymentEdit	= 0;
                   $paymentEdit	=
$app->input->get('paymentedit', 0, 'int');
                   $paymentMethod 	= $cart->getPaymentMethod();
                   if (isset($paymentMethod['id']) &&
(int)$paymentMethod['id'] > 0 && $paymentEdit == 0) {
                      
$cart->addPaymentCosts($paymentMethod['id']);
                   }*/
                $cart->roundTotalAmount();
                $d['total']    = $cart->getTotal();
                $d['products'] = $cart->getFullItems();
                $productKey    =
PhocacartProduct::getProductKey((int)$item['id'],
$item['attribute']);


                $d['product'] = array();
                if (isset($d['products'][0][$productKey])) {
                    $d['product'] =
$d['products'][0][$productKey];
                }

                $d['product']['current_added']     =
$added;
                $d['product']['current_id']        =
(int)$item['id'];
                $d['product']['current_catid']     =
(int)$item['catid'];
                $d['product']['current_quantity']  =
(int)$item['quantity'];
                $d['product']['current_attribute'] =
$item['attribute'];

                $o2 = $layoutP->render($d);

                $response = array(
                    'status' => '1',
                    'item' => $o,
                    'popup' => $o2,
                    'count' => $count,
                    'total' => $total);

                echo json_encode($response);
                return;

            } else {
               
$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_NOT_ADDED_TO_SHOPPING_CART'),
'error');
               
$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_NOT_FOUND'),
'error');
            }
        } else {
           
$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_NOT_ADDED_TO_SHOPPING_CART'),
'error');
           
$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_NOT_SELECTED'),
'error');
        }

        $d             = array();
        $d['s']        = $s;
        $d['info_msg'] =
PhocacartRenderFront::renderMessageQueue();

        $layoutPE = new JLayoutFile('popup_error', null,
array('component' => 'com_phocacart'));
        $oE       = $layoutPE->render($d);
        $response = array(
            'status' => '0',
            'popup' => $oE,
            'error' => $d['info_msg']);
        echo json_encode($response);
        return;
    }


    // Add item to cart
    function update($tpl = null) {

        if (!JSession::checkToken('request')) {
            $response = array(
                'status' => '0',
                'error' => '<span
class="ph-result-txt ph-error-txt">' .
JText::_('JINVALID_TOKEN') . '</span>');
            echo json_encode($response);
            return;
        }

        $msgSuffix            = '';
        $app                  = JFactory::getApplication();
        $s                    = PhocacartRenderStyle::getStyles();
        $item                 = array();
        $item['id']           =
$this->input->get('id', 0, 'int');
        $item['idkey']        =
$this->input->get('idkey', '',
'string');
        $item['quantity']     =
$this->input->get('quantity', 0, 'int');
        $item['catid']        =
$this->input->get('catid', 0, 'int');
        $item['ticketid']     =
$this->input->get('ticketid', 0, 'int');
        $item['quantity']     =
$this->input->get('quantity', 0, 'int');
        $item['return']       =
$this->input->get('return', '',
'string');
        $item['attribute']    =
$this->input->get('attribute', array(), 'array');
        $item['checkoutview'] =
$this->input->get('checkoutview', 0, 'int');
        $item['action']       =
$this->input->get('action', '',
'string');


        $rights = new PhocacartAccessRights();
        $itemProduct       =
PhocacartProduct::getProduct($item['id'],
$item['catid']);
        $this->t['can_display_addtocart'] =
$rights->canDisplayAddtocartAdvanced($itemProduct);

        if (!$this->t['can_display_addtocart']) {

           
$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_NOT_ALLOWED_TO_ADD_PRODUCTS_TO_SHOPPING_CART'),
'error');


            $d             = array();
            $d['s']        = $s;
            $d['info_msg'] =
PhocacartRenderFront::renderMessageQueue();
            $layoutPE      = new JLayoutFile('popup_error', null,
array('component' => 'com_phocacart'));
            $oE            = $layoutPE->render($d);
            $response      = array(
                'status' => '0',
                'popup' => $oE,
                'error' => $d['info_msg']);
            echo json_encode($response);
            return;
        }

        if ((int)$item['idkey'] != '' &&
$item['action'] != '') {

            $cart = new PhocacartCartRendercheckout();

            // Get Phoca Cart Cart Module Parameters
            $module                                =
JModuleHelper::getModule('mod_phocacart_cart');
            $paramsM                               = new
JRegistry($module->params);
            $cart->params['display_image']         =
$paramsM->get('display_image', 0);
            $cart->params['display_checkout_link'] =
$paramsM->get('display_checkout_link', 1);

            if ($item['action'] == 'delete') {
                $updated =
$cart->updateItemsFromCheckout($item['idkey'], 0);

                if (!$updated) {

                    $d      = array();
                    $d['s'] = $s;
                   
$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_PRODUCT_NOT_REMOVED_FROM_SHOPPING_CART')
. $msgSuffix, 'error');
                    $d['info_msg'] =
PhocacartRenderFront::renderMessageQueue();;
                    $layoutPE = new JLayoutFile('popup_error',
null, array('component' => 'com_phocacart'));
                    $oE       = $layoutPE->render($d);
                    $response = array(
                        'status' => '0',
                        'popup' => $oE,
                        'error' => $d['info_msg']);
                    echo json_encode($response);
                    return;
                }

                /*if ($updated) {
                   
$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_REMOVED_FROM_SHOPPING_CART')
. $msgSuffix, 'message');
                } else {
                   
$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_PRODUCT_NOT_REMOVED_FROM_SHOPPING_CART')
. $msgSuffix, 'error');
                }*/
            } else {// update
                $updated =
$cart->updateItemsFromCheckout($item['idkey'],
(int)$item['quantity']);

                if (!$updated) {

                    $d      = array();
                    $d['s'] = $s;
                   
$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_PRODUCT_QUANTITY_NOT_UPDATED')
. $msgSuffix, 'error');
                    $d['info_msg'] =
PhocacartRenderFront::renderMessageQueue();;
                    $layoutPE = new JLayoutFile('popup_error',
null, array('component' => 'com_phocacart'));
                    $oE       = $layoutPE->render($d);
                    $response = array(
                        'status' => '0',
                        'popup' => $oE,
                        'error' => $d['info_msg']);
                    echo json_encode($response);
                    return;
                }
                /*if ($updated) {
                   
$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_QUANTITY_UPDATED')
.$msgSuffix , 'message');
                } else {
                   
$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_PRODUCT_QUANTITY_NOT_UPDATED').
$msgSuffix, 'error');
                }*/
            }

            $cart->setFullItems();

            $o = $o2 = '';

            ob_start();
            echo $cart->render();
            $o = ob_get_contents();
            ob_end_clean();


            $count  = $cart->getCartCountItems();
            $total  = "";
            $totalA = $cart->getCartTotalItems();
            if (!empty($totalA)) {
                 $layoutT = new JLayoutFile('cart_total', null,
array('component' => 'com_phocacart'));
                 $dT = array();
                 $dT['s']  = $s;
                 $dT['total'] = $totalA;

                 $total = $layoutT->render($dT);
                //$total =
$price->getPriceFormat($totalA[0]['brutto']);
                //$total = $totalA[0]['brutto'];
            }

            $response = array(
                'status' => '1',
                'item' => $o,
                'popup' => $o2,
                'count' => $count,
                'total' => $total);

            echo json_encode($response);
            return;
        }

        $response = array(
            'status' => '0',
            'popup' => '',
            'error' => '');
        echo json_encode($response);
        return;

    }

}

?>
controllers/checkout.php000064400000127314151167552070011451
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license   http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license   http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

class PhocaCartControllerCheckout extends JControllerForm
{
    /*
     * Add product to cart
     */
    public function add() {

        JSession::checkToken() or jexit('Invalid Token');

        $app               = JFactory::getApplication();
        $item              = array();
        $item['id']        =
$this->input->get('id', 0, 'int');
        $item['catid']     =
$this->input->get('catid', 0, 'int');
        $item['quantity']  =
$this->input->get('quantity', 0, 'int');
        $item['return']    =
$this->input->get('return', '',
'string');
        $item['attribute'] =
$this->input->get('attribute', array(), 'array');


        if ((int)$item['id'] > 0) {

            $itemP =
PhocacartProduct::getProduct((int)$item['id'],
$item['catid']);

            if (!empty($itemP)) {

                // Price (don't display add to cart when price is
zero)
                $price  = new PhocacartPrice();
                $priceP = $price->getPriceItems($itemP->price,
$itemP->taxid, $itemP->taxrate, $itemP->taxcalculationtype,
$itemP->taxtitle, 0, '', 1, 1, $itemP->group_price);
                $aA     =
PhocacartAttribute::sanitizeAttributeArray($item['attribute']);
                $price->getPriceItemsChangedByAttributes($priceP, $aA,
$price, $itemP, 1);
                $price->correctMinusPrice($priceP);
                $priceA = isset($priceP['brutto']) ?
$priceP['brutto'] : 0;

                // Stock (don't display add to cart when stock is
zero)
                $stockStatus = array();

                $stock       =
PhocacartStock::getStockItemsChangedByAttributes($stockStatus, $aA, $itemP,
1);

                $rights                                 = new
PhocacartAccessRights();
                $this->t['can_display_addtocart']       =
$rights->canDisplayAddtocartAdvanced($itemP);
                $this->t['can_display_addtocart_price'] =
$rights->canDisplayAddtocartPrice($itemP, $priceA);
                $this->t['can_display_addtocart_stock'] =
$rights->canDisplayAddtocartStock($itemP, $stock);

                if (!$this->t['can_display_addtocart']) {
                   
$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_NOT_ALLOWED_TO_ADD_PRODUCTS_TO_SHOPPING_CART'),
'error');
                   
$app->redirect(base64_decode($item['return']));
                }

                if (!$this->t['can_display_addtocart_price'])
{
                   
$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_NOT_ALLOWED_TO_ADD_PRODUCTS_TO_SHOPPING_CART'),
'error');
                   
$app->enqueueMessage(JText::_('COM_PHOCACART_PRICE_IS_ZERO'),
'error');
                   
$app->redirect(base64_decode($item['return']));
                }

                if (!$this->t['can_display_addtocart_stock'])
{
                   
$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_NOT_ALLOWED_TO_ADD_PRODUCTS_TO_SHOPPING_CART'),
'error');
                   
$app->enqueueMessage(JText::_('COM_PHOCACART_STOCK_IS_EMPTY'),
'error');
                   
$app->redirect(base64_decode($item['return']));
                }


                $cart = new PhocacartCart();
                $added = $cart->addItems((int)$item['id'],
(int)$item['catid'], (int)$item['quantity'],
$item['attribute']);

                if ($added) {
                   
$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_ADDED_TO_SHOPPING_CART'),
'message');
                } else {
                   
$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_NOT_ADDED_TO_SHOPPING_CART'),
'error');
                }
            } else {
               
$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_NOT_ADDED_TO_SHOPPING_CART'),
'error');
               
$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_NOT_FOUND'),
'error');
            }
        } else {
           
$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_NOT_ADDED_TO_SHOPPING_CART'),
'error');
           
$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_NOT_SELECTED'),
'error');
        }

       
//$app->redirect(JRoute::_('index.php?option=com_phocacart&view=checkout'));
        $app->redirect(base64_decode($item['return']));
    }

    /*
     * Change currency
     */
    public function currency() {
        JSession::checkToken() or jexit('Invalid Token');
        $app            = JFactory::getApplication();
        $item           = array();
        $item['id']     = $this->input->get('id',
0, 'int');
        $item['return'] =
$this->input->get('return', '',
'string');

        //$currency = new PhocacartCurrency();
        //$currency->setCurrentCurrency((int)$item['id']);

        PhocacartCurrency::setCurrentCurrency((int)$item['id']);

        $app->redirect(base64_decode($item['return']));
    }

    /*
     * Save billing and shipping address
     */

    public function saveaddress() {

        JSession::checkToken() or jexit('Invalid Token');
        $app                    = JFactory::getApplication();
        $item                   = array();
        $item['return']         =
$this->input->get('return', '',
'string');
        $item['jform']          =
$this->input->get('jform', array(), 'array');
        $item['phcheckoutbsas'] =
$this->input->get('phcheckoutbsas', false,
'string');

        $paramsC                       =
PhocacartUtils::getComponentParameters();
        $delivery_billing_same_enabled =
$paramsC->get('delivery_billing_same_enabled', 0);

        if ((int)$delivery_billing_same_enabled == -1) {
            // if some shipping rule is based on shipping address and
"delivery_billing_same_enabled" parameter is completery removed
            // the check all the shipping rules completely
            $item['phcheckoutbsas'] = false;
        }

        $guest     = PhocacartUserGuestuser::getGuestUser();
        $error     = 0;
        $msgSuffix = '<span id="ph-msg-ns"
class="ph-hidden"></span>';
        if (!empty($item['jform'])) {

            // Form Data
            $billing     = array();
            $shipping    = array();
            $shippingPhs = array();// shipping including postfix

            $bas         =
PhocacartUser::convertAddressTwo($item['jform']);
            $billing     = $bas[0];
            $shipping    = $bas[1];
            $shippingPhs = $bas[2];


            // Form Items
            $fI    = new PhocacartFormItems();
            $items = $fI->getFormItems(1, 1, 0);
            $model = $this->getModel('checkout');
            $form  = $model->getForm();

            if (empty($form)) {
               
$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_NO_FORM_LOADED')
. $msgSuffix, 'error');
               
$app->redirect(base64_decode($item['return']));
                return false;
            }


            // Which filds will be validated or required
            // Reqiuired and Validate is handled differently because if
shipping address is d
            if (!empty($form->getFieldset('user'))) {

                foreach ($form->getFieldset('user') as $field)
{

                    $name = $field->fieldname;

                    if ($field->fieldname == 'email' ||
$field->fieldname == 'email_phs') {
                        // This is not a registration: Checkout or Account
(first form without option to change email)
                        // Email is not stored by registered users
                        // Email by guests can be the same like stored in
database (e.g. guest orders without login)
                        $form->setFieldAttribute($field->fieldname,
'unique', 'false');
                    }


                    if (isset($billing[$name])) {
                        // such field exists in billing, require it if set
in rules, validate
                    } else if (isset($shippingPhs[$name])) {
                        // such field exists in shipping, require it if set
in rules, validate


                        // Don't check the shipping as it is not
required
                        if ($item['phcheckoutbsas']) {

                            // CHECKBOX IS ON
                            $billing['ba_sa']  = 1;
                            $shipping['ba_sa'] = 1;

                           
$form->setFieldAttribute($field->fieldname, 'required',
'false');
                           
$form->setFieldAttribute($field->fieldname, 'validate',
'');
                        } else {
                            // CHECKBOX IS OFF
                            $billing['ba_sa']  = 0;
                            $shipping['ba_sa'] = 0;

                        }

                    } else {

                        // such field does not exist, don't require
it, don't validate
                        $form->setFieldAttribute($field->fieldname,
'required', 'false');
                        $form->setFieldAttribute($field->fieldname,
'validate', '');

                    }
                }
            } else {
               
$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_NO_FORM_LOADED')
. $msgSuffix, 'error');
               
$app->redirect(base64_decode($item['return']));
                return false;
            }

        } else {
           
$app->enqueueMessage(JText::_('COM_PHOCACART_NO_DATA_STORED')
. $msgSuffix, 'error');// Not used:
COM_PHOCACART_ERROR_NO_DATA_STORED
            $app->redirect(base64_decode($item['return']));
            return false;                                                  
         // as in fact this can be possible
        }                                                                  
         // that admin does not require any data


        $data = $item['jform'];
        $data = $model->validate($form, $data);

        if ($data === false) {

            $errors = $model->getErrors();

            for ($i = 0, $n = count($errors); $i < $n && $i <
20; $i++) {
                if ($errors[$i] instanceof Exception) {
                    $app->enqueueMessage($errors[$i]->getMessage(),
'warning');
                } else {
                    $app->enqueueMessage($errors[$i],
'warning');
                }

            }

           
$this->setRedirect(base64_decode($item['return']));
            return false;
        }

        if ($guest) {
            if ($item['phcheckoutbsas']) {
                $item['jform']['ba_sa'] = 1;
                foreach ($item['jform'] as $k => $v) {
                    $pos = strpos($k, '_phs');
                    if ($pos === false) {

                    } else {
                        unset($item['jform'][$k]);
                    }
                }
            }

            if (!$model->saveAddressGuest($item['jform'])) {
                $msg =
JText::_('COM_PHOCACART_ERROR_DATA_NOT_STORED');
                $app->enqueueMessage($msg . $msgSuffix,
'error');
                $error = 1;
            }

        } else {

            if (!empty($billing)) {
                if (!$model->saveAddress($billing)) {
                    $msg =
JText::_('COM_PHOCACART_ERROR_DATA_NOT_STORED');
                    $app->enqueueMessage($msg . $msgSuffix,
'error');
                    $error = 1;
                } else {
                    //$msg =
JText::_('COM_PHOCACART_SUCCESS_DATA_STORED');
                    //$app->enqueueMessage($msg, 'message');
                    // Waiting for shipping
                }
               
//$app->redirect(base64_decode($item['return']));
            }

            // Don't store shipping address when delivery and billing
address is the same
            if (!empty($shipping) &&
!$item['phcheckoutbsas']) {
                if (!$model->saveAddress($shipping, 1)) {
                    $msg =
JText::_('COM_PHOCACART_ERROR_DATA_NOT_STORED');
                    $app->enqueueMessage($msg . $msgSuffix,
'error');
                    $error = 1;
                } else {
                    //$msg =
JText::_('COM_PHOCACART_SUCCESS_DATA_STORED');
                    //$app->enqueueMessage($msg, 'message');
                    // Waiting for shipping
                }
               
//$app->redirect(base64_decode($item['return']));
            }
        }


        // Remove shipping because shipping methods can change while
chaning address
        $cart = new PhocacartCartRendercheckout();
        $cart->setType(array(0, 1));
        $cart->setFullItems();
        $cart->updateShipping();// will be decided if shipping or
payment will be removed
        $cart->updatePayment();

        $msg = JText::_('COM_PHOCACART_SUCCESS_DATA_STORED');
        if ($error != 1) {
            $app->enqueueMessage($msg, 'message');
        }

        $app->redirect(base64_decode($item['return']));
    }


    /*
    * Save shipping method
    */

    public function saveshipping() {

        JSession::checkToken() or jexit('Invalid Token');
        $app                   = JFactory::getApplication();
        $item                  = array();
        $item['return']        =
$this->input->get('return', '',
'string');
        $item['phshippingopt'] =
$this->input->get('phshippingopt', array(),
'array');
        $guest                 = PhocacartUserGuestuser::getGuestUser();
        $msgSuffix             = '<span id="ph-msg-ns"
class="ph-hidden"></span>';

        $checkPayment = 0;

        if (!empty($item['phshippingopt']) &&
isset($item['phshippingopt'][0]) &&
(int)$item['phshippingopt'][0] > 0) {

            $model = $this->getModel('checkout');

            if ($guest) {
                if
(!$model->saveShippingGuest((int)$item['phshippingopt'][0])) {
                    $msg =
JText::_('COM_PHOCACART_ERROR_DATA_NOT_STORED');
                    $app->enqueueMessage($msg . $msgSuffix,
'error');
                } else {
                    $msg =
JText::_('COM_PHOCACART_SUCCESS_DATA_STORED');
                    $app->enqueueMessage($msg, 'message');
                    $checkPayment = 1;
                }

            } else {
                if
(!$model->saveShipping((int)$item['phshippingopt'][0])) {
                    $msg =
JText::_('COM_PHOCACART_ERROR_DATA_NOT_STORED');
                    $app->enqueueMessage($msg . $msgSuffix,
'error');
                } else {
                    $msg =
JText::_('COM_PHOCACART_SUCCESS_DATA_STORED');
                    $app->enqueueMessage($msg, 'message');
                    $checkPayment = 1;
                }
            }

        } else {
            $msg =
JText::_('COM_PHOCACART_NO_SHIPPING_METHOD_SELECTED');
            $app->enqueueMessage($msg . $msgSuffix, 'error');
        }


        // CHECK PAYMENT
        if ($checkPayment == 1) {
            //PhocacartPayment::removePayment($guest, 0);// Don't
remove coupon by guests
            $cart = new PhocacartCartRendercheckout();
            $cart->setInstance(2);//checkout
            $cart->setType(array(0, 1));
            $cart->setFullItems();
           
$cart->updatePayment((int)$item['phshippingopt'][0]);// check
payment in cart if it is valid
        }


        $app->redirect(base64_decode($item['return']));
    }

    /*
     * Save payment method and coupons
     */

    public function savepayment() {

        JSession::checkToken() or jexit('Invalid Token');
        $app                  = JFactory::getApplication();
        $item                 = array();
        $item['return']       =
$this->input->get('return', '',
'string');
        $item['phpaymentopt'] =
$this->input->get('phpaymentopt', array(),
'array');
        $item['phcoupon']     =
$this->input->get('phcoupon', -1, 'string');// -1
... no form data, '' ... form data yes but empty (e.g. when
removing coupon)
        $item['phreward']     =
$this->input->get('phreward', -1, 'int');   // -1
... no form data, 0 ... form data yes but it is set to not use points (0)
        $guest                = PhocacartUserGuestuser::getGuestUser();
        $user                 = PhocacartUser::getUser();
        $params               = $app->getParams();
        $msgSuffix            = '<span id="ph-msg-ns"
class="ph-hidden"></span>';
        $guest_checkout       = $params->get('guest_checkout',
0);
        $enable_coupons       = $params->get('enable_coupons',
2);

        // Coupon
        // 1) we save payment without coupon form --> phcoupon = -1
==> $couponId = -1 (in model the coupon will be ignored when saving to
not change current value
        // 2) we save payment with coupon form and ask the coupon class for
$couponId
        // 2a) $couponId == -2 ... empty string was set which means to
remove coupon ==> $couponId = 0
        // 2b) $couponId == 0 ... coupon is not valid ==> $couponId = 0
        // 2c) $couponId > 0 ... coupon is valid ==> $couponId > 0
        //
        // What is the difference between 2a) and 2b) - in database there
is no difference but we need to differentiate messages for the customers
(coupon empty vs. coupon not valid)
        // IMPORTANT:
        // $item['phcoupon'] = -1 ... coupon is not included in
sent payment form
        // $couponId = -1 ... coupon will be ignored in model when saving
to database because to not change the current value
        // $coupoiId = -2 ... coupon was included in sent payment form but
it was empty (empty means that user just want to remove it), we need -2 for
message only, in database we set it to 0


        if (!empty($item['phpaymentopt']) &&
isset($item['phpaymentopt'][0]) &&
(int)$item['phpaymentopt'][0] > 0) {

            // Coupon
            if ($item['phcoupon'] === -1) {
                $couponId = -1;// coupon data was not sent in the form,
don't touch its data in db
            } else {
                $msgExists = 0;
                $couponId  =
$this->getCouponIdByCouponCode($item['phcoupon']);

                // Coupons disabled
                if ($enable_coupons == 0 &&
$item['phcoupon'] != '' &&
$item['phcoupon'] !== -1) {
                   
$app->enqueueMessage(JText::_('COM_PHOCACART_APPLYING_COUPONS_IS_DISABLED')
. $msgSuffix, 'error');
                    $couponId  = 0;// Remove coupon
                    $msgExists = 1;//
                }

                // Cupon only allowed for logged in users or guest checkout
                // Guest Checkout is still not enabled so we have message
for a) not logged in users or b) not started guest checkout users
                if ($enable_coupons == 2) {
                    if (!$guest) {
                        if ((int)$user->id < 1) {
                            if ($guest_checkout == 1) {
                               
$app->enqueueMessage(JText::_('COM_PHOCACART_PLEASE_LOG_IN_OR_ENABLE_GUEST_CHECKOUT_TO_APPLY_COUPON_FIRST')
. $msgSuffix, 'error');
                                $msgExists = 1;
                            } else {
                               
$app->enqueueMessage(JText::_('COM_PHOCACART_PLEASE_LOG_IN_TO_APPLY_COUPON_FIRST')
. $msgSuffix, 'error');
                                $msgExists = 1;
                            }
                            $couponId = 0;
                        }
                    }
                }

                if ($couponId === -2) {
                    // Coupon code is empty which means we remove the
coupon code
                    $msg =
JText::_('COM_PHOCACART_COUPON_NOT_SET');
                    $app->enqueueMessage($msg, 'message');
                    $couponId = 0;// Remove coupon
                } else if (!$couponId) {
                    // Coupon code just not valid
                    if ($msgExists == 1) {
                        // error message set so don't add another
message
                    } else {
                        $msg =
JText::_('COM_PHOCACART_COUPON_INVALID_EXPIRED_REACHED_USAGE_LIMIT');
                        $app->enqueueMessage($msg . $msgSuffix,
'error');
                    }


                    $couponId = 0;// Possible feature request - couponId
can be set to -1 to be ignored when saving. E.g. not valied coupon will not
remove previously added valid coupon
                } else {
                    // Coupon code successfuly tested
                    $msg =
JText::_('COM_PHOCACART_COUPON_ADDED');
                    $app->enqueueMessage($msg, 'message');
                }
            }


            // Reward Points
            if ($item['phreward'] === -1) {
                $rewards['used'] = -1;// reward points not sent
in the form, don't touch its data in db
            } else {

                $rewards =
$this->getRewardPointsByRewardPointsCode($item['phreward']);
                if ($rewards['used'] === false) {
                    $msg =
JText::_('COM_PHOCACART_REWARD_POINTS_NOT_ADDED');
                    $app->enqueueMessage($msg . $msgSuffix,
'error');
                } else {
                    $msg =
JText::_('COM_PHOCACART_REWARD_POINTS_ADDED');
                    $app->enqueueMessage($msg, 'message');
                }
            }


            $model = $this->getModel('checkout');

            if ($guest) {
                // 1) GUEST
                // Guest enabled
                if
(!$model->savePaymentAndCouponGuest((int)$item['phpaymentopt'][0],
$couponId)) {
                    $msg =
JText::_('COM_PHOCACART_ERROR_DATA_NOT_STORED');
                    $app->enqueueMessage($msg . $msgSuffix,
'error');
                } else {
                    $msg =
JText::_('COM_PHOCACART_SUCCESS_DATA_STORED');
                    $app->enqueueMessage($msg, 'message');
                }
            } else if ((int)$user->id < 1) {

                // 2) PRE-GUEST/PRE-LOGIN - NOT LOGGED IN OR STILL NOT
ENABLED GUEST CHECKOUT
                // Guest not enabled yet MOVECOUPON
                if
(!$model->savePaymentAndCouponGuest((int)$item['phpaymentopt'][0],
$couponId)) {
                    $msg =
JText::_('COM_PHOCACART_ERROR_DATA_NOT_STORED');
                    $app->enqueueMessage($msg . $msgSuffix,
'error');

                } else {
                    $msg =
JText::_('COM_PHOCACART_SUCCESS_DATA_STORED');
                    $app->enqueueMessage($msg, 'message');

                }

            } else {
                // 3) LOGGED IN USER
                if
(!$model->savePaymentAndCouponAndReward((int)$item['phpaymentopt'][0],
$couponId, $rewards['used'])) {
                    $msg =
JText::_('COM_PHOCACART_ERROR_DATA_NOT_STORED');
                    $app->enqueueMessage($msg . $msgSuffix,
'error');
                } else {
                    $msg =
JText::_('COM_PHOCACART_SUCCESS_DATA_STORED');
                    $app->enqueueMessage($msg, 'message');
                }
            }


        } else {
            $msg =
JText::_('COM_PHOCACART_NO_PAYMENT_METHOD_SELECTED');
            $app->enqueueMessage($msg . $msgSuffix, 'error');
        }
        $app->redirect(base64_decode($item['return']));
    }

    /*
     * Save coupon only
     */

    public function savecoupon() {


        /* There are following situations:
        a) user is not logged in and will log in - regarding coupon user is
taken as guest checkout (internally in session - so even guest checkout is
disabled)
        b) user is not logged in and will enable guest checkout - regarding
coupon user is taken as guestcheckou (internally in session - so even guest
checkout is disabled)
        c) user is logged in
        d) user enabled guest checkout
        */

        JSession::checkToken() or jexit('Invalid Token');
        $app              = JFactory::getApplication();
        $item             = array();
        $item['return']   =
$this->input->get('return', '',
'string');
        $item['phcoupon'] =
$this->input->get('phcoupon', '',
'string');
        $guest            = PhocacartUserGuestuser::getGuestUser();
        $user             = PhocacartUser::getUser();
        $params           = $app->getParams();
        $msgSuffix        = '<span id="ph-msg-ns"
class="ph-hidden"></span>';
        $guest_checkout   = $params->get('guest_checkout', 0);
        $enable_coupons   = $params->get('enable_coupons', 2);


        // Coupons disabled
        if ($enable_coupons == 0) {
           
$app->enqueueMessage(JText::_('COM_PHOCACART_APPLYING_COUPONS_IS_DISABLED'),
'error');
            $app->redirect(base64_decode($item['return']));
        }


        // Cupon only allowed for logged in users or guest checkout
        // Guest Checkout is still not enabled so we have message for a)
not logged in users or b) not started guest checkout users
        if ($enable_coupons == 2) {
            if (!$guest) {
                if ((int)$user->id < 1) {
                    if ($guest_checkout == 1) {
                       
$app->enqueueMessage(JText::_('COM_PHOCACART_PLEASE_LOG_IN_OR_ENABLE_GUEST_CHECKOUT_TO_APPLY_COUPON_FIRST'),
'error');
                    } else {
                       
$app->enqueueMessage(JText::_('COM_PHOCACART_PLEASE_LOG_IN_TO_APPLY_COUPON_FIRST'),
'error');
                    }
                   
$app->redirect(base64_decode($item['return']));
                }
            }
        }

        $couponId =
$this->getCouponIdByCouponCode($item['phcoupon']);

        $msgError = 0;
        if ($couponId === -2) {
            // Coupon code is empty which means we remove the coupon code
            $couponMessage =
JText::_('COM_PHOCACART_COUPON_NOT_SET');
            $couponId      = 0;
        } else if (!$couponId) {
            // Coupon code just not valid
            $couponMessage =
JText::_('COM_PHOCACART_COUPON_INVALID_EXPIRED_REACHED_USAGE_LIMIT');
            $couponId      = 0;
            $msgError      = 1;
        } else {
            // Coupon code successfuly tested
            $couponMessage =
JText::_('COM_PHOCACART_COUPON_ADDED');
        }


        $model = $this->getModel('checkout');

        if ($guest) {
            // 1) GUEST
            // Guest enabled
            if (!$model->saveCouponGuest($couponId)) {
                $msg = $couponMessage != '' ? $couponMessage :
JText::_('COM_PHOCACART_ERROR_DATA_NOT_STORED');
                $app->enqueueMessage($msg . $msgSuffix,
'error');

            } else {
                $msg = $couponMessage != '' ? $couponMessage :
JText::_('COM_PHOCACART_SUCCESS_DATA_STORED');

                $app->enqueueMessage($msg, 'message');
            }
        } else if ((int)$user->id < 1) {

            // 2) PRE-GUEST/PRE-LOGIN - NOT LOGGED IN OR STILL NOT ENABLED
GUEST CHECKOUT
            // Guest not enabled yet MOVECOUPON
            if (!$model->saveCouponGuest($couponId)) {
                $msg = $couponMessage != '' ? $couponMessage :
JText::_('COM_PHOCACART_ERROR_DATA_NOT_STORED');
                $app->enqueueMessage($msg . $msgSuffix,
'error');

            } else {
                $msg = $couponMessage != '' ? $couponMessage :
JText::_('COM_PHOCACART_SUCCESS_DATA_STORED');
                if ($msgError == 1) {
                    $app->enqueueMessage($msg . $msgSuffix,
'error');
                } else {
                    $app->enqueueMessage($msg, 'message');
                }

            }

        } else {

            // 3) LOGGED IN USER
            if (!$model->saveCoupon($couponId)) {
                $msg = $couponMessage != '' ? $couponMessage :
JText::_('COM_PHOCACART_ERROR_DATA_NOT_STORED');
                $app->enqueueMessage($msg . $msgSuffix,
'error');
            } else {
                $msg = $couponMessage != '' ? $couponMessage :
JText::_('COM_PHOCACART_SUCCESS_DATA_STORED');
                if ($msgError == 1) {
                    $app->enqueueMessage($msg . $msgSuffix,
'error');
                } else {
                    $app->enqueueMessage($msg, 'message');
                }
            }
        }

        $app->redirect(base64_decode($item['return']));
    }

    /*
     * return:
     * couponId = -2 (couponId = '') ... coupon code is empty,
e.g. when removing it (we use not dynamic variable)
     * couponId = 0 ... coupon code is not valid
     * couponId > 0 ... coupon code is valid
     */


    public function getCouponIdByCouponCode($code) {

        $app            = JFactory::getApplication();
        $params         = $app->getParams();
        $enable_coupons = $params->get('enable_coupons', 2);

        $couponId   = -2;
        $couponTrue = false;
        if (isset($code) && $code != '' &&
$enable_coupons > 0) {

            $coupon = new PhocacartCoupon();
            $coupon->setType(array(0, 1));
            $coupon->setCoupon(0, $code);
            //$couponTrue = $coupon->checkCoupon(1);// Basic Check -
Coupon True does not mean it is valid - only basic check done, whole check
happens in order
            //$couponTrue = $coupon->checkCoupon();// Complete Check -
mostly coupon is added at the end so do complete check - can be changed to
basic - no items, no categories can be checked

            $cart = new PhocacartCartRendercheckout();
            $cart->setInstance(2);//checkout
            $cart->setType(array(0, 1));
            $cart->setFullItems();
            $fullItems = $cart->getFullItems();
            $total     = $cart->getTotal();

            //$couponTrue		= $cart->getCouponValid();// cart itself
cannot say us if the coupon is valid, because this coupon was still not
added to the cart

            if (!empty($fullItems[4]) && !empty($total[4])) {
                foreach ($fullItems[4] as $k => $v) {
                    $validCoupon = $coupon->checkCoupon(0,
$v['id'], $v['catid'], $total[4]['quantity'],
$total[4]['netto']);

                    // !!! VALID COUPON
                    // In case the coupon is valid at least for one product
or one category it is then valid
                    // and will be divided into valid products/categories
                    // As global we mark it as valid - so change the valid
coupon variable only in case it is valid
                    if ($validCoupon == 1) {
                        $couponTrue = $validCoupon;
                        break;
                    }
                }
            }

            $couponId = 0;
            if ($couponTrue) {
                $couponData = $coupon->getCoupon();
                if (isset($couponData['id']) &&
$couponData['id'] > 0) {
                    $couponId = $couponData['id'];
                }
            }
        }

        return $couponId;
    }


    public function saverewardpoints() {


        JSession::checkToken() or jexit('Invalid Token');
        $app              = JFactory::getApplication();
        $item             = array();
        $item['return']   =
$this->input->get('return', '',
'string');
        $item['phreward'] =
$this->input->get('phreward', '',
'int');
        $guest            = PhocacartUserGuestuser::getGuestUser();
        //$user 	                = PhocacartUser::getUser();
        //$params 					= $app->getParams();
        $msgSuffix = '<span id="ph-msg-ns"
class="ph-hidden"></span>';


        // Reward Points
        $rewards =
$this->getRewardPointsByRewardPointsCode($item['phreward']);

        if ($rewards['used'] === false) {
            $rewardMessage =
JText::_('COM_PHOCACART_REWARD_POINTS_NOT_ADDED');
        } else {

            if ($rewards['used'] === 0) {
                $rewardMessage =
JText::_('COM_PHOCACART_REWARD_POINTS_REMOVED');
            } else {
                $rewardMessage =
JText::_('COM_PHOCACART_REWARD_POINTS_ADDED');
            }

        }

        $model = $this->getModel('checkout');

        if ($guest) {

        } else {

            if (!$model->saveRewardPoints($rewards['used'])) {
                $msg = $rewardMessage != '' ? $rewardMessage :
JText::_('COM_PHOCACART_ERROR_DATA_NOT_STORED');
                $app->enqueueMessage($msg . $msgSuffix,
'error');
            } else {
                $msg = $rewardMessage != '' ? $rewardMessage :
JText::_('COM_PHOCACART_SUCCESS_DATA_STORED');
                $app->enqueueMessage($msg, 'message');
            }
        }

        $app->redirect(base64_decode($item['return']));
    }


    public function getRewardPointsByRewardPointsCode($points) {

        $app            = JFactory::getApplication();
        $params         = $app->getParams();
        $enable_rewards = $params->get('enable_rewards', 1);


        $rewards         = array();
        $rewards['used'] = 0;

        if (isset($points) && $points != '' &&
$enable_rewards) {

            $reward          = new PhocacartReward();
            $rewards['used'] =
$reward->checkReward((int)$points, 1);
        }

        return $rewards;

    }


    /*
     * Update or delete from cart
     */
    public function update() {

        JSession::checkToken() or jexit('Invalid Token');
        $app              = JFactory::getApplication();
        $item             = array();
        $item['id']       =
$this->input->get('id', 0, 'int');
        $item['catid']    =
$this->input->get('catid', 0, 'int');
        $item['idkey']    =
$this->input->get('idkey', '',
'string');
        $item['quantity'] =
$this->input->get('quantity', 0, 'int');
        $item['return']   =
$this->input->get('return', '',
'string');
        $item['action']   =
$this->input->get('action', '',
'string');
        $msgSuffix        = '<span id="ph-msg-ns"
class="ph-hidden"></span>';


        $rights                           = new PhocacartAccessRights();
        $itemProduct                      =
PhocacartProduct::getProduct($item['id'],
$item['catid']);
        $this->t['can_display_addtocart'] =
$rights->canDisplayAddtocartAdvanced($itemProduct);


        if (!$this->t['can_display_addtocart']) {
           
$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_NOT_ALLOWED_TO_ADD_PRODUCTS_TO_SHOPPING_CART'),
'error');
            $app->redirect(base64_decode($item['return']));
        }

        if ((int)$item['idkey'] != '' &&
$item['action'] != '') {

            $cart = new PhocacartCart();
            if ($item['action'] == 'delete') {
                $updated =
$cart->updateItemsFromCheckout($item['idkey'], 0);
                if ($updated) {
                   
$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_REMOVED_FROM_SHOPPING_CART')
. $msgSuffix, 'message');
                } else {
                   
$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_PRODUCT_NOT_REMOVED_FROM_SHOPPING_CART')
. $msgSuffix, 'error');
                }
            } else {// update
                $updated =
$cart->updateItemsFromCheckout($item['idkey'],
(int)$item['quantity']);
                if ($updated) {
                   
$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_QUANTITY_UPDATED')
. $msgSuffix, 'message');
                } else {
                   
$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_PRODUCT_QUANTITY_NOT_UPDATED')
. $msgSuffix, 'error');
                }
            }
        }

       
//$app->redirect(JRoute::_('index.php?option=com_phocacart&view=checkout'));
        $app->redirect(base64_decode($item['return']));
    }
    /*
     public function saveshipping() {

        JSession::checkToken() or jexit( 'Invalid Token' );
        $app					= JFactory::getApplication();
        $item					= array();
        $item['return']			= $this->input->get(
'return', '', 'string'  );
        $item['phshippingopt']	= $this->input->get(
'phshippingopt', array(), 'array'  );


        if(!empty($item['phshippingopt']) &&
isset($item['phshippingopt'][0]) &&
(int)$item['phshippingopt'][0] > 0) {

            $model 	= $this->getModel('checkout');
           
if(!$model->saveShipping((int)$item['phshippingopt'][0])) {
                $msg =
JText::_('COM_PHOCACART_ERROR_DATA_NOT_STORED');
                $app->enqueueMessage($msg, 'error');
            } else {
                $msg =
JText::_('COM_PHOCACART_SUCCESS_DATA_STORED');
                $app->enqueueMessage($msg, 'message');
            }

        } else {
           
$app->enqueueMessage(JText::_('COM_PHOCACART_NO_SHIPPING_METHOD_SELECTED'),
'error');
        }
        $app->redirect(base64_decode($item['return']));
    }
    */
    /*
     * Make an order
     */

    public function order() {

        JSession::checkToken() or jexit('Invalid Token');
        $pC                                =
PhocacartUtils::getComponentParameters();
        $display_checkout_privacy_checkbox =
$pC->get('display_checkout_privacy_checkbox', 0);
        $display_checkout_toc_checkbox     =
$pC->get('display_checkout_toc_checkbox', 2);

        $app                   = JFactory::getApplication();
        $item                  = array();
        $item['return']        =
$this->input->get('return', '',
'string');
        $item['phcheckouttac'] =
$this->input->get('phcheckouttac', false,
'string');
        $item['privacy']       =
$this->input->get('privacy', false, 'string');
        $item['newsletter']    =
$this->input->get('newsletter', false, 'string');
        $item['phcomment']     =
$this->input->get('phcomment', '',
'string');
        $msgSuffix             = '<span id="ph-msg-ns"
class="ph-hidden"></span>';

        $item['privacy']       = $item['privacy'] ? 1 :
0;
        $item['phcheckouttac'] = $item['phcheckouttac']
? 1 : 0;
        $item['newsletter']    = $item['newsletter'] ?
1 : 0;


        if ($display_checkout_privacy_checkbox == 2 &&
$item['privacy'] == 0) {
            $msg =
JText::_('COM_PHOCACART_ERROR_YOU_NEED_TO_AGREE_TO_PRIVACY_TERMS_AND_CONDITIONS');
            $app->enqueueMessage($msg . $msgSuffix, 'error');
            $app->redirect(base64_decode($item['return']));
            return false;

        }

        if ($display_checkout_toc_checkbox == 2 &&
$item['phcheckouttac'] == 0) {
            $msg =
JText::_('COM_PHOCACART_ERROR_YOU_NEED_TO_AGREE_TO_TERMS_AND_CONDITIONS');
            $app->enqueueMessage($msg . $msgSuffix, 'error');
            $app->redirect(base64_decode($item['return']));
            return false;
        }


        $order     = new PhocacartOrder();
        $orderMade = $order->saveOrderMain($item);


        if (!$orderMade) {
            $msg = '';
            if (!PhocacartUtils::issetMessage()) {
                $msg =
JText::_('COM_PHOCACART_ORDER_ERROR_PROCESSING');
            }
            $app->enqueueMessage($msg . $msgSuffix, 'error');
            $app->redirect(base64_decode($item['return']));
            return true;
        } else {

            // Lets decide Payment plugin if the cart will be emptied or
not
            $cart           = new PhocacartCart();
            $paymentMethod 	= $cart->getPaymentMethod();
            $pluginData     = array();
            $pluginData['emptycart'] = true;
            if (isset($paymentMethod['id']) &&
(int)$paymentMethod['id'] > 0) {

                $payment		= new PhocacartPayment();
                $paymentO       =
$payment->getPaymentMethod((int)$paymentMethod['id']);

                if (isset($paymentO->method)) {
                    JPluginHelper::importPlugin('pcp',
htmlspecialchars(strip_tags($paymentO->method)));
                    $eventData 					= array();
                    $proceed 					= '';
                    $eventData['pluginname'] 	=
htmlspecialchars(strip_tags($paymentO->method));
                   
JFactory::getApplication()->triggerEvent('PCPbeforeEmptyCartAfterOrder',
array(&$proceed, &$pluginData, $pC, $paymentO->params, $order,
$eventData));
                }
            }

            if ($pluginData['emptycart'] === true) {
                $cart->emptyCart();
                PhocacartUserGuestuser::cancelGuestUser();
            }



            $action     = $order->getActionAfterOrder(); // Which action
should be done
            $message    = $order->getMessageAfterOrder();// Custom
message by payment plugin Payment/Download, Payment/No Download ...
            $dataOrder  = $order->getDataAfterOrder();// Order ID,
Token, payment ID, shipping ID ... different data for info view

            $session = JFactory::getSession();
            if ($action == 4 || $action == 3) {
                // Ordered OK, but now we proceed to payment
                $session->set('infoaction', $action,
'phocaCart');
                $session->set('infomessage', $message,
'phocaCart');
                $session->set('infodata', $dataOrder,
'phocaCart');
               
$app->redirect(JRoute::_(PhocacartRoute::getPaymentRoute(), false));
                return true;
                // This message should stay
                // when order - the message is created
                // when payment - the message stays unchanged
                // after payment - it will be redirected to info view and
there the message will be displayed and then deleted

            } else {
                // Ordered OK, but the payment method does not have any
instruction to proceed to payment (e.g. cash on delivery)
                //$msg =
JText::_('COM_PHOCACART_ORDER_SUCCESSFULLY_PROCESSED');
                // We produce not message but we redirect to specific view
with message and additional instructions
                //$app->enqueueMessage($msg, 'message');

                $session->set('infoaction', $action,
'phocaCart');
                $session->set('infomessage', $message,
'phocaCart');
                $session->set('infodata', $dataOrder,
'phocaCart');
                $app->redirect(JRoute::_(PhocacartRoute::getInfoRoute(),
false));
                return true;
            }
        }


    }

    public function setguest() {

        JSession::checkToken() or jexit('Invalid Token');
        $app            = JFactory::getApplication();
        $item           = array();
        $item['id']     = $this->input->get('id',
0, 'int');
        $item['return'] =
$this->input->get('return', '',
'string');
        $msgSuffix      = '<span id="ph-msg-ns"
class="ph-hidden"></span>';


        //$guest = new PhocacartUserGuestuser();
        //$set = $guest->setGuestUser((int)$item['id']);
        $set =
PhocacartUserGuestuser::setGuestUser((int)$item['id']);
        if ((int)$item['id'] == 1) {
            if ($set) {
               
$app->enqueueMessage(JText::_('COM_PHOCACART_YOU_PROCEEDING_GUEST_CHECKOUT')
. $msgSuffix, 'message');
            } else {
               
$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_DURING_PROCEEDING_GUESTBOOK_CHECKOUT')
. $msgSuffix, 'error');
            }
        } else {
            if ($set) {
               
$app->enqueueMessage(JText::_('COM_PHOCACART_GUEST_CHECKOUT_CANCELED')
. $msgSuffix, 'message');
            } else {
               
$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_DURING_CANCELING_GUESTBOOK_CHECKOUT')
. $msgSuffix, 'error');
            }
        }
       
//$app->redirect(JRoute::_('index.php?option=com_phocacart&view=checkout'));
        $app->redirect(base64_decode($item['return']));
    }
    /*
    public function compareadd() {

        JSession::checkToken() or jexit( 'Invalid Token' );
        $app				= JFactory::getApplication();
        $item				= array();
        $item['id']			= $this->input->get( 'id',
0, 'int' );
        $item['return']		= $this->input->get(
'return', '', 'string'  );

        $compare	= new PhocacartCompare();
        $added	= $compare->addItem((int)$item['id']);
        if ($added) {
           
$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_ADDED_TO_COMPARISON_LIST'),
'message');
        } else {
           
$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_NOT_ADDED_TO_COMPARISON_LIST'),
'error');
        }
       
//$app->redirect(JRoute::_('index.php?option=com_phocacart&view=checkout'));
        $app->redirect(base64_decode($item['return']));
    }

        public function compareremove() {

        JSession::checkToken() or jexit( 'Invalid Token' );
        $app				= JFactory::getApplication();
        $item				= array();
        $item['id']			= $this->input->get( 'id',
0, 'int' );
        $item['return']		= $this->input->get(
'return', '', 'string'  );

        $compare	= new PhocacartCompare();
        $added	= $compare->removeItem((int)$item['id']);
        if ($added) {
           
$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_REMOVED_FROM_COMPARISON_LIST'),
'message');
        } else {
           
$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_NOT_REMOVED_FROM_COMPARISON_LIST'),
'error');
        }
       
//$app->redirect(JRoute::_('index.php?option=com_phocacart&view=checkout'));
        $app->redirect(base64_decode($item['return']));
    }*/

}

?>
controllers/comparison.json.php000064400000011345151167552070012762
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

class PhocaCartControllerComparison extends JControllerForm
{

	public function add() {

		if (!JSession::checkToken('request')) {
			$response = array(
				'status' => '0',
				'error' => '<span class="ph-result-txt
ph-error-txt">' . JText::_('JINVALID_TOKEN') .
'</span>');
			echo json_encode($response);
			return;
		}

		$app					= JFactory::getApplication();
		$s 					    = PhocacartRenderStyle::getStyles();
		$item					= array();
		$item['id']				= $this->input->get( 'id', 0,
'int' );
		$item['catid']			= $this->input->get( 'catid',
0, 'int' );
		$item['return']			= $this->input->get(
'return', '', 'string'  );
		$item['comparisonview']	= $this->input->get(
'comparisonview', 0, 'int'  );

		$compare	= new PhocacartCompare();
		$added		= $compare->addItem((int)$item['id'],
(int)$item['catid']);
		//$catid		=
PhocacartProduct::getCategoryByProductId((int)$item['id']);

		$o = $o2 = '';
		// Content of the comparison list
		ob_start();
		echo $compare->renderList();
		$o = ob_get_contents();
		ob_end_clean();

		// Render the layout
		$d          = array();
		$d['s']		= $s;
		$layoutC	= new JLayoutFile('popup_add_to_compare', null,
array('component' => 'com_phocacart'));

		$d['link_comparison'] =
JRoute::_(PhocacartRoute::getComparisonRoute((int)$item['id']),
(int)$item['catid']);
		$d['link_continue'] = '';
		// We need to know if module is displayed on comparison site
		// If yes and one item will be deleted per AJAX, we need to refresh
comparison site
		// If now and one item will be deleted per AJAX, everything is OK,
nothing needs to be refreshed
		$d['comparison_view'] 	=
(int)$item['comparisonview'];

		if ($added) {
			$d['info_msg'] =
JText::_('COM_PHOCACART_PRODUCT_ADDED_TO_COMPARISON_LIST');
		} else {
			$d['info_msg'] =
JText::_('COM_PHOCACART_PRODUCT_NOT_ADDED_TO_COMPARISON_LIST');

			$mO = PhocacartRenderFront::renderMessageQueue();
			$d['info_msg_additional'] = $mO;
		}

		// Popup with info - Continue,Proceed to Comparison list
		//ob_start();
		$o2 = $layoutC->render($d);
		//$o2 = ob_get_contents();
		//ob_end_clean();

		$count = $compare->getComapareCountItems();

		$response = array(
			'status'	=> '1',
			'item'		=> $o,
			'popup'		=> $o2,
			'count'		=> $count);

		echo json_encode($response);
		return;
	}

	public function remove() {

		if (!JSession::checkToken('request')) {
			$response = array(
				'status' => '0',
				'error' => '<span class="ph-result-txt
ph-error-txt">' . JText::_('JINVALID_TOKEN') .
'</span>');
			echo json_encode($response);
			return;
		}

		$app 					= JFactory::getApplication();
		$s 					    = PhocacartRenderStyle::getStyles();
		$item					= array();
		$item['id']				= $this->input->get( 'id', 0,
'int' );
		$item['catid']			= $this->input->get( 'catid',
0, 'int' );
		$item['return']			= $this->input->get(
'return', '', 'string'  );
		$item['comparisonview']	= $this->input->get(
'comparisonview', 0, 'int'  );

		$compare	= new PhocacartCompare();
		$added		= $compare->removeItem((int)$item['id']);
		//$catid		=
PhocacartProduct::getCategoryByProductId((int)$item['id']);

		$o = $o2 = '';
		// Content of the comparison list
		ob_start();
		echo $compare->renderList();
		$o = ob_get_contents();
		ob_end_clean();

		// Render the layout
		$d          = array();
		$d['s']		= $s;
		$layoutC	= new JLayoutFile('popup_remove_from_compare', null,
array('component' => 'com_phocacart'));

		$d['link_comparison'] =
JRoute::_(PhocacartRoute::getComparisonRoute((int)$item['id']),
(int)$item['catid']);
		$d['link_continue'] = '';
		// We need to know if module is displayed on comparison site
		// If yes and one item will be deleted per AJAX, we need to refresh
comparison site
		// If now and one item will be deleted per AJAX, everything is OK,
nothing needs to be refreshed
		$d['comparison_view'] 	=
(int)$item['comparisonview'];



		if ($added) {
			$d['info_msg'] =
JText::_('COM_PHOCACART_PRODUCT_REMOVED_FROM_COMPARISON_LIST');
		} else {
			$d['info_msg'] =
JText::_('COM_PHOCACART_PRODUCT_NOT_REMOVED_FROM_COMPARISON_LIST');

			$mO = PhocacartRenderFront::renderMessageQueue();
			$d['info_msg_additional'] = $mO;
		}

		// Popup with info - Continue,Proceed to Comparison list
		//ob_start();
		$o2 = $layoutC->render($d);
		//$o2 = ob_get_contents();
		//ob_end_clean();

		$count = $compare->getComapareCountItems();

		$response = array(
			'status'	=> '1',
			'item'		=> $o,
			'popup'		=> $o2,
			'count'		=> $count);

		echo json_encode($response);
		return;
	}

}
?>
controllers/comparison.php000064400000003615151167552070012013
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

class PhocaCartControllerComparison extends JControllerForm
{
	
	public function add() { 
		
		JSession::checkToken() or jexit( 'Invalid Token' );
		$app				= JFactory::getApplication();
		$item				= array();
		$item['id']			= $this->input->get( 'id', 0,
'int' );
		$item['catid']		= $this->input->get( 'catid',
0, 'int' );
		$item['return']		= $this->input->get( 'return',
'', 'string'  );
		
		$compare	= new PhocacartCompare();
		$added	= $compare->addItem((int)$item['id'],
(int)$item['catid']);
		if ($added) {
			$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_ADDED_TO_COMPARISON_LIST'),
'message');
		} else {
			$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_NOT_ADDED_TO_COMPARISON_LIST'),
'error');
		}
		//$app->redirect(JRoute::_('index.php?option=com_phocacart&view=checkout'));
		$app->redirect(base64_decode($item['return']));
	}
	
		public function remove() {
		
		JSession::checkToken() or jexit( 'Invalid Token' );
		$app				= JFactory::getApplication();
		$item				= array();
		$item['id']			= $this->input->get( 'id', 0,
'int' );
		$item['return']		= $this->input->get( 'return',
'', 'string'  );
		
		$compare	= new PhocacartCompare();
		$added	= $compare->removeItem((int)$item['id']);
		if ($added) {
			$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_REMOVED_FROM_COMPARISON_LIST'),
'message');
		} else {
			$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_NOT_REMOVED_FROM_COMPARISON_LIST'),
'error');
		}
		//$app->redirect(JRoute::_('index.php?option=com_phocacart&view=checkout'));
		$app->redirect(base64_decode($item['return']));
	}
	
}
?>controllers/download.php000064400000003162151167552070011445
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

class PhocaCartControllerDownload extends JControllerForm
{
	public function download() {
	
		JSession::checkToken() or jexit( 'Invalid Token' );
		$app				= JFactory::getApplication();
		$item				= array();
		$item['id']			= $this->input->get( 'id', 0,
'int' );
		$item['return']		= $this->input->get( 'return',
'', 'string'  );
		
		if ($item['id'] > 0) {
			$download = PhocacartDownload::download($item['id']);
			if (!$download) {
				$app->enqueueMessage(JText::_('COM_PHOCACART_FILE_CANNOT_BE_DOWNLOADED'),
'error');
			}
		} else {
			$app->enqueueMessage(JText::_('COM_PHOCACART_NO_FILE_FOUND'),
'error');
		}
		
		$app->redirect(base64_decode($item['return']));
	}
	
	public function downloadpublic() {
	
		JSession::checkToken() or jexit( 'Invalid Token' );
		$app				= JFactory::getApplication();
		$item				= array();
		$item['id']			= $this->input->get( 'id', 0,
'int' );
		$item['return']		= $this->input->get( 'return',
'', 'string'  );
		
		if ($item['id'] > 0) {
			$download = PhocacartDownload::downloadPublic($item['id']);
			if (!$download) {
				$app->enqueueMessage(JText::_('COM_PHOCACART_FILE_CANNOT_BE_DOWNLOADED'),
'error');
			}
		} else {
			$app->enqueueMessage(JText::_('COM_PHOCACART_NO_FILE_FOUND'),
'error');
		}
		
		$app->redirect(base64_decode($item['return']));
	}
}
?>controllers/index.html000064400000000054151167552070011117
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>controllers/item.php000064400000004577151167552070010607
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

class PhocaCartControllerItem extends JControllerForm
{
	public function review() {

		JSession::checkToken() or jexit( 'Invalid Token' );
		//$paramsC 			= PhocacartUtils::getComponentParameters();
		$app				= JFactory::getApplication();
		$paramsC 			= $app->getParams();
		$approve_review 	= $paramsC->get( 'approve_review',0 );
		$u					= PhocacartUser::getUser();
		$item				= array();
		$item['id']			= $this->input->get( 'id', 0,
'int' );
		$item['catid']		= $this->input->get( 'catid',
0, 'int' );
		$item['rating']		= $this->input->get( 'rating',
0, 'int'  );
		$item['name']		= $this->input->get( 'name', 0,
'string'  );
		$item['review']		= $this->input->get( 'review',
0, 'string'  );
		$item['return']		= $this->input->get( 'return',
'', 'string'  );

		$errMsg = array();// Error message in this controller
		if ((int)$item['rating'] < 1) {
			$errorMsg[] = JText::_('COM_PHOCACART_PLEASE_ADD_RATING');
		}
		if ($item['name'] == '') {
			$errorMsg[] = JText::_('COM_PHOCACART_PLEASE_ADD_YOUR_NAME');
		}
		if ($item['review'] == '') {
			$errorMsg[] =
JText::_('COM_PHOCACART_PLEASE_ADD_YOUR_REVIEW');
		}
		if (!empty($errorMsg)) {
			$app->enqueueMessage(implode( '<br />', $errorMsg ),
'warning');
			$app->redirect(base64_decode($item['return']));
		}

		$error = 0;// Error message from database
		$added = PhocacartReview::addReview($error, $approve_review,
$item['id'], $u->id, $item['name'],
$item['rating'], $item['review']);

		if ($added) {
			$msg = JText::_('COM_PHOCACART_THANK_YOU_FOR_YOUR_REVIEW');
			if ($approve_review == 1) {
				$msg .= '. '.
JText::_('COM_PHOCACART_REVIEW_NEED_TO_BE_APPROVED_BEFORE_DISPLAYING').'.';
			}
			$app->enqueueMessage($msg, 'message');
		} else {
			if ($error == 1) {
				$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_YOU_HAVE_ALREADY_REVIEWED_THIS_PRODUCT'),
'warning');
			} else {
				$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_REVIEW_NOT_ADDED'),
'warning');
			}
		}
		//$app->redirect(JRoute::_('index.php?option=com_phocacart&view=checkout'));
		$app->redirect(base64_decode($item['return']));
	}
}
?>
controllers/pos.json.php000064400000071221151167552070011410
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

class PhocaCartControllerPos extends JControllerForm
{

	// Add item to cart
	function add($tpl = null){

		if (!JSession::checkToken('request')) {
			$response = array(
				'status' => '0',
				'error' => '<div class="ph-result-txt
ph-error-txt">' . JText::_('JINVALID_TOKEN') .
'</div>');
			echo json_encode($response);
			return;
		}



		$app					= JFactory::getApplication();

		$paramsC 				= PhocacartUtils::getComponentParameters();
		$pos_payment_force	= $paramsC->get( 'pos_payment_force', 0
);
		$pos_shipping_force	= $paramsC->get( 'pos_shipping_force', 0
);

		if ((int)$pos_payment_force > 0) {
            $pos_payment_force =
PhocacartPayment::isPaymentMethodActive($pos_payment_force) === true ?
(int)$pos_payment_force : 0;
        }
        if ((int)$pos_shipping_force > 0) {
            $pos_shipping_force =
PhocacartShipping::isShippingMethodActive($pos_shipping_force) === true ?
(int)$pos_shipping_force : 0;
        }

		$item					= array();
		$item['id']				= $this->input->get( 'id', 0,
'int' );
		$item['catid']			= $this->input->get( 'catid',
0, 'int' );
		$item['ticketid']		= $this->input->get(
'ticketid', 0, 'int' );
		$item['unitid']			= $this->input->get(
'unitid', 0, 'int' );
		$item['sectionid']		= $this->input->get(
'sectionid', 0, 'int' );
		$item['quantity']		= $this->input->get(
'quantity', 0, 'int'  );
		$item['return']			= $this->input->get(
'return', '', 'string'  );
		$item['attribute']		= $this->input->get(
'attribute', array(), 'array'  );
		$item['checkoutview']	= $this->input->get(
'checkoutview', 0, 'int'  );
		$item['sku']			= $this->input->get( 'sku',
'', 'string' );


		// Controller name in Joomla! is not called "pos" - it includes
task variable
		// so we need to set the name for controller to "pos"
		// so other parts of system (for example cart class know we are calling
it from pos controller)
		$this->input->set('controller', 'pos');

		// IMPORTANT
		$s 					    = PhocacartRenderStyle::getStyles();//MUST BE SET AFTER
$this->input->set('controller', 'pos'); TO GET
RIGHT CLASSES


		$user				= $vendor = $ticket = $unit	= $section = array();
		$dUser				= PhocacartUser::defineUser($user, $vendor, $ticket, $unit,
$section, 1);


		if (!isset($vendor->id) || (isset($vendor->id) &&
(int)$vendor->id < 1)) {
			$response = array(
				'status' => '0',
				'error' => '<div class="ph-result-txt
ph-error-txt">' .
JText::_('COM_PHOCACART_PLEASE_LOGIN_ACCESS_POS') .
'</div>');
			echo json_encode($response);
			return;
		}

		if (!PhocacartTicket::existsTicket((int)$vendor->id,
(int)$ticket->id, (int)$unit->id, (int)$section->id)) {
			$response = array(
				'status' => '0',
				'error' => '<div class="ph-result-txt
ph-error-txt">' .
JText::_('COM_PHOCACART_TICKET_DOES_NOT_EXIST') .
'</div>');
			echo json_encode($response);
			return;
		}

		if ($item['sku'] != '') {

			$preferredSku = PhocacartPos::getPreferredSku();// Select if SKU, EAN,
ISBN, etc.

			$productBySku =
PhocacartProduct::getProductIdBySku($item['sku'],
$preferredSku['name'], array(0,2));

			if (isset($productBySku['id']) &&
(int)$productBySku['id'] > 0 &&
isset($productBySku['catid']) &&
(int)$productBySku['catid'] > 0) {
				$item['id'] = (int)$productBySku['id'];
				$item['catid'] = (int)$productBySku['catid'];

				if (!empty($productBySku['attributes'])) {
					$item['attribute'] = $productBySku['attributes'];
				}
			} else {

				$response = array(
					'status' => '0',
					'error' => '<div class="ph-result-txt
ph-error-txt">' .
JText::_('COM_PHOCACART_PRODUCT_NOT_FOUND') .
'</div>');
				echo json_encode($response);
				return;

			}
		}



		$cart	= new PhocacartCartRendercheckout();
		$cart->setType(array(0,2));
		$cart->params['display_image'] 			= 1;
		$cart->params['display_checkout_link'] 	= 0;



		$added	= $cart->addItems((int)$item['id'],
(int)$item['catid'], (int)$item['quantity'],
$item['attribute'], '', array(0,2));

		if (!$added) {

			$d 				= array();
			$d['s']			= $s;
			$d['info_msg']	= PhocacartRenderFront::renderMessageQueue();;
			$layoutPE		= new JLayoutFile('popup_error', null,
array('component' => 'com_phocacart'));
			$oE 			= $layoutPE->render($d);
			$response = array(
				'status' => '0',
				'popup'	=> $oE,
				'error' => '<div class="ph-result-txt
ph-error-txt">' . $d['info_msg'] .
'</div>');
			echo json_encode($response);
			return;
		}

		$cart->setFullItems();
		$cart->updateShipping();// will be decided if shipping or payment will
be removed
        $cart->updatePayment();

		// When adding new product - shipping and payment is removed - don't
add it again from not updated class (this $cart instance does not include
the info about removed shipping and payment)
		// But there is an exception in case of forced payment or shipping
	//	if ((int)$pos_shipping_force > 0) {
			$shippingId = $cart->getShippingId();


			if (isset($shippingId) && (int)$shippingId > 0) {
				$cart->addShippingCosts($shippingId);
			}
	//	}

	//	if ((int)$pos_payment_force > 0) {
			$paymentId = $cart->getPaymentId();

			if (isset($paymentId) && (int)$paymentId > 0) {
				$cart->addPaymentCosts($paymentId);// validity of payment will be
checked
			}
	//	}


		$cart->roundTotalAmount();

		$o = $o2 = '';

		ob_start();
		echo $cart->render();
		$o = ob_get_contents();
		ob_end_clean();

		$price	= new PhocacartPrice();
		$count	= $cart->getCartCountItems();
		$total	= 0;
		$totalA	= $cart->getCartTotalItems();
		if (isset($totalA[0]['brutto'])) {
			//$total = $price->getPriceFormat($totalA['fbrutto']); Set
in Layout
			$total = $totalA[0]['brutto'];
		}




		$response = array(
			'status'	=> '1',
			'item'		=> $o,
			'message'	=> '<div class="ph-result-txt
ph-success-txt">' .
JText::_('COM_PHOCACART_PRODUCT_ADDED_TO_SHOPPING_CART') .
'</div>',
			'popup'		=> $o2,
			'count'		=> $count,
			'total'		=> $total);

		echo json_encode($response);
		return;


	}







	// Add item to cart
	function update($tpl = null){

		if (!JSession::checkToken('request')) {
			$response = array(
				'status' => '0',
				'error' => '<div class="ph-result-txt
ph-error-txt">' . JText::_('JINVALID_TOKEN') .
'</div>');
			echo json_encode($response);
			return;
		}




		$app				= JFactory::getApplication();

		$item				= array();
		$item['id']			= $this->input->get( 'id', 0,
'int' );
		$item['idkey']		= $this->input->get( 'idkey',
'', 'string' );
		$item['quantity']	= $this->input->get(
'quantity', 0, 'int'  );
		$item['catid']		= $this->input->get( 'catid',
0, 'int' );
		$item['ticketid']	= $this->input->get(
'ticketid', 0, 'int' );
		$item['unitid']		= $this->input->get( 'unitid',
0, 'int' );
		$item['sectionid']	= $this->input->get(
'sectionid', 0, 'int' );
		$item['quantity']	= $this->input->get(
'quantity', 0, 'int'  );
		$item['return']		= $this->input->get( 'return',
'', 'string'  );
		$item['attribute']	= $this->input->get(
'attribute', array(), 'array'  );
		$item['checkoutview']	= $this->input->get(
'checkoutview', 0, 'int'  );
		$item['action']		= $this->input->get( 'action',
'', 'string'  );

		// Controller name in Joomla! is not called "pos" - it includes
task variable
		// so we need to set the name for controller to "pos"
		// so other parts of system (for example cart class know we are calling
it from pos controller)
		$this->input->set('controller', 'pos');
		$s 					    = PhocacartRenderStyle::getStyles();//MUST BE SET AFTER
$this->input->set('controller', 'pos'); TO GET
RIGHT CLASSES

		$user				= $vendor = $ticket = $unit	= $section = array();
		$dUser				= PhocacartUser::defineUser($user, $vendor, $ticket, $unit,
$section, 1);

		if (!isset($vendor->id) || (isset($vendor->id) &&
(int)$vendor->id < 1)) {
			$response = array(
				'status' => '0',
				'error' => '<div class="ph-result-txt
ph-error-txt">' .
JText::_('COM_PHOCACART_PLEASE_LOGIN_ACCESS_POS') .
'</div>');
			echo json_encode($response);
			return;
		}
		if (!PhocacartTicket::existsTicket((int)$vendor->id,
(int)$ticket->id, (int)$unit->id, (int)$section->id)) {
			$response = array(
				'status' => '0',
				'error' => '<div class="ph-result-txt
ph-error-txt">' .
JText::_('COM_PHOCACART_TICKET_DOES_NOT_EXIST') .
'</div>');
			echo json_encode($response);
			return;
		}


		if ((int)$item['idkey'] != '' &&
$item['action'] != '') {

			$cart	= new PhocacartCartRendercheckout();
			$cart->setType(array(0,2));
			$cart->params['display_image'] 			= 1;
			$cart->params['display_checkout_link'] 	= 0;

			if ($item['action'] == 'delete') {
				$updated	= $cart->updateItemsFromCheckout($item['idkey'],
0);

				if (!$updated) {

					$d 				= array();
					$d['s']			= $s;
					$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_PRODUCT_NOT_REMOVED_FROM_SHOPPING_CART')
. $msgSuffix, 'error');
					$d['info_msg']	=
PhocacartRenderFront::renderMessageQueue();;
					$layoutPE		= new JLayoutFile('popup_error', null,
array('component' => 'com_phocacart'));
					$oE 			= $layoutPE->render($d);
					$response = array(
						'status' => '0',
						'popup'	=> $oE,
						'error' => $d['info_msg']);
					echo json_encode($response);

					return;
				}


				/*if ($updated) {
					$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_REMOVED_FROM_SHOPPING_CART')
. $msgSuffix, 'message');
				} else {
					$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_PRODUCT_NOT_REMOVED_FROM_SHOPPING_CART')
. $msgSuffix, 'error');
				}*/
			} else {// update
				$updated	= $cart->updateItemsFromCheckout($item['idkey'],
(int)$item['quantity']);

				if (!$updated) {

					$d 				= array();
					$d['s']			= $s;
					$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_PRODUCT_QUANTITY_NOT_UPDATED').
$msgSuffix, 'error');
					$d['info_msg']	= PhocacartRenderFront::renderMessageQueue();
					$layoutPE		= new JLayoutFile('popup_error', null,
array('component' => 'com_phocacart'));
					$oE 			= $layoutPE->render($d);
					$response = array(
						'status' => '0',
						'popup'	=> $oE,
						'error' => $d['info_msg']);
					echo json_encode($response);

					return;
				}
				/*if ($updated) {
					$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_QUANTITY_UPDATED')
.$msgSuffix , 'message');
				} else {
					$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_PRODUCT_QUANTITY_NOT_UPDATED').
$msgSuffix, 'error');
				}*/
			}


			$cart->setFullItems();

			$cart->updateShipping();// will be decided if shipping or payment
will be removed
        	$cart->updatePayment();

			$shippingId 	= $cart->getShippingId();

			if (isset($shippingId) && (int)$shippingId > 0) {
				$cart->addShippingCosts($shippingId);
			}

			$paymentMethod 	= $cart->getPaymentMethod();
			if (isset($paymentMethod['id']) &&
(int)$paymentMethod['id'] > 0) {
				$cart->addPaymentCosts($paymentMethod['id']);// validity
of payment will be checked
			}


			$cart->roundTotalAmount();

			$o = $o2 = '';

			ob_start();
			echo $cart->render();
			$o = ob_get_contents();
			ob_end_clean();

			$price	= new PhocacartPrice();
			$count	= $cart->getCartCountItems();
			$total	= 0;
			$totalA	= $cart->getCartTotalItems();
			if (isset($totalA[0]['brutto'])) {
				//$total = $price->getPriceFormat($totalA['fbrutto']); Set
in Layout
				$total = $totalA[0]['brutto'];
			}



			$message = $item['action'] == 'delete' ?
JText::_('COM_PHOCACART_PRODUCT_REMOVED_FROM_SHOPPING_CART') :
JText::_('COM_PHOCACART_PRODUCT_QUANTITY_UPDATED');
			$response = array(
				'status'	=> '1',
				'item'		=> $o,
				'message'	=> '<div class="ph-result-txt
ph-success-txt">' . $message . '</div>',
				'popup'		=> $o2,
				'count'		=> $count,
				'total'		=> $total);

			echo json_encode($response);
			return;
		} else {



			// No action, no id - only refresh the cart (information about ticketid,
unitid, sectionid set in cart)
			$cart	= new PhocacartCartRendercheckout();
			$cart->setType(array(0,2));
			$cart->params['display_image'] 			= 1;
			$cart->params['display_checkout_link'] 	= 0;
			// Ticket id set by ticket class
			$cart->setFullItems();




			$cart->updateShipping();// will be decided if shipping or payment
will be removed
        	$cart->updatePayment();


        	$db 	= JFactory::getDBO();
			$query = ' SELECT shipping FROM #__phocacart_cart_multiple AS
a'
					.' WHERE a.vendor_id = 211';
			$db->setQuery($query);
			$vendor = $db->loadObject();


			$shippingId 	= $cart->getShippingId();

			if (isset($shippingId) && (int)$shippingId > 0) {
				$cart->addShippingCosts($shippingId);
			}

			$paymentMethod 	= $cart->getPaymentMethod();
			if (isset($paymentMethod['id']) &&
(int)$paymentMethod['id'] > 0) {
				$cart->addPaymentCosts($paymentMethod['id']);// validity
of payment will be checked
			}



			$cart->roundTotalAmount();

			$o = $o2 = '';

			ob_start();
			echo $cart->render();
			$o = ob_get_contents();
			ob_end_clean();

			$price	= new PhocacartPrice();
			$count	= $cart->getCartCountItems();
			$total	= 0;
			$totalA	= $cart->getCartTotalItems();

			if (isset($totalA[0]['brutto'])) {
				//$total = $price->getPriceFormat($totalA['fbrutto']); Set
in Layout
				$total = $totalA[0]['brutto'];
			}





			$response = array(
				'status'	=> '1',
				'item'		=> $o,
				'popup'		=> $o2,
				'count'		=> $count,
				'total'		=> $total);

			echo json_encode($response);
			return;
		}

		$response = array(
			'status' => '0',
			'popup'	=> '',
			'error' => '');
		echo json_encode($response);
		return;

	}



	function savecustomer($tpl = null){

		if (!JSession::checkToken('request')) {
			$response = array(
				'status' => '0',
				'error' => '<div class="ph-result-txt
ph-error-txt">' . JText::_('JINVALID_TOKEN') .
'</div>');
			echo json_encode($response);
			return;
		}

		$app							= JFactory::getApplication();

		$item							= array();
		$item['id']						= $this->input->get( 'id', 0,
'int' );
		$item['card']					= $this->input->get( 'card',
'', 'string' );
		$item['loyalty_card_number'] 	= '';

		// Controller name in Joomla! is not called "pos" - it includes
task variable
		// so we need to set the name for controller to "pos"
		// so other parts of system (for example cart class know we are calling
it from pos controller)
		$this->input->set('controller', 'pos');
		$s 					    = PhocacartRenderStyle::getStyles();//MUST BE SET AFTER
$this->input->set('controller', 'pos'); TO GET
RIGHT CLASSES
		$user				= $vendor = $ticket = $unit	= $section = array();
		$dUser				= PhocacartUser::defineUser($user, $vendor, $ticket, $unit,
$section, 1);

		if (!isset($vendor->id) || (isset($vendor->id) &&
(int)$vendor->id < 1)) {
			$response = array(
				'status' => '0',
				'error' => '<div class="ph-result-txt
ph-error-txt">' .
JText::_('COM_PHOCACART_PLEASE_LOGIN_ACCESS_POS') .
'</div>');
			echo json_encode($response);
			return;
		}
		if (!PhocacartTicket::existsTicket((int)$vendor->id,
(int)$ticket->id, (int)$unit->id, (int)$section->id)) {
			$response = array(
				'status' => '0',
				'error' => '<div class="ph-result-txt
ph-error-txt">' .
JText::_('COM_PHOCACART_TICKET_DOES_NOT_EXIST') .
'</div>');
			echo json_encode($response);
			return;
		}

		if ($item['card'] != '') {


			$userByCardId = PhocacartUser::getUserIdByCard($item['card']);

			if (isset($userByCardId) && (int)$userByCardId > 0) {
				$item['id'] = (int)$userByCardId;
			} else {
				$item['id'] = 0;
				$item['loyalty_card_number'] = $item['card'];

			}
		}





		$updated = PhocacartPos::updateUserCart($vendor->id, $ticket->id,
$unit->id, $section->id, $item['id'],
$item['loyalty_card_number']);


		if ($updated) {

			// Remove shipping because shipping methods can change while chaning
users
			//PhocacartShipping::removeShippingAfterUpdate(0, 2);
			//PhocacartPayment::removePayment(0);
			$cart					= new PhocacartCartRendercheckout();
        	$cart->setType(array(0,2));
        	$cart->setFullItems();
        	$cart->updateShipping();// will be decided if shipping or
payment will be removed
			$cart->updatePayment();

			if ($item['id'] > 0 &&
$item['loyalty_card_number'] == '') {
				$msg = JText::_('COM_PHOCACART_SUCCESS_CUSTOMER_SELECTED');
			} else if ($item['loyalty_card_number'] != '') {
				$msg =
JText::_('COM_PHOCACART_SUCCESS_USER_NOT_FOUND_BY_LOYALTY_CARD_NUMBER');
				$msg .= '<br />' .
JText::_('COM_PHOCACART_ANONYMOUS_USER_SET');
			} else {
				$msg = JText::_('COM_PHOCACART_SUCCESS_CUSTOMER_DESELECTED');
			}

			$response = array(
				'status' => '1',
				'message'=> '<div class="ph-result-txt
ph-success-txt">' . $msg . '</div>');

			echo json_encode($response);
			return;
		} else {

			$response = array(
				'status' => '0',
				'error' => '<div class="ph-result-txt
ph-error-txt">' .
JText::_('COM_PHOCACART_ERROR_CART_NOT_UPDATED') .
'</div>');
			echo json_encode($response);
			return;
		}
	}


	public function saveshipping() {

	 	if (!JSession::checkToken('request')) {
			$response = array(
				'status' => '0',
				'error' => '<div class="ph-result-txt
ph-error-txt">' . JText::_('JINVALID_TOKEN') .
'</div>');
			echo json_encode($response);
			return;
		}

		$app		= JFactory::getApplication();

		$item		= array();
		$item['id']	= $this->input->get( 'id', 0,
'int'  );

		// Controller name in Joomla! is not called "pos" - it includes
task variable
		// so we need to set the name for controller to "pos"
		// so other parts of system (for example cart class know we are calling
it from pos controller)
		$this->input->set('controller', 'pos');
		$s 					    = PhocacartRenderStyle::getStyles();//MUST BE SET AFTER
$this->input->set('controller', 'pos'); TO GET
RIGHT CLASSES
		$user				= $vendor = $ticket = $unit	= $section = array();
		$dUser				= PhocacartUser::defineUser($user, $vendor, $ticket, $unit,
$section, 1);

		if (!isset($vendor->id) || (isset($vendor->id) &&
(int)$vendor->id < 1)) {
			$response = array(
				'status' => '0',
				'error' => '<div class="ph-result-txt
ph-error-txt">' .
JText::_('COM_PHOCACART_PLEASE_LOGIN_ACCESS_POS') .
'</div>');
			echo json_encode($response);
			return;
		}
		if (!PhocacartTicket::existsTicket((int)$vendor->id,
(int)$ticket->id, (int)$unit->id, (int)$section->id)) {
			$response = array(
				'status' => '0',
				'error' => '<div class="ph-result-txt
ph-error-txt">' .
JText::_('COM_PHOCACART_TICKET_DOES_NOT_EXIST') .
'</div>');
			echo json_encode($response);
			return;
		}

		$model 	= $this->getModel('pos');
		if(!$model->saveShipping((int)$item['id'])) {
			$msg = JText::_('COM_PHOCACART_ERROR_DATA_NOT_STORED');
			$app->enqueueMessage($msg, 'error');
			$response = array(
				'status' => '0',
				'error' => '<div class="ph-result-txt
ph-error-txt">' . PhocacartRenderFront::renderMessageQueue() .
'</div>');
			echo json_encode($response);
			return;
		} else {
			$msg = JText::_('COM_PHOCACART_SUCCESS_DATA_STORED');
			$app->enqueueMessage($msg, 'message');


			$response = array(
				'status' => '1',
				'message' => '<div class="ph-result-txt
ph-success-txt">' . PhocacartRenderFront::renderMessageQueue()
. '</div>');
			echo json_encode($response);
			return;
		}
	}



	public function savepayment() {

	 	if (!JSession::checkToken('request')) {
			$response = array(
				'status' => '0',
				'error' => '<div class="ph-result-txt
ph-error-txt">' . JText::_('JINVALID_TOKEN') .
'</div>');
			echo json_encode($response);
			return;
		}

		$app				= JFactory::getApplication();

		$item				= array();
		$item['id']			= $this->input->get( 'id', 0,
'int'  );
		$item['phcoupon']	= $this->input->get(
'phcoupon', '', 'string'  );
		$item['phreward']	= $this->input->get(
'phreward', '', 'int'  );
		$params 			= $app->getParams();

		$enable_coupons		= $params->get( 'enable_coupons', 2 );
		$enable_rewards		= $params->get( 'enable_rewards', 1 );

		// Controller name in Joomla! is not called "pos" - it includes
task variable
		// so we need to set the name for controller to "pos"
		// so other parts of system (for example cart class know we are calling
it from pos controller)
		$this->input->set('controller', 'pos');
		$s 					    = PhocacartRenderStyle::getStyles();//MUST BE SET AFTER
$this->input->set('controller', 'pos'); TO GET
RIGHT CLASSES
		$user				= $vendor = $ticket = $unit	= $section = array();
		$dUser				= PhocacartUser::defineUser($user, $vendor, $ticket, $unit,
$section, 1);

		if (!isset($vendor->id) || (isset($vendor->id) &&
(int)$vendor->id < 1)) {
			$response = array(
				'status' => '0',
				'error' => '<div class="ph-result-txt
ph-error-txt">' .
JText::_('COM_PHOCACART_PLEASE_LOGIN_ACCESS_POS') .
'</div>');
			echo json_encode($response);
			return;
		}
		if (!PhocacartTicket::existsTicket((int)$vendor->id,
(int)$ticket->id, (int)$unit->id, (int)$section->id)) {
			$response = array(
				'status' => '0',
				'error' => '<div class="ph-result-txt
ph-error-txt">' .
JText::_('COM_PHOCACART_TICKET_DOES_NOT_EXIST') .
'</div>');
			echo json_encode($response);
			return;
		}

		// Coupon
		$couponId = 0;

		if (isset($item['phcoupon']) &&
$item['phcoupon'] != '' && $enable_coupons >
0) {

			$coupon = new PhocacartCoupon();
			$coupon->setType(array(0,2));
			$coupon->setCoupon(0, $item['phcoupon']);

			$couponTrue = $coupon->checkCoupon(1);// Basic Check - Coupon True
does not mean it is valid

			$couponId 	= 0;


			if ($couponTrue) {
				$couponData = $coupon->getCoupon();
				if (isset($couponData['id']) &&
$couponData['id'] > 0) {
					$couponId = $couponData['id'];
				}
			}

			if(!$couponId) {
				$msg =
JText::_('COM_PHOCACART_COUPON_INVALID_EXPIRED_REACHED_USAGE_LIMIT');
				$app->enqueueMessage($msg, 'error');
			} else {
				$msg = JText::_('COM_PHOCACART_COUPON_ADDED');
				$app->enqueueMessage($msg, 'message');
			}
		}

		$rewards 			= array();
		$rewards['used'] 	= 0;

		if (isset($item['phreward']) &&
$item['phreward'] != '' && $enable_rewards) {

			$reward 			= new PhocacartReward();
			$rewards['used']	=
$reward->checkReward((int)$item['phreward'], 1);


			if($rewards['used'] === false) {
				$msg = JText::_('COM_PHOCACART_REWARD_POINTS_NOT_ADDED');
				$app->enqueueMessage($msg, 'error');
			} else {
				$msg = JText::_('COM_PHOCACART_REWARD_POINTS_ADDED');
				$app->enqueueMessage($msg, 'message');
			}

		}



		$model 	= $this->getModel('pos');


		if(!$model->savePaymentAndCouponAndReward((int)$item['id'],
$couponId, $rewards['used'])) {
			$msg = JText::_('COM_PHOCACART_ERROR_DATA_NOT_STORED');
			$app->enqueueMessage($msg, 'error');
			$response = array(
				'status' => '0',
				'error' => '<div class="ph-result-txt
ph-error-txt">' . PhocacartRenderFront::renderMessageQueue() .
'</div>');
			echo json_encode($response);
			return;
		} else {
			$msg = JText::_('COM_PHOCACART_SUCCESS_DATA_STORED');
			$app->enqueueMessage($msg, 'message');
			$response = array(
				'status' => '1',
				'message' => '<div class="ph-result-txt
ph-success-txt">' . PhocacartRenderFront::renderMessageQueue()
. '</div>');
			echo json_encode($response);
			return;
		}
	}


	/*public function printserver() {

		$app				= JFactory::getApplication();
		$item				= array();
		$params 			= $app->getParams();
		$pos_server_print	= $params->get( 'pos_server_print', 0 );
		$item['id']			= $this->input->get( 'id', 0,
'int'  );// Order ID

	}*/


	public function order() {


		if (!JSession::checkToken('request')) {
			$response = array(
				'status' => '0',
				'error' => '<div class="ph-result-txt
ph-error-txt">' . JText::_('JINVALID_TOKEN') .
'</div>');
			echo json_encode($response);
			return;
		}

		$app				= JFactory::getApplication();

		$item				= array();

		$item									= array();
		$item['amount_tendered']				= $this->input->get(
'phAmountTendered', '', 'string'  );
		$item['amount_pay']						= $this->input->get(
'phTotalAmount', '', 'string'  );
		//$item['amount_change']					= $this->input->get(
'phAmountChange', '', 'string'  );


		if ($item['amount_pay'] > 0 &&
$item['amount_tendered'] > 0) {
			$item['amount_change'] = $item['amount_tendered'] -
$item['amount_pay'];
		} else if ($item['amount_pay'] > 0) {

			$item['amount_tendered']= 0;
			$item['amount_change']	= 0;
		} else {
			$item['amount_tendered']= 0;
			$item['amount_pay']		= 0;
			$item['amount_change']	= 0;
		}

		$params 			= $app->getParams();
		$pos_server_print	= $params->get( 'pos_server_print', 0 );

		// Controller name in Joomla! is not called "pos" - it includes
task variable
		// so we need to set the name for controller to "pos"
		// so other parts of system (for example cart class know we are calling
it from pos controller)
		$this->input->set('controller', 'pos');
		$s 					    = PhocacartRenderStyle::getStyles();//MUST BE SET AFTER
$this->input->set('controller', 'pos'); TO GET
RIGHT CLASSES
		$user				= $vendor = $ticket = $unit	= $section = array();
		$dUser				= PhocacartUser::defineUser($user, $vendor, $ticket, $unit,
$section, 1);

		if (!isset($vendor->id) || (isset($vendor->id) &&
(int)$vendor->id < 1)) {
			$response = array(
				'status' => '0',
				'error' => '<div class="ph-result-txt
ph-error-txt">' .
JText::_('COM_PHOCACART_PLEASE_LOGIN_ACCESS_POS') .
'</div>');
			echo json_encode($response);
			return;
		}
		if (!PhocacartTicket::existsTicket((int)$vendor->id,
(int)$ticket->id, (int)$unit->id, (int)$section->id)) {
			$response = array(
				'status' => '0',
				'error' => '<div class="ph-result-txt
ph-error-txt">' .
JText::_('COM_PHOCACART_TICKET_DOES_NOT_EXIST') .
'</div>');
			echo json_encode($response);
			return;
		}





		$order = new PhocacartOrder();
		$order->setType(array(0,2));
		$orderMade = $order->saveOrderMain($item);



		if(!$orderMade) {
			$msg = '';
			if (!PhocacartUtils::issetMessage()){
				$msg = JText::_('COM_PHOCACART_ORDER_ERROR_PROCESSING');
			}
			$app->enqueueMessage($msg, 'error');
			$response = array(
				'status' => '0',
				'error' => '<div class="ph-result-txt
ph-error-txt">' . PhocacartRenderFront::renderMessageQueue() .
'</div>');
			echo json_encode($response);
			return;

		} else {

			$cart = new PhocacartCart();

			// Before removing current cart after payment get the info about current
vendor,ticket,unit,section
			// to create new empty ticket after payment
			$vendorId			= $cart->getVendorId();
			$ticketId			= $cart->getTicketId();
			$unitId				= $cart->getUnitId();
			$sectionId			= $cart->getSectionId();

			$cart->emptyCart();
			PhocacartUserGuestuser::cancelGuestUser();

			$action 	= $order->getActionAfterOrder();// Which action should be
done
			$message	= $order->getMessageAfterOrder();// Custom message by
payment plugin Payment/Download, Payment/No Download ...


			// Create empty ticket (with the same ticket, unit and section) after
this current was removed
			PhocacartTicket::addNewVendorTicket($vendorId, $ticketId, $unitId,
$sectionId);
		/*	$msg = '';
			if (!empty($message)) {
				foreach ($message as $k => $v) {
					print r($v);
				}
			}*/
			$msg =
JText::_('COM_PHOCACART_ORDER_HAS_BEEN_SAVED_SUCCESSFULLY');


			// PRINT SERVER PRINT
			if ($pos_server_print == 1 || $pos_server_print == 3) {
				$order	= new PhocacartOrderRender();
				$o = $order->render((int)$orderMade, 4, 'raw',
'', 1);

				try{

					$printPos = new PhocacartPosPrint(1);
					$printPos->printOrder($o);
					//echo JText::_('COM_PHOCACART_RECEIPT_SENT_TO_PRINTER');
				} catch(Exception $e) {
					$msg .= "<br />" .
JText::_('COM_PHOCACART_ERROR'). ': '.
$e->getMessage();
					/*$response = array(
					'status' => '1',
					'id'	=> (int)$orderMade,
					'message' => '<div class="ph-result-txt
ph-error-txt">' .$msg . '</div>');
					echo json_encode($response);
					return;*/
				}


			}

			$session 	= JFactory::getSession();
			if ($action == 4 || $action == 3) {
				// Ordered OK, but now we proceed to payment
				//$session->set('infoaction', $action,
'phocaCart');
				//$session->set('infomessage', $message,
'phocaCart');
				$response = array(
				'status' => '1',
				'id'	=> (int)$orderMade,
				'message' => '<div class="ph-result-txt
ph-success-txt">' .$msg . '</div>');
				echo json_encode($response);
				return;
				//return true;
				// This message should stay
				// when order - the message is created
				// when payment - the message stays unchanged
				// after payment - it will be redirected to info view and there the
message will be displayed and then deleted

			} else {
				// Ordered OK, but the payment method does not have any instruction to
proceed to payment (e.g. cash on delivery)
				//$msg =
JText::_('COM_PHOCACART_ORDER_SUCCESSFULLY_PROCESSED');
				// We produce not message but we redirect to specific view with message
and additional instructions
				//$app->enqueueMessage($msg, 'message');
				$response = array(
				'status' => '1',
				'id'	=> (int)$orderMade,
				'message' => '<div class="ph-result-txt
ph-success-txt">' .$msg . '</div>');
				echo json_encode($response);
				return;
				//$session->set('infoaction', $action,
'phocaCart');
				//$session->set('infomessage', $message,
'phocaCart');
				//$app->redirect(JRoute::_(PhocacartRoute::getInfoRoute(), false));
				return true;
			}
		}


	}
}
?>
controllers/pos.php000064400000010133151167552070010433 0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

use Joomla\CMS\Uri\Uri;

class PhocaCartControllerPos extends JControllerForm
{

	public function addticket() {

		JSession::checkToken() or jexit( 'Invalid Token' );
		$app 				= JFactory::getApplication();
		$session 			= JFactory::getSession();
		$item				= array();
		$item['return']		= $this->input->get( 'return',
'', 'string'  );
		$item['unitid']		= $this->input->get( 'unitid',
0, 'int'  );
		$item['sectionid']	= $this->input->get(
'sectionid', 0, 'int'  );
		$user				= $vendor = $ticket = $unit	= $section = array();
		$dUser				= PhocacartUser::defineUser($user, $vendor, $ticket, $unit,
$section, 1);

		if (isset($vendor->id) && (int)$vendor->id > 0) {
			$lastTicket = PhocacartTicket::getLastVendorTicket((int)$vendor->id,
(int)$item['unitid'], (int)$item['sectionid']);

			if (!isset($lastTicket) || (isset($lastTicket)&&
(int)$lastTicket == 0)) {
				// Create the default ticket: 1
				$added = PhocaCartTicket::addNewVendorTicket((int)$vendor->id, 1,
(int)$item['unitid'], (int)$item['sectionid']);
				if ($added) {
					$lastTicket = 1;

				}
			}
			if (isset($lastTicket) && (int)$lastTicket > 0) {
				$ticket = $lastTicket + 1;

				$added = PhocaCartTicket::addNewVendorTicket((int)$vendor->id,
(int)$ticket, (int)$item['unitid'],
(int)$item['sectionid']);
				if ($added) {
					$url = base64_decode($item['return']);
					$uri = Uri::getInstance(base64_decode($item['return']));
					//$oldTicketId = $uri->getVar('ticketid');
					$uri->setVar('ticketid', $ticket);
					$app->redirect($uri->toString());
					return true;
				}
			}
		}
		$app->redirect(base64_decode($item['return']));
	}

	public function removeticket() {

		JSession::checkToken() or jexit( 'Invalid Token' );
		$app 				= JFactory::getApplication();
		$session 			= JFactory::getSession();
		$item				= array();
		$item['return']		= $this->input->get( 'return',
'', 'string'  );
		$item['ticketid']	= $this->input->get(
'ticketid', 0, 'int'  );
		$item['unitid']		= $this->input->get( 'unitid',
0, 'int'  );
		$item['sectionid']	= $this->input->get(
'sectionid', 0, 'int'  );
		$user				= $vendor = $ticket = $unit	= $section = array();
		$dUser				= PhocacartUser::defineUser($user, $vendor, $ticket, $unit,
$section, 1);

		if (isset($vendor->id) && (int)$vendor->id > 0) {

			//if (isset($lastTicket) && (int)$lastTicket > 0) {

				$removed = PhocaCartTicket::removeVendorTicket((int)$vendor->id,
(int)$item['ticketid'], (int)$item['unitid'],
(int)$item['sectionid']);
				if ($removed) {
					$url = base64_decode($item['return']);
					$uri = Uri::getInstance(base64_decode($item['return']));
					//$oldTicketId = $uri->getVar('ticketid');
					$uri->setVar('ticketid', 1);
					$app->redirect($uri->toString());
					return true;
				}
			//}
		}
		$app->redirect(base64_decode($item['return']));

	}

	/*
	 * Add product to cart
	 * see pos.json
	 */
	public function add() {

		JSession::checkToken() or jexit( 'Invalid Token' );
		$app				= JFactory::getApplication();
		$item				= array();
		$item['id']			= $this->input->get( 'id', 0,
'int' );
		$item['catid']		= $this->input->get( 'catid',
0, 'int' );
		$item['quantity']	= $this->input->get(
'quantity', 0, 'int'  );
		$item['return']		= $this->input->get( 'return',
'', 'string'  );
		$item['attribute']	= $this->input->get(
'attribute', array(), 'array'  );

		/*
		$cart	= new PhocacartCart();

		$added	= $cart->addItems((int)$item['id'],
(int)$item['catid'], (int)$item['quantity'],
$item['attribute']);

		if ($added) {
			$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_ADDED_TO_SHOPPING_CART'),
'message');
		} else {
			$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_NOT_ADDED_TO_SHOPPING_CART'),
'error');
		}
		//$app->redirect(JRoute::_('index.php?option=com_phocacart&view=checkout'));*/

		$app->redirect(base64_decode($item['return']));
	}


}
?>
controllers/question.php000064400000031266151167552070011513
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

class PhocaCartControllerQuestion extends JControllerForm
{

	function submit() {

		JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
		$session = JFactory::getSession();

		$app    = JFactory::getApplication();
		$uri 	= \Joomla\CMS\Uri\Uri::getInstance();
		$user 	= PhocacartUser::getUser();

		$params 							= PhocacartUtils::getComponentParameters() ;
		$enable_ask_question 				=
$params->get('enable_ask_question', 0);
		$display_question_privacy_checkbox	= $params->get(
'display_question_privacy_checkbox', 0 );

		if ($enable_ask_question == 0) {
			throw new
Exception(JText::_('COM_PHOCACART_ASK_QUESTION_DISABLED'), 500);
			return false;
		}

		$namespace  		= 'phccrt' .
$params->get('session_suffix');
		$data  				= $this->input->post->get('jform', array(),
'array');
		$item['privacy']	= $this->input->get(
'privacy', false, 'string'  );

		$data['privacy'] 	= $item['privacy'] ? 1 : 0;

		if ($display_question_privacy_checkbox == 2 &&
$data['privacy'] == 0) {
			$msg =
JText::_('COM_PHOCACART_ERROR_YOU_NEED_TO_AGREE_TO_PRIVACY_TERMS_AND_CONDITIONS');
			$app->enqueueMessage($msg, 'error');
			$app->redirect(JRoute::_($uri));
			return false;

		}

		// Additional data
		$data['ip'] = PhocacartUtils::getIp();

		// Only because of information in LOG
		$productId = '';
		if (isset($data['product_id']) &&
(int)$data['product_id'] > 0) {
			$productId = (int)$data['product_id'];
		}

		// *** SECURITY
		// Default session test always enabled!
		$valid = $session->get('form_id', NULL, $namespace);
		$session->clear('form_id', $namespace);
		if (!$valid){
			$app->setUserState('com_phocacart.question.data',
'');
			$session->clear('time', $namespace);

			PhocacartLog::add(3, 'Ask a Question - Not valid session',
$productId, 'IP: '. $data['ip'].', User ID:
'.$user->id . ', User Name: '.$user->username);
			//jexit(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'));
			throw new
Exception(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'), 500);
			return false;
		}

		$model  = $this->getModel('question');

		// *** SECURITY
		// Hidden Field
		if ($params->get('enable_hidden_field_question', 0) == 1) {
			$params->set('hidden_field_id',
$session->get('hidden_field_id', 'fieldnotvalid',
$namespace));
			$params->set('hidden_field_name',
$session->get('hidden_field_name', 'fieldnotvalid',
$namespace));
			$hiddenField = $session->get('hidden_field_name',
'fieldnotvalid', $namespace);

			$session->clear('hidden_field_id', $namespace);
			$session->clear('hidden_field_name', $namespace);
			$session->clear('hidden_field_class', $namespace);

			if ($params->get('hidden_field_id') ==
'fieldnotvalid') {
				$app->setUserState('com_phocacart.question.data',
'');
				$session->clear('time', $namespace);

				PhocacartLog::add(3, 'Ask a Question - Hidden Field Error',
$productId, 'IP: '. $data['ip'].', User ID:
'.$user->id . ', User Name: '.$user->username);
				throw new
Exception(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'), 500);
				return false;
			}

			// Hidden field was filled
			if (isset($data[$hiddenField]) && $data[$hiddenField] !=
'') {
				$app->setUserState('com_phocacart.question.data',
'');
				$session->clear('time', $namespace);

				PhocacartLog::add(3, 'Ask a Question - Hidden Field Filled',
$productId, 'IP: '. $data['ip'].', User ID:
'.$user->id . ', User Name: '.$user->username);
				throw new
Exception(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'), 500);
				return false;
			}

		}

		// *** SECURITY
		// Check for a valid session cookie
		if($session->getState() != 'active'){
			// Save the data in the session.
			$app->setUserState('com_phocacart.submit.data', $data);
			$message = JText::_( 'COM_PHOCACART_SESSION_INVALID' );
			$app->enqueueMessage($message, 'error');

			PhocacartLog::add(3, 'Ask a Question - Session not active',
$productId, 'IP: '. $data['ip'].', User ID:
'.$user->id . ', User Name: '.$user->username.',
Message: '.$message);
			$app->redirect(JRoute::_($uri));
			return false;
		}

		// *** SECURITY
		// Task
		$task = $this->input->get('task');

		if ($task == 'phocacart.submit') {
			$task = 'submit';
		}
		if (($this->input->get('view') != 'question')
|| ($this->input->get('option') !=
'com_phocacart') || ($task != 'submit')) {
			$app->setUserState('com_phocacart.question.data',
'');
			$session->clear('time', $namespace);

			PhocacartLog::add(3, 'Ask a Question - No Phoca Cart part',
$productId, 'IP: '. $data['ip'].', User ID:
'.$user->id . ', User Name: '.$user->username);
			throw new
Exception(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'), 500);
			return false;
		}

		// *** SECURITY
		// Check Time
	    if((int)$params->get('enable_time_check_question', 0)
> 0) {
            $time = $session->get('time', null, $namespace);
            $delta = time() - $time;

			if($params->get('enable_time_check_question', 0) &&
$delta <= (int)$params->get('enable_time_check_question',
0)) {

				$app->setUserState('com_phocacart.question.data', $data);
				$message = JText::_( 'COM_PHOCACART_SUBMIT_TOO_FAST' );
				$app->enqueueMessage($message, 'error');

				PhocacartLog::add(3, 'Ask a Question - Submit too fast',
$productId, 'IP: '. $data['ip'].', User ID:
'.$user->id . ', User Name: '.$user->username.',
Message: '.$message . ', Time: '. $delta . '
sec.');
				$app->redirect(JRoute::_($uri));
				return false;
            }
        }

		// ***SECURITY
		// IP Ban
		if ($params->get('ip_ban', '') != '') {

			$isSpam = PhocacartSecurity::checkIpAddress($data['ip'],
$params->get('ip_ban'));

			if ($isSpam) {
				//$app->setUserState('com_phocacart.question.data',
$data);	// Save the data in the session.
				//$message = JText::_( 'COM_PHOCACART_POSSIBLE_SPAM_DETECTED'
);
				//$app->enqueueMessage($message, 'error');
				//$app->redirect(JRoute::_($uri));

				$app->setUserState('com_phocacart.question.data',
'');
				$session->clear('time', $namespace);

				PhocacartLog::add(3, 'Ask a Question - IP Ban', $productId,
'IP: '. $data['ip'].', User ID:
'.$user->id . ', User Name: '.$user->username);
				throw new
Exception(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'), 500);
				return false;
			}
		}

		// *** SECURITY
		// Validate the posted data.
		$form = $model->getForm();
		if (!$form) {
			$app->setUserState('com_phocacart.question.data',
'');
			$session->clear('time', $namespace);

			PhocacartLog::add(2, 'Ask a Question - ERROR - Model not
loaded', $productId, 'IP: '. $data['ip'].',
User ID: '.$user->id . ', User Name:
'.$user->username.', Message: '.$model->getError());
			throw new Exception($model->getError(), 500);
			return false;
		}

		// *** SECURITY
		// VALIDATE - continue with validation in case of problem
		$continueValidate 	= true;

		// SECURITY
		// Captcha - is validated in RULES of FORM FIELD - Exception for validate
fields
		$captchaId = 1;//Possible parameters in Options for different captchas
(reCaptcha = 1)
		switch ($captchaId) {
			case 1: // reCaptcha uses virtual field, so we cannot check the field
set in form
				$data['phq_captcha'] = 'OK';
			break;
		}

		$validate 			= $model->validate($form, $data);

		if ($validate === false) {
			$errors	= $model->getErrors();


			// Get (possible) attack issues
			for ($i = 0, $n = count($errors); $i < $n && $i < 5; $i++)
{


				if (($errors[$i] instanceof \Exception) &&
($errors[$i]->getCode() == E_ERROR)) {
					$app->setUserState('com_phocacart.question.data',
'');
					$session->clear('time', $namespace);

					PhocacartLog::add(2, 'Ask a Question - Validate errors',
$productId, 'IP: '. $data['ip'].', User ID:
'.$user->id . ', User Name: '.$user->username);

					$app->enqueueMessage(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'),
'error');
					$app->redirect(JRoute::_($uri));
					return false;
				} else {

					$app->enqueueMessage($errors[$i]->getMessage(),
'warning');
					$continueValidate = false;
				}

			}
			// Validate error message are now in stack, so no more render
			// just redirect back to the form with information about problems and
fill the form field
			$continueValidate = false;
		}


		$data = $validate;


		// *** SECURITY
		// Forbidden Word Filter
		$fwfa	= explode( ',', trim(
$params->get('forbidden_word_filter', '') ) );
		$fwwfa	= explode( ',', trim(
$params->get('forbidden_whole_word_filter', '') ) );

		foreach ($fwfa as $item) {
			if (trim($item) != '') {

				if (isset($data['message']) &&
stripos($data['message'], trim($item)) !== false) {
					$continueValidate = false;
					PhocacartLog::add(3, 'Ask a Question - Forbidden Word Filder -
Message', $productId, 'Word: '.$item.', IP: '.
$data['ip'].', User ID: '.$user->id);
					$app->enqueueMessage(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'
), 'warning');
				}
				if (isset($data['name']) &&
stripos($data['name'], trim($item)) !== false) {
					$continueValidate = false;
					PhocacartLog::add(3, 'Ask a Question - Forbidden Word Filder -
Name', $productId, 'Word: '.$item.', IP: '.
$data['ip'].', User ID: '.$user->id);
					$app->enqueueMessage(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'
), 'warning');
				}
				if (isset($data['phone']) &&
stripos($data['phone'], trim($item)) !== false) {
					$continueValidate = false;
					PhocacartLog::add(3, 'Ask a Question - Forbidden Word Filder -
Phone', $productId, 'Word: '.$item.', IP: '.
$data['ip'].', User ID: '.$user->id);
					$app->enqueueMessage(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'
), 'warning');
				}
				if (isset($data['email']) &&
stripos($data['email'], trim($item)) !== false) {
					$continueValidate = false;
					PhocacartLog::add(3, 'Ask a Question - Forbidden Word Filder -
Email', $productId, 'Word: '.$item.', IP: '.
$data['ip'].', User ID: '.$user->id);
					$app->enqueueMessage(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'
), 'warning');
				}
			}
		}

		foreach ($fwwfa as $item) {
			if ($item != '') {
				$itemBase		= trim($item);
				$item			=
"/(^|[^a-zA-Z0-9_]){1}(".preg_quote(($item),"/").")($|[^a-zA-Z0-9_]){1}/i";


				if (isset($data['message']) && preg_match( $item,
$data['message']) == 1) {
					$continueValidate = false;
					PhocacartLog::add(3, 'Ask a Question - Forbidden Whole Word
Filder - Message', $productId, 'Word: '.$itemBase.',
IP: '. $data['ip'].', User ID: '.$user->id);
					$app->enqueueMessage(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'
), 'warning');
				}
				if (isset($data['name']) && preg_match( $item,
$data['name']) == 1) {
					$continueValidate = false;
					PhocacartLog::add(3, 'Ask a Question - Forbidden Whole Word
Filder - Name', $productId, 'Word: '.$itemBase.', IP:
'. $data['ip'].', User ID: '.$user->id);
					$app->enqueueMessage(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'
), 'warning');
				}
				if (isset($data['phone']) && preg_match( $item,
$data['phone']) == 1) {
					$continueValidate = false;
					PhocacartLog::add(3, 'Ask a Question - Forbidden Whole Word
Filder - Phone', $productId, 'Word: '.$itemBase.', IP:
'. $data['ip'].', User ID: '.$user->id);
					$app->enqueueMessage(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'
), 'warning');
				}
				if (isset($data['email']) && preg_match( $item,
$data['email']) == 1) {
					$continueValidate = false;
					PhocacartLog::add(3, 'Ask a Question - Forbidden Whole Word
Filder - Email', $productId, 'Word: '.$itemBase.', IP:
'. $data['ip'].', User ID: '.$user->id);
					$app->enqueueMessage(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'
), 'warning');
				}
			}
		}


		// remove captcha from data after check
		$data['phq_captcha'] = '';

		if ($continueValidate == false) {
			// Save the data in the session.
			$app->setUserState('com_phocacart.question.data', $data);
			// Log added before
			$app->redirect(JRoute::_($uri));
			return false;
		}


		// CHECKS DONE - store entry
		$msg = '';
		if ($model->store($data)) {

			$msg = JText::_(
'COM_PHOCACART_THANK_YOU_FOR_LEAVING_INFORMATION_ASKING_QUESTION'
);
		} else {
			$app->setUserState('com_phocacart.question.data',
'');
			$session->clear('time', $namespace);

			PhocacartLog::add(2, 'Ask a Question - ERROR - Model store
error', $productId, 'IP: '. $data['ip'].',
User ID: '.$user->id . ', User Name:
'.$user->username.', Message: '.$model->getError());

			throw new Exception($model->getError(), 500);
			return false;
		}



		// Flush the data from the session
		$app->setUserState('com_phocacart.question.data',
'');
		//$session->clear('time', $namespace);
		$app->setUserState('com_phocacart.question.data',
'success_post_saved');
		$app->enqueueMessage($msg, 'success');
		$this->setRedirect($uri->toString());

		return true;
	}
}
?>
controllers/response.php000064400000010760151167552070011476
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport('joomla.log.log');
JLog::addLogger( array('text_file' =>
'com_phocacart_error_log.php'), JLog::ALL,
array('com_phocacart'));

class PhocaCartControllerResponse extends JControllerForm
{

	// User gets info
	public function paymentrecieve() {

		$app		= JFactory::getApplication();
		$session 	= JFactory::getSession();
		$session->set('proceedpayment', array(),
'phocaCart');

		//JSession::checkToken() or jexit( 'Invalid Token' );
		$return = PhocacartRoute::getInfoRoute();
		//$app->enqueueMessage(JText::_('COM_PHOCACART_PAYMENT_RECEIVED'),
'message');
		//$session->set('infoaction', 3, 'phocaCart');
		//$session->set('infoaction', 4, 'phocaCart');
		// NO message here, we have set the message during order and it stays
unchanged as it is in session
		// the message will be deleted after it will be displayed in view

		$type 		= $app->input->get('type', '',
'string');
		$mid 		= $app->input->get('mid', 0, 'int'); //
message id - possible different message IDs

		$message	= array();
		//$dispatcher = J EventDispatcher::getInstance();
		$plugin 	= JPluginHelper::importPlugin('pcp',
htmlspecialchars(strip_tags($type)));
		if ($plugin) {
			$eventData 					= array();
            $eventData['pluginname'] 	=
htmlspecialchars(strip_tags($type));
			\JFactory::getApplication()->triggerEvent('PCPafterRecievePayment',
array($mid, &$message, $eventData));
		}

		if (!empty($message)) {
			$session->set('infomessage', $message,
'phocaCart');
		}
		$app->redirect($return);
	}

	// User gets info
	public function paymentcancel() {

		$app		= JFactory::getApplication();
		$session 	= JFactory::getSession();
		$session->set('proceedpayment', array(),
'phocaCart');
		//JSession::checkToken() or jexit( 'Invalid Token' );

		$type 		= $app->input->get('type', '',
'string');
		$mid 		= $app->input->get('mid', 0, 'int'); //
message id - possible different message IDs
		$message	= array();
		//$dispatcher = J EventDispatcher::getInstance();
		$plugin 	= JPluginHelper::importPlugin('pcp',
htmlspecialchars(strip_tags($type)));
		if ($plugin) {
			$eventData 					= array();
            $eventData['pluginname'] 	=
htmlspecialchars(strip_tags($type));
			\JFactory::getApplication()->triggerEvent('PCPafterCancelPayment',
array($mid, &$message, $eventData));
		}

		$return = PhocacartRoute::getInfoRoute();
		$session->set('infoaction', 5, 'phocaCart');
		$session->set('infomessage', $message,
'phocaCart');
		//$app->enqueueMessage(JText::_('COM_PHOCACART_PAYMENT_CANCELED'),
'info');
		$app->redirect($return);
	}


	// Robot gets info
	public function paymentnotify() {

		$app 	= JFactory::getApplication();
		$type 	= $app->input->get('type', '',
'string');
		$pid 	= $app->input->get('pid', 0, 'int'); //
payment id
		$uri	= \Joomla\CMS\Uri\Uri::getInstance();

		//$dispatcher = J EventDispatcher::getInstance();
		$plugin = JPluginHelper::importPlugin('pcp',
htmlspecialchars(strip_tags($type)));
		if ($plugin) {
			$eventData 					= array();
            $eventData['pluginname'] 	=
htmlspecialchars(strip_tags($type));
			\JFactory::getApplication()->triggerEvent('PCPbeforeCheckPayment',
array($pid, $eventData));
		} else {

			JLog::add('Payment method: '."Invalid HTTP request
method. Type: " . $type . " Uri: " . $uri->toString(),
'com_phocacart');
            header('Allow: POST', true, 405);
            throw new Exception("Invalid HTTP request method.");
		}

		exit;
	}


	public function paymentwebhook() {

		$app 	= JFactory::getApplication();
		$type 	= $app->input->get('type', '',
'string');
		$pid 	= $app->input->get('pid', 0, 'int'); //
payment id
		$uri	= \Joomla\CMS\Uri\Uri::getInstance();

		//$dispatcher = J EventDispatcher::getInstance();
		$plugin = JPluginHelper::importPlugin('pcp',
htmlspecialchars(strip_tags($type)));
		if ($plugin) {
			$eventData 					= array();
            $eventData['pluginname'] 	=
htmlspecialchars(strip_tags($type));
			\JFactory::getApplication()->triggerEvent('PCPonPaymentWebhook',
array($pid, $eventData));
		} else {

			JLog::add('Payment method: '."Invalid HTTP request
method. Type: " . $type . " Uri: " . $uri->toString(),
'com_phocacart');
			header('Allow: POST', true, 405);
			throw new Exception("Invalid HTTP request method.");
		}
		exit;
	}

}
?>
controllers/submit.php000064400000032430151167552070011141 0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

class PhocaCartControllerSubmit extends JControllerForm
{

	function submit() {

		JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
		$session = JFactory::getSession();

		$app    = JFactory::getApplication();
		$uri 	= \Joomla\CMS\Uri\Uri::getInstance();
		$user 	= PhocacartUser::getUser();

		$params 									= PhocacartUtils::getComponentParameters() ;
		$enable_submit_item 						=
$params->get('enable_submit_item', 0);
		$display_submit_item_privacy_checkbox		= $params->get(
'display_submit_item_privacy_checkbox', 0 );

		$submit_item_form_fields					= $params->get(
'submit_item_form_fields', '' );
		$submit_item_form_fields_contact			= $params->get(
'submit_item_form_fields_contact', '' );

		$formFields = array_map('trim', explode(',',
$submit_item_form_fields));
		$formFields = array_unique($formFields);
		$formFieldsC = array_map('trim', explode(',',
$submit_item_form_fields_contact));
		$formFieldsC = array_unique($formFieldsC);

		$imageRequired = false;
		if (in_array('image*', $formFields)) {
			$imageRequired = true;
		}

		if ($enable_submit_item == 0) {
			throw new
Exception(JText::_('COM_PHOCACART_SUBMIT_ITEM_DISABLED'), 500);
			return false;
		}

		if (!PhocacartSubmit::isAllowedToSubmit()) {
			throw new
Exception(JText::_('COM_PHOCACART_SUBMIT_ITEM_NOT_ALLOWED'),
500);
			return false;
		}

		$namespace  		= 'phccrt' .
$params->get('session_suffix');
		$data  				= $this->input->post->get('jform', array(),
'array');
		$file 				= JFactory::getApplication()->input->files->get(
'jform', null, 'raw');
		$item['privacy']	= $this->input->get(
'privacy', false, 'string'  );

		$data['privacy'] 	= $item['privacy'] ? 1 : 0;

		if ($display_submit_item_privacy_checkbox == 2 &&
$data['privacy'] == 0) {
			$msg =
JText::_('COM_PHOCACART_ERROR_YOU_NEED_TO_AGREE_TO_PRIVACY_TERMS_AND_CONDITIONS');
			$app->enqueueMessage($msg, 'error');
			$app->redirect(JRoute::_($uri));
			return false;

		}

		// Additional data
		$data['ip'] = PhocacartUtils::getIp();

		// *** SECURITY
		// Default session test always enabled!
		$valid = $session->get('form_id', NULL, $namespace);
		$session->clear('form_id', $namespace);
		if (!$valid){
			$app->setUserState('com_phocacart.submit.data',
'');
			$session->clear('time', $namespace);

			PhocacartLog::add(3, 'Submit Item - Not valid session', 0,
'IP: '. $data['ip'].', User ID:
'.$user->id . ', User Name: '.$user->username);
			//jexit(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'));

			throw new
Exception(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'), 500);
			return false;
		}

		$model  = $this->getModel('submit');

		// *** SECURITY
		// Hidden Field
		if ($params->get('enable_hidden_field_submit_item', 0) == 1)
{
			$params->set('hidden_field_id',
$session->get('hidden_field_id', 'fieldnotvalid',
$namespace));
			$params->set('hidden_field_name',
$session->get('hidden_field_name', 'fieldnotvalid',
$namespace));
			$hiddenField = $session->get('hidden_field_name',
'fieldnotvalid', $namespace);

			$session->clear('hidden_field_id', $namespace);
			$session->clear('hidden_field_name', $namespace);
			$session->clear('hidden_field_class', $namespace);

			if ($params->get('hidden_field_id') ==
'fieldnotvalid') {
				$app->setUserState('com_phocacart.submit.data',
'');
				$session->clear('time', $namespace);

				PhocacartLog::add(3, 'Submit Item - Hidden Field Error', 0,
'IP: '. $data['ip'].', User ID:
'.$user->id . ', User Name: '.$user->username);
				throw new
Exception(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'), 500);
				return false;
			}

			// Hidden field was filled
			if (isset($data[$hiddenField]) && $data[$hiddenField] !=
'') {
				$app->setUserState('com_phocacart.submit.data',
'');
				$session->clear('time', $namespace);

				PhocacartLog::add(3, 'Submit Item - Hidden Field Filled', 0,
'IP: '. $data['ip'].', User ID:
'.$user->id . ', User Name: '.$user->username);
				throw new
Exception(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'), 500);
				return false;
			}

		}

		// *** SECURITY
		// Check for a valid session cookie
		if($session->getState() != 'active'){
			// Save the data in the session.
			$app->setUserState('com_phocacart.submit.data', $data);
			$message = JText::_( 'COM_PHOCACART_SESSION_INVALID' );
			$app->enqueueMessage($message, 'error');

			PhocacartLog::add(3, 'Submit Item - Session not active', 0,
'IP: '. $data['ip'].', User ID:
'.$user->id . ', User Name: '.$user->username.',
Message: '.$message);
			$app->redirect(JRoute::_($uri));
			return false;
		}

		// *** SECURITY
		// Task
		$task = $this->input->get('task');

		if ($task == 'phocacart.submit') {
			$task = 'submit';
		}
		if (($this->input->get('view') != 'submit') ||
($this->input->get('option') != 'com_phocacart')
|| ($task != 'submit')) {
			$app->setUserState('com_phocacart.submit.data',
'');
			$session->clear('time', $namespace);

			PhocacartLog::add(3, 'Submit Item - No Phoca Cart part', 0,
'IP: '. $data['ip'].', User ID:
'.$user->id . ', User Name: '.$user->username);
			throw new
Exception(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'), 500);
			return false;
		}

		// *** SECURITY
		// Check Time
	    if((int)$params->get('enable_time_check_submit_item', 0)
> 0) {
            $time = $session->get('time', null, $namespace);
            $delta = time() - $time;

			if($params->get('enable_time_check_submit_item', 0)
&& $delta <=
(int)$params->get('enable_time_check_submit_item', 0)) {

				$app->setUserState('com_phocacart.submit.data', $data);
				$message = JText::_( 'COM_PHOCACART_SUBMIT_TOO_FAST' );
				$app->enqueueMessage($message, 'error');

				PhocacartLog::add(3, 'Submit Item - Submit too fast', 0,
'IP: '. $data['ip'].', User ID:
'.$user->id . ', User Name: '.$user->username.',
Message: '.$message . ', Time: '. $delta . '
sec.');
				$app->redirect(JRoute::_($uri));
				return false;
            }
        }

		// ***SECURITY
		// IP Ban
		if ($params->get('ip_ban', '') != '') {

			$isSpam = PhocacartSecurity::checkIpAddress($data['ip'],
$params->get('ip_ban'));

			if ($isSpam) {
				//$app->setUserState('com_phocacart.submit.data',
$data);	// Save the data in the session.
				//$message = JText::_( 'COM_PHOCACART_POSSIBLE_SPAM_DETECTED'
);
				//$app->enqueueMessage($message, 'error');
				//$app->redirect(JRoute::_($uri));

				$app->setUserState('com_phocacart.submit.data',
'');
				$session->clear('time', $namespace);

				PhocacartLog::add(3, 'Submit Item - IP Ban', 0, 'IP:
'. $data['ip'].', User ID: '.$user->id .
', User Name: '.$user->username);
				throw new
Exception(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'), 500);
				return false;
			}
		}

		// *** SECURITY
		// Validate the posted data.
		$form = $model->getForm();
		if (!$form) {
			$app->setUserState('com_phocacart.submit.data',
'');
			$session->clear('time', $namespace);

			PhocacartLog::add(2, 'Submit Item - ERROR - Model not loaded',
0, 'IP: '. $data['ip'].', User ID:
'.$user->id . ', User Name: '.$user->username.',
Message: '.$model->getError());
			throw new Exception($model->getError(), 500);
			return false;
		}

		// *** SECURITY
		// VALIDATE - continue with validation in case of problem
		$continueValidate 	= true;

		// SECURITY
		// Captcha - is validated in RULES of FORM FIELD - Exception for validate
fields
		$captchaId = 1;//Possible parameters in Options for different captchas
(reCaptcha = 1)
		switch ($captchaId) {
			case 1: // reCaptcha uses virtual field, so we cannot check the field
set in form
				$data['phq_captcha'] = 'OK';
			break;
		}


		$validate 			= $model->validate($form, $data);// includes
preprocessForm so it includes parameters too

		if ($validate === false) {
			$errors	= $model->getErrors();


			// Get (possible) attack issues
			for ($i = 0, $n = count($errors); $i < $n && $i < 5; $i++)
{


				if (($errors[$i] instanceof \Exception) &&
($errors[$i]->getCode() == E_ERROR)) {
					$app->setUserState('com_phocacart.submit.data',
'');
					$session->clear('time', $namespace);

					PhocacartLog::add(2, 'Submit Item - Validate errors', 0,
'IP: '. $data['ip'].', User ID:
'.$user->id . ', User Name: '.$user->username);

					$app->enqueueMessage(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'),
'error');
					$app->redirect(JRoute::_($uri));
					return false;
				} else {

					$app->enqueueMessage($errors[$i]->getMessage(),
'warning');
					$continueValidate = false;
				}

			}
			// Validate error message are now in stack, so no more render
			// just redirect back to the form with information about problems and
fill the form field
			$continueValidate = false;
		}
		$data = $validate;


		// *** SECURITY
		// Forbidden Word Filter
		$fwfa	= explode( ',', trim(
$params->get('forbidden_word_filter', '') ) );
		$fwwfa	= explode( ',', trim(
$params->get('forbidden_whole_word_filter', '') ) );

		foreach ($fwfa as $item) {
			if (trim($item) != '') {

				if (!empty($formFields)) {
					foreach ($formFields as $k => $v) {
						$v = str_replace('*', '', trim($v));
						if (isset($data[$v]) && stripos($data[$v], trim($item)) !==
false) {
							$continueValidate = false;
							PhocacartLog::add(3, 'Submit Item - Forbidden Word Filder -
'.$v, 0, 'Word: '.$item.', IP: '.
$data['ip'].', User ID: '.$user->id);
							$app->enqueueMessage(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'
), 'warning');
						}
					}
				}

				if (!empty($formFieldsC)) {
					foreach ($formFieldsC as $k => $v) {
						$v = str_replace('*', '', trim($v));
						if (isset($data[$v]) && stripos($data[$v], trim($item)) !==
false) {
							$continueValidate = false;
							PhocacartLog::add(3, 'Submit Item - Forbidden Word Filder -
'.$v, 0, 'Word: '.$item.', IP: '.
$data['ip'].', User ID: '.$user->id);
							$app->enqueueMessage(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'
), 'warning');
						}
					}
				}

			}
		}

		foreach ($fwwfa as $item) {
			if ($item != '') {
				$itemBase		= trim($item);
				$item			=
"/(^|[^a-zA-Z0-9_]){1}(".preg_quote(($item),"/").")($|[^a-zA-Z0-9_]){1}/i";

				if (!empty($formFields)) {
					foreach ($formFields as $k => $v) {
						$v = str_replace('*', '', trim($v));
						if (isset($data[$v]) && stripos($data[$v], trim($item)) !==
false) {
							$continueValidate = false;
							PhocacartLog::add(3, 'Submit Item - Forbidden Whole Word Filder
- '.$v, 0, 'Word: '.$item.', IP: '.
$data['ip'].', User ID: '.$user->id);
							$app->enqueueMessage(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'
), 'warning');
						}
					}
				}

				if (!empty($formFieldsC)) {
					foreach ($formFieldsC as $k => $v) {
						$v = str_replace('*', '', trim($v));
						if (isset($data[$v]) && stripos($data[$v], trim($item)) !==
false) {
							$continueValidate = false;
							PhocacartLog::add(3, 'Submit Item - Forbidden Whole Word Filder
- '.$v, 0, 'Word: '.$item.', IP: '.
$data['ip'].', User ID: '.$user->id);
							$app->enqueueMessage(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'
), 'warning');
						}
					}
				}

			}
		}


		// remove captcha from data after check
		$data['phq_captcha'] = '';


		// IMAGE VALIDATION
		if ($imageRequired) {
			$imageUploaded = false;

			if (!empty($file['items_item']['image'])) {
				foreach ($file['items_item']['image'] as $k =>
$v) {
					if (isset($v['name']) && $v['name'] !=
'' && isset($v['tmp_name']) &&
$v['tmp_name'] != '' &&
isset($v['error']) && (int)$v['error'] < 1)
{
						$imageUploaded = true;
						break;
					}
				}
			}
			if (!$imageUploaded) {
				$continueValidate = false;
				//PhocacartLog::add(3, 'Submit Item - Image not added - '.$v,
0, 'Word: '.$item.', IP: '.
$data['ip'].', User ID: '.$user->id);
				$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_IMAGE_NOT_SUBMITTED'
), 'error');
			}
		} else {
			// Remove empty form

			if (!empty($file['items_item']['image'])) {
				foreach ($file['items_item']['image'] as $k =>
$v) {
					if (isset($v['name']) && $v['name'] !=
'' && isset($v['tmp_name']) &&
$v['tmp_name'] != '' &&
isset($v['error']) && (int)$v['error'] < 1)
{

					} else {
						unset($file['items_item']['image'][$k]);
					}
				}
			}

		}


		if ($continueValidate == false) {
			// Save the data in the session.
			$app->setUserState('com_phocacart.submit.data', $data);
			// Log added before
			$app->redirect(JRoute::_($uri));
			return false;
		}





		// CHECKS DONE - store entry
		$msg = '';
		if ($model->store($data, $file)) {

			$msg = JText::_(
'COM_PHOCACART_THANK_YOU_FOR_SUBMITTING_YOUR_ITEM' );
		} else {
			$app->setUserState('com_phocacart.submit.data',
'');
			$session->clear('time', $namespace);

			PhocacartLog::add(2, 'Submit Item - ERROR - Model store
error', 0, 'IP: '. $data['ip'].', User ID:
'.$user->id . ', User Name: '.$user->username.',
Message: '.$model->getError());

			//throw new Exception($model->getError(), 500);
			//return false;
			$app->redirect(JRoute::_($uri));
			return false;
		}



		// Flush the data from the session
		$app->setUserState('com_phocacart.submit.data',
'');
		//$session->clear('time', $namespace);
		$app->setUserState('com_phocacart.submit.data',
'success_post_saved');
		$app->enqueueMessage($msg, 'success');
		$this->setRedirect($uri->toString());

		return true;
	}
}
?>
controllers/wishlist.json.php000064400000011266151167552070012460
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

class PhocaCartControllerWishList extends JControllerForm
{

	public function add() {

		if (!JSession::checkToken('request')) {
			$response = array(
				'status' => '0',
				'error' => '<span class="ph-result-txt
ph-error-txt">' . JText::_('JINVALID_TOKEN') .
'</span>');
			echo json_encode($response);
			return;
		}


		$app					= JFactory::getApplication();
		$s 					    = PhocacartRenderStyle::getStyles();
		$item					= array();
		$item['id']				= $this->input->get( 'id', 0,
'int' );
		$item['catid']			= $this->input->get( 'catid',
0, 'int' );
		$item['return']			= $this->input->get(
'return', '', 'string'  );
		$item['wishlistview']	= $this->input->get(
'wishlistview', 0, 'int'  );

		$wishlist	= new PhocacartWishlist();
		$added		= $wishlist->addItem((int)$item['id'],
(int)$item['catid']);
		//$catid		=
PhocacartProduct::getCategoryByProductId((int)$item['id']);

		$o = $o2 = '';
		// Content of the wishlist list
		ob_start();
		echo $wishlist->renderList();
		$o = ob_get_contents();
		ob_end_clean();

		// Render the layout
		$d          = array();
		$d['s']	    = $s;
		$layoutW	= new JLayoutFile('popup_add_to_wishlist', null,
array('component' => 'com_phocacart'));

		$d['link_wishlist'] =
JRoute::_(PhocacartRoute::getWishListRoute((int)$item['id']),
(int)$item['catid']);
		$d['link_continue'] = '';
		// We need to know if module is displayed on wishlist site
		// If yes and one item will be deleted per AJAX, we need to refresh
wishlist site
		// If now and one item will be deleted per AJAX, everything is OK,
nothing needs to be refreshed
		$d['wishlist_view'] 	= (int)$item['wishlistview'];

		if ($added) {
			$d['info_msg'] =
JText::_('COM_PHOCACART_PRODUCT_ADDED_TO_WISH_LIST');
		} else {
			$d['info_msg'] =
JText::_('COM_PHOCACART_PRODUCT_NOT_ADDED_TO_WISH_LIST');

			$mO = PhocacartRenderFront::renderMessageQueue();
			$d['info_msg_additional'] = $mO;
		}

		// Popup with info - Continue,Proceed to wishlist list
		//ob_start();
		$o2 = $layoutW->render($d);
		//$o2 = ob_get_contents();
		//ob_end_clean();

		$count = $wishlist->getWishListCountItems();

		$response = array(
			'status'	=> '1',
			'item'		=> $o,
			'popup'		=> $o2,
			'count'		=> $count);

		echo json_encode($response);
		return;
	}

	public function remove() {

		if (!JSession::checkToken('request')) {
			$response = array(
				'status' => '0',
				'error' => '<span class="ph-result-txt
ph-error-txt">' . JText::_('JINVALID_TOKEN') .
'</span>');
			echo json_encode($response);
			return;
		}

		$app 					= JFactory::getApplication();
		$s 					    = PhocacartRenderStyle::getStyles();
		$item					= array();
		$item['id']				= $this->input->get( 'id', 0,
'int' );
		$item['catid']			= $this->input->get( 'catid',
0, 'int' );
		$item['return']			= $this->input->get(
'return', '', 'string'  );
		$item['wishlistview']	= $this->input->get(
'wishlistview', 0, 'int'  );

		$wishlist	= new PhocacartWishlist();
		$added		= $wishlist->removeItem((int)$item['id']);
		//$catid		=
PhocacartProduct::getCategoryByProductId((int)$item['id']);

		$o = $o2 = '';
		// Content of the wishlist list
		ob_start();
		echo $wishlist->renderList();
		$o = ob_get_contents();
		ob_end_clean();

		// Render the layout
		$d          = array();
		$d['s']	    = $s;
		$layoutW	= new JLayoutFile('popup_remove_from_wishlist', null,
array('component' => 'com_phocacart'));

		$d['link_wishlist'] =
JRoute::_(PhocacartRoute::getWishListRoute((int)$item['id']),
(int)$item['catid']);
		$d['link_continue'] = '';
		// We need to know if module is displayed on wishlist site
		// If yes and one item will be deleted per AJAX, we need to refresh
wishlist site
		// If now and one item will be deleted per AJAX, everything is OK,
nothing needs to be refreshed
		$d['wishlist_view'] 	= (int)$item['wishlistview'];



		if ($added) {
			$d['info_msg'] =
JText::_('COM_PHOCACART_PRODUCT_REMOVED_FROM_WISH_LIST');
		} else {
			$d['info_msg'] =
JText::_('COM_PHOCACART_PRODUCT_NOT_REMOVED_FROM_WISH_LIST');

			$mO = PhocacartRenderFront::renderMessageQueue();
			$d['info_msg_additional'] = $mO;
		}

		// Popup with info - Continue,Proceed to wishlist list
		//ob_start();
		$o2 = $layoutW->render($d);
		//$o2 = ob_get_contents();
		//ob_end_clean();

		$count = $wishlist->getWishListCountItems();

		$response = array(
			'status'	=> '1',
			'item'		=> $o,
			'popup'		=> $o2,
			'count'		=> $count);

		echo json_encode($response);
		return;
	}

}
?>
controllers/wishlist.php000064400000003572151167552070011511
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

class PhocaCartControllerWishList extends JControllerForm
{
	
	public function add() { 
		
		JSession::checkToken() or jexit( 'Invalid Token' );
		$app				= JFactory::getApplication();
		$item				= array();
		$item['id']			= $this->input->get( 'id', 0,
'int' );
		$item['catid']		= $this->input->get( 'catid',
0, 'int' );
		$item['return']		= $this->input->get( 'return',
'', 'string'  );
		
		$wishlist	= new PhocacartWishlist();
		$added		= $wishlist->addItem((int)$item['id'],
(int)$item['catid']);
		if ($added) {
			$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_ADDED_TO_WISH_LIST'),
'message');
		} else {
			$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_NOT_ADDED_TO_WISH_LIST'),
'error');
		}
		//$app->redirect(JRoute::_('index.php?option=com_phocacart&view=checkout'));
		$app->redirect(base64_decode($item['return']));
	}
	
		public function remove() {
		
		JSession::checkToken() or jexit( 'Invalid Token' );
		$app				= JFactory::getApplication();
		$item				= array();
		$item['id']			= $this->input->get( 'id', 0,
'int' );
		$item['return']		= $this->input->get( 'return',
'', 'string'  );
		
		$wishlist	= new PhocacartWishlist();
		$added	= $wishlist->removeItem((int)$item['id']);
		if ($added) {
			$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_REMOVED_FROM_WISH_LIST'),
'message');
		} else {
			$app->enqueueMessage(JText::_('COM_PHOCACART_PRODUCT_NOT_REMOVED_FROM_WISH_LIST'),
'error');
		}
		//$app->redirect(JRoute::_('index.php?option=com_phocacart&view=checkout'));
		$app->redirect(base64_decode($item['return']));
	}
	
}
?>helpers/association.php000064400000004505151167552070011250
0ustar00<?php
/**
 * @package   Phoca Cart
 * @author    Jan Pavelka - https://www.phoca.cz
 * @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
 * @license   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
 * @cms       Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license   http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;


abstract class PhocacartHelperAssociation
{

	public static function getAssociations($id = 0, $view = null)
	{


		$jinput = JFactory::getApplication()->input;
		$view   = $view === null ? $jinput->get('view') : $view;
		$id     = empty($id) ? $jinput->getInt('id') : $id;

		if ($view === 'item') {
			if ($id) {
				$associations =
JLanguageAssociations::getAssociations('com_phocacart',
'#__phocacart_products', 'com_phocacart.item', $id,
'id', 'alias', false);

				$return = array();

				foreach ($associations as $tag => $item) {
				    $idA = explode(":",$item->id);
				    $idAlias = '';
				    if (isset($idA[1])) {
                        $idAlias = $idA[1];
                    }
				    $id = (int)$item->id;


					$catidA = PhocacartCategoryMultiple::getCategories($id, 3);
					$catid  = 0;
					if (isset($catidA[0]->id)) {
					    $catid = $catidA[0]->id;
                    }
					$catidAlias = '';
					if (isset($catidA[0]->alias)) {
					    $catidAlias = $catidA[0]->alias;
                    }

					$return[$tag] = PhocacartRoute::getItemRoute((int)$id, (int)$catid,
$idAlias, $catidAlias, array(0 => $tag));

				}

				return $return;
			}
		} else if($view === 'category') {
			if ($id) {
				$associations =
JLanguageAssociations::getAssociations('com_phocacart',
'#__phocacart_categories', 'com_phocacart.category',
$id, 'id', 'alias', false);

				$return = array();

				foreach ($associations as $tag => $item) {
				    $idA = explode(":",$item->id);
                    $idAlias = '';
				    if (isset($idA[1])) {
                        $idAlias = $idA[1];
                    }
				    $id = (int)$item->id;



					$return[$tag] = PhocacartRoute::getCategoryRoute((int)$id, $idAlias,
array(0 => $tag));// tag = lang

				}

				return $return;
			}

		}

		/*if ($view === 'category' || $view === 'categories')
		{
			return self::getCategoryAssociations($id, 'com_phocacart');
		}*/

		return array();
	}
}
helpers/index.html000064400000000054151167552070010213
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>helpers/route.php000064400000001053151167552070010065
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die;
jimport('joomla.application.component.helper');

class PhocacartHelperRoute
{

	function getOrderRoute($id, $idAlias = '') {
		return true;
	}

	function _findItem($needles, $notCheckId = 0) {
		return true;
	}
}
?>
index.html000064400000000054151167552070006551 0ustar00<html><body
bgcolor="#FFFFFF"></body></html>layouts/attribute_options_box.php000064400000005641151167552070013422
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$layoutAtOS	= new JLayoutFile('attribute_options_select', null,
array('component' => 'com_phocacart'));
$layoutAtOC	= new JLayoutFile('attribute_options_checkbox', null,
array('component' => 'com_phocacart'));
$layoutAtOT	= new JLayoutFile('attribute_options_text', null,
array('component' => 'com_phocacart'));
$layoutAtOG	= new JLayoutFile('attribute_options_gift', null,
array('component' => 'com_phocacart'));

$d 				= $displayData;
$displayData 	= null;

if (!empty($d['attr_options']) &&
$d['hide_attributes'] != 1) {

	//PhocacartRenderJs::renderPhSwapImageInitialize($d['id'],
$d['dynamic_change_image'], $d['init_type']);

	echo '<div class="ph-item-attributes-box"
id="phItemAttributesBox">';
	echo
'<h4>'.JText::_('COM_PHOCACART_AVAILABLE_OPTIONS').'</h4>';


	foreach ($d['attr_options'] as $k => $v) {




		// If the attribute is required, return different required parts
(attribute - html5, class - jquery, span - heading)
		// Set jquery required validation, which should help to html 5 in case of
checkboxes (see more info in the funtion)
		// TYPES SET for JQUERY require control: 4 5 6
		$req = PhocacartRenderJs::renderRequiredParts((int)$v->id,
(int)$v->required );

		// OBSOLETE
		// HTML5 does not know to check checkboxes - if some value is set
		// CHECKBOX, CHECKBOX COLOR, CHECKBOX IMAGE
		/*if($v->type == 4 || $v->type == 5 || $v->type == 6) {
			//PhocacartRenderJs::renderCheckBoxRequired((int)$v->id,
$d['init_type']);
			PhocacartRenderJs::renderCheckBoxRequired();
		}*/

		echo '<div
class="ph-attribute-title">'.$v->title.$req['span'].'</div>';
		if(!empty($v->options)) {

			$d2							= $d;
			$d2['attribute']			= $v;
			$d2['required']				= $req;

            // EDIT PHOCACARTATTRIBUTE ATTRIBUTETYPE
			if ($v->type == 1 || $v->type == 2 || $v->type == 3) {
				echo $layoutAtOS->render($d2);// SELECTBOX, SELECTBOX COLOR,
SELECTBOX IMAGE
			} else if ($v->type == 4 || $v->type == 5 || $v->type == 6) {
				echo $layoutAtOC->render($d2);// CHECKBOX, CHECKBOX COLOR, CHECKBOX
COLOR
			} else if ($v->type == 7 || $v->type == 8 || $v->type == 9 ||
$v->type == 10 || $v->type == 11 || $v->type == 12) {
				echo $layoutAtOT->render($d2);// TEXT, TEXT (COLOR PICKER)
			} else if ($v->type == 20) {
				echo $layoutAtOG->render($d2);// GIFT
			}
		}

		// SELECTBOX COLOR, SELECTBOX IMAGE
		// OBSOLETE
		/*if ($v->type == 2 || $v->type == 3) {
			echo PhocacartRenderJs::renderPhAttribute
SelectBoxInitialize((int)$v->id, (int)$v->type,
$d['typeview']);
		}*/

	}
	echo '</div>';
	echo '<div class="ph-cb"></div>';
}



layouts/attribute_options_checkbox.php000064400000012567151167552070014425
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */

/* COLOR OR IMAGE CHECKBOXES
 * BE AWARE BOOTSTRAP DATA TOGGLE BUTTONS ARE USED
 * IF YOU LOAD OBSOLETE BOOTSTRAP Javascript (bootstrap.min.js)
 * IT CAN BE IN CONFLICT AND THIS FEATURE WILL NOT WORK
 * Use Phoca Upgrade System plugin and remove obsolete bootstrap.min.js
with help of this plugin
 */
defined('_JEXEC') or die();

$d 					= $displayData;
$displayData 		= null;
$v 					= $d['attribute'];
$attributeIdName	=
'V'.$d['typeview'].'P'.(int)$d['product_id'].'A'.(int)$v->id;
$productIdName		=
'V'.$d['typeview'].'P'.(int)$d['product_id'];
$iconType			= $d['s']['i']['icon-type'];
$price				= new PhocacartPrice();


$attr				= array();
$attr[]				=
'id="phItemAttribute'.$attributeIdName.'"';//
ID
$attr[]				= 'class="ph-checkbox-attribute
ph-item-input-set-attributes phj'. $d['typeview'].'
phjProductAttribute
'.$d['required']['class'].'"';//
CLASS
$attr[]				= 'data-product-id="'.
$d['product_id'].'"';// Product ID
$attr[]				= 'data-product-id-name="'.
$productIdName.'"';// Product ID - Unique name between
different views
$attr[]				= 'data-attribute-type="'.
$v->type.'"';// Type of attribute (select, checkbox,
color, image)
$attr[]				= 'data-attribute-id-name="'.
$attributeIdName.'"';// Attribute ID - Unique name between
different views and products
$attr[]				= 'data-type-view="'.
$d['typeview'].'"';// In which view are attributes
displayed: Category, Items, Item, Quick Item
$attr[]				= 'data-type-icon="'.
$iconType.'"';// Which icons are used on the site (Bootstrap
Glyphicons | Font Awesome | ...)
$attr[]				=
'data-required="'.$d['required']['required'].'"';
$attr[]				=
'data-alias="'.htmlspecialchars($v->alias).'"';


echo '<div
id="phItemBoxAttribute'.$attributeIdName.'">';
echo '<div '.implode(' ', $attr).'>';


// CHECKBOX COLOR CHECKBOX IMAGE
if ($v->type == 5 || $v->type == 6) {
	echo '<div class="ph-item-input-checkbox-color
btn-group-toggle" data-toggle="buttons">';
}

foreach ($v->options as $k2 => $v2) {
	if($v2->operator == '=') {
		$operator = '';
	} else {
		$operator = $v2->operator;
	}
	$amount = $d['price']->getPriceFormat($v2->amount);

	// Switch large image
	// BE AWARE when checkbox used, and two images will be selected, only the
first will be displayed
	// of course not both can be displayed
	$attrO		= '';
	if ($d['dynamic_change_image'] == 1) {
		if (isset($v2->image) && $v2->image != '') {
			$imageO 	= PhocacartImage::getThumbnailName($d['pathitem'],
$v2->image, $d['image_size']);
			$linkO 		= JURI::base(true).'/'.$imageO->rel;
			if (JFile::exists($imageO->abs)) {
				$attrO		.=
'data-image-option="'.htmlspecialchars($linkO).'"';
			}
		}
	}

	// SET SOME VALUE?
	$active = '';
	if ($v2->default_value == 1) {
		$attrO		.= ' checked="checked"';// color and image
checkboxes based on opacity
		$active	= ' active';
	}

	$suffix =  ' ('.$operator.' '.$amount.')';
	if (isset($d['zero_attribute_price']) &&
$d['zero_attribute_price'] == 0 &&
$price->roundPrice($v2->amount) < 0.01 &&
$price->roundPrice($v2->amount) > -0.01) {
		$suffix = '';// hide only if price is zero
	} else if (isset($d['zero_attribute_price']) &&
$d['zero_attribute_price'] == 2) {
		$suffix = '';// hide always
	}

	if ($v->type == 4) { // CHECKBOX STANDARD

		echo '<div
class="'.$d['s']['c']['checkbox'].'
ph-checkbox"><label><input type="checkbox"
'.$attrO.'
name="attribute['.$v->id.']['.$v2->id.']"
value="'.$v2->id.'"
'.$d['required']['attribute'].'
data-value-alias="'.htmlspecialchars($v2->alias).'"
/>'.htmlspecialchars($v2->title).$suffix.'</label></div>';//<br
/>';

	} else if ($v->type == 5 && isset($v2->color) &&
$v2->color != '') { // CHECKBOX COLOR

		$attrO	.= '
data-color="'.strip_tags($v2->color).'"';
		echo '<label class="btn phCheckBoxButton phCheckBoxColor
'.$active.'" style="background-color:
'.strip_tags($v2->color).'"><input
type="checkbox" '.$attrO.'
name="attribute['.$v->id.']['.$v2->id.']"
value="'.$v2->id.'"
'.$d['required']['attribute'].'
autocomplete="off"
data-value-alias="'.htmlspecialchars($v2->alias).'"
/><span
class="'.$d['s']['i']['ok'].'"
title="'.htmlspecialchars($v2->title). $suffix
.'"></span></label> ';

	} else if ($v->type == 6 && isset($v2->image_small)
&& $v2->image_small != '') {// CHECKBOX IMAGE

		$linkI 		=
JURI::base(true).'/'.$d['pathitem']['orig_rel'].'/'.$v2->image_small;
		echo '<label
class="'.$d['s']['c']['btn'].'
phCheckBoxButton phCheckBoxImage '.$active.'"><input
type="checkbox" '.$attrO.'
name="attribute['.$v->id.']['.$v2->id.']"
value="'.$v2->id.'"
'.$d['required']['attribute'].' 
autocomplete="off"
data-value-alias="'.htmlspecialchars($v2->alias).'"
/><span
class="'.$d['s']['i']['ok'].'"></span><img
src="'.strip_tags($linkI).'"
title="'.htmlspecialchars($v2->title). $suffix.'"
alt="'.htmlspecialchars($v2->title).'"
/></label>';

	}
}

// CHECKBOX COLOR
if ($v->type == 5 || $v->type == 6) {
	echo '</div>';// end button group toggle buttons
ph-item-input-checkbox-color
}

echo '</div>';// end attribute box
echo '</div>';// end attribute
echo '<div
id="phItemHiddenAttribute'.$attributeIdName.'"
style="display:none;"></div>';
?>
layouts/attribute_options_gift.php000064400000021720151167552070013557
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license   http://www.gnu.org/copyleft/gpl.html GNU/GPL, see
LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license   http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */

use Joomla\CMS\HTML\HTMLHelper;

defined('_JEXEC') or die();

$layoutG	= new JLayoutFile('gift_voucher', null,
array('component' => 'com_phocacart'));

$d               = $displayData;
$displayData     = null;
$v               = $d['attribute'];
$attributeIdName = 'V' . $d['typeview'] . 'P'
. (int)$d['product_id'] . 'A' . (int)$v->id;
$productIdName   = 'V' . $d['typeview'] . 'P'
. (int)$d['product_id'];
$iconType        =
$d['s']['i']['icon-type'];
$price           = new PhocacartPrice();

$attr   = array();
$attr[] = 'id="phItemAttribute' . $attributeIdName .
'"';// ID
$attr[] = 'class="ph-checkbox-attribute
ph-item-input-set-attributes phj' . $d['typeview'] . '
phjProductAttribute ' . $d['required']['class'] .
'"';// CLASS
$attr[] = 'data-product-id="' . $d['product_id'] .
'"';// Product ID
$attr[] = 'data-product-id-name="' . $productIdName .
'"';// Product ID - Unique name between different views
$attr[] = 'data-attribute-type="' . $v->type .
'"';// Type of attribute (select, checkbox, color, image)
$attr[] = 'data-attribute-id-name="' . $attributeIdName .
'"';// Attribute ID - Unique name between different views
and products
$attr[] = 'data-type-view="' . $d['typeview'] .
'"';// In which view are attributes displayed: Category,
Items, Item, Quick Item
$attr[] = 'data-type-icon="' . $iconType .
'"';// Which icons are used on the site (Bootstrap
Glyphicons | Font Awesome | ...)


echo '<div id="phItemBoxAttribute' . $attributeIdName .
'">';
echo '<div ' . implode(' ', $attr) .
'>';


// CHECKBOX COLOR CHECKBOX IMAGE
/*if ($v->type == 5 || $v->type == 6) {
	echo '<div class="ph-item-input-checkbox-color"
data-toggle="buttons">';
}*/

// First, set default values

$defaultImage 			= '';
$defaultTitle 			= '';
$defaultDescription 	= '';
$defaultClassName 		= '';
$defaultDate 			= '';
$giftTypes				= array();
$giftSenderNameActive 	= 0;
$giftSenderMessageActive = 0;
$giftRecipientNameActive = 0;
if (!empty($d['gift_types'])) {
	$registry = new JRegistry;
	$registry->loadString($d['gift_types']);
	$giftTypes = $registry->toArray();

}

if (!empty($giftTypes)) {
	foreach($giftTypes as $k1 => $v1) {
		if (isset($v1['image']) && $v1['image'] !=
'') {
			$defaultImage =  $v1['image'];
		}
		if (isset($v1['class_name']) &&
$v1['class_name'] != '') {
			$defaultClassName = strip_tags($v1['class_name']);
		}
		if (isset($v1['expiration_date']) &&
$v1['expiration_date'] != '') {
			$defaultDate = $v1['expiration_date'];
		}
		if (isset($v1['description']) &&
$v1['description'] != '') {
			$defaultDescription = $v1['description'];
		}

		if (isset($v1['title']) && $v1['title'] !=
'') {
			$defaultTitle = $v1['title'];
		}
	}
}

foreach ($v->options as $k2 => $v2) {



	// Extends required part for some specific parameters
	$req = PhocacartRenderJs::renderRequiredParts((int)$v->id,
(int)$v2->required );
	$d['required'] = $req;


	if ($v2->operator == '=') {
        $operator = '';
    } else {
        $operator = $v2->operator;
    }
    $amount = $d['price']->getPriceFormat($v2->amount);


    // SET SOME VALUE?
    $active = '';
    if ($v2->default_value == 1) {
        $active = ' active';
    }

    $suffix = ' (' . $operator . ' ' . $amount .
')';
    if (isset($d['zero_attribute_price']) &&
$d['zero_attribute_price'] == 0 &&
$price->roundPrice($v2->amount) < 0.01 &&
$price->roundPrice($v2->amount) > -0.01) {
        $suffix = '';
    } else if (isset($d['zero_attribute_price']) &&
$d['zero_attribute_price'] == 2) {
        $suffix = '';// hide always
    }

    $maxLength = ' maxlength="' .
PhocacartAttribute::getAttributeLength($v->type, $v2->type) .
'"';



    echo '<div class="'.
$d['s']['c']['row'].'
ph-gift-box-form">';


	echo '<div
class="'.$d['s']['c']['col.xs12.sm6.md6'].'"><label
class="' . $d['s']['c']['btn'] .
' phTextAttributeInput ' . $active . '"
style="background-color: ' . strip_tags($v2->color) .
'">' . htmlspecialchars($v2->title) . $suffix .
$d['required']['span'] .
'</label></div>';




	echo '<div
class="'.$d['s']['c']['col.xs12.sm6.md6'].'">';
	switch ($v2->type) {


		case 24: // GIFT TYPE

			if (!empty($giftTypes)) {
				$i = 0;
				
				foreach($giftTypes as $k3 => $v3){

					$id = str_replace('gift_types', '', $k3 );

					$title = '';
					if (isset($v3['title']) && $v3['title'] !=
'') {
						$title = $v3['title'];
						if ($i == 0) {
							$defaultTitle = $title;
						}
					}

					$image = '';
					if (isset($v3['image']) && $v3['image'] !=
'') {
						$image = /*JURI::base(true) . '/' .*/
$v3['image'];
						if ($i == 0) {
							$defaultImage = $image;
						}
					}

					$date = '';
					if (isset($v3['expiration_date']) &&
$v3['expiration_date'] != '') {
						$date = JHtml::date($v3['expiration_date'],
JText::_('DATE_FORMAT_LC3'));
						if ($i == 0) {
							$defaultDate = $date;
						}
					}

					$description = '';
					if (isset($v3['description']) &&
$v3['description'] != '') {
						$description = $v3['description'];
						if ($i == 0) {
							$defaultDescription = $description;
						}
					}

					$className = 'default';
					if (isset($v3['class_name']) &&
$v3['class_name'] != '') {
						$className = $v3['class_name'];
						if ($i == 0) {
							$defaultClassName = $className;
						}
					}

					$checked = '';

					if ($i == 0) {
						$checked = ' checked';
					}
					echo '<div class="'.
$d['s']['c']['form-check'].'
ph-radio-gift-box">';

					echo '<input class="phAOGift '.
$d['s']['c']['form-check-input'].'"'
					.$checked
					.' data-type="phAOGiftType"'
					.' data-title="'. $title .'"'
					.' data-image="'. JURI::base(true) . '/' .
$image .'"'
					.' data-date="'. $date .'"'
					.' data-description="'. base64_encode($description)
.'"'
					.' data-class-name="'. $className .'"'
					.' type="radio"
id="phGiftTypes'.$id.'" name="attribute[' .
$v->id . '][' . $v2->id . ']" ' .
$d['required']['attribute'] . $maxLength
					.' value="'.$id.'">';

					if (isset($v3['image_small']) &&
$v3['image_small'] != '') {
						echo '<div class="ph-radio-gift-image"><img
src="'.JURI::base(true) . '/' .
$v3['image_small'].'" alt=""
/></div>';
					}

					echo '<label class="ph-radio-gift-title"
for="phGiftTypes'.$id.'">';



					if (isset($v3['image_small']) &&
$v3['image_small'] != '') {
						echo $v3['title'];
					}

					echo '</label>';
					echo '</div>';
					$i++;

				}

			}


        break;

		case 23: // GIFT SENDER MESSAGE
            echo '<textarea class="phAOGift
ph-attribute-textarea" data-type="phAOSenderMessage"
name="attribute[' . $v->id . '][' . $v2->id .
']" ' . $d['required']['attribute'] .
$maxLength . '></textarea>';
			$giftSenderMessageActive = 1;
        break;

		case 22: // GIFT Sender Name
            echo '<input class="phAOGift"
data-type="phAOSenderName" type="text"
name="attribute[' . $v->id . '][' . $v2->id .
']" value="" ' .
$d['required']['attribute'] . $maxLength . '
/>';
			$giftSenderNameActive = 1;
        break;
		case 21: // GIFT RECIPIENT EMAIL
            echo '<input class="phAOGift"
data-type="phAORecipientEmail" type="email"
name="attribute[' . $v->id . '][' . $v2->id .
']" value="" ' .
$d['required']['attribute'] . $maxLength . '
/>';

        break;

		case 20: // GIFT RECIPIENT Name
            echo '<input class="phAOGift"
data-type="phAORecipientName" type="text"
name="attribute[' . $v->id . '][' . $v2->id .
']" value="" ' .
$d['required']['attribute'] . $maxLength . '
/>';
			$giftRecipientNameActive = 1;
        break;

        default:

            echo '<input type="text"
name="attribute[' . $v->id . '][' . $v2->id .
']" value="" ' .
$d['required']['attribute'] . $maxLength . '
/>';

        break;
    }
	echo '</div>';

    echo '</div>';
}


$d2 = array();
$d2['gift_class_name'] = $defaultClassName;
$d2['gift_image'] = $defaultImage;
$d2['gift_title'] = $defaultTitle;
$d2['gift_description'] = $defaultDescription;
$d2['discount'] =
isset($d['priceitems']['bruttoformat']) ?
$d['priceitems']['bruttoformat'] : '';
$d2['valid_to'] = JHtml::date($defaultDate,
JText::_('DATE_FORMAT_LC3'));
$d2['valid_from'] = '';
$d2['code'] = '';
$d2['gift_sender_name'] = $giftSenderNameActive == 1 ?
'&nbsp;' : '';
$d2['gift_recipient_name'] = $giftRecipientNameActive == 1 ?
'&nbsp;' : '';
$d2['gift_sender_message'] = $giftSenderMessageActive == 1 ?
'&nbsp;' : '';
$d2['typeview'] = $d['typeview'];
$d2['product_id'] = $d['product_id'];
$d2['format']	= 'html';
if ($d['typeview'] == 'Item') {
	// Display only in Item View
	echo $layoutG->render($d2);
}


echo '</div>';// end attribute box
echo '</div>';// end attribute
?>
layouts/attribute_options_select.php000064400000010465151167552070014111
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d 					= $displayData;
$displayData 		= null;
$v 					= $d['attribute'];
$attributeIdName	=
'V'.$d['typeview'].'P'.(int)$d['product_id'].'A'.(int)$v->id;
$productIdName		=
'V'.$d['typeview'].'P'.(int)$d['product_id'];
$iconType			= $d['s']['i']['icon-type'];
$price				= new PhocacartPrice();

$attr				= array();
$attr[]				=
'id="phItemAttribute'.$attributeIdName.'"';//
ID
$attr[]				= 'class="form-control chosen-select
ph-item-input-set-attributes phj'. $d['typeview'].'
phjProductAttribute"';// CLASS
$attr[]				= $d['required']['attribute'];
$attr[]				=
'name="attribute['.(int)$v->id.']"';
$attr[]				= 'data-product-id="'.
$d['product_id'].'"';// Product ID
$attr[]				= 'data-product-id-name="'.
$productIdName.'"';// Product ID - Unique name between
different views
$attr[]				= 'data-attribute-type="'.
$v->type.'"';// Type of attribute (select, checkbox,
color, image)
$attr[]				= 'data-attribute-id-name="'.
$attributeIdName.'"';// Attribute ID - Unique name between
different views and products
$attr[]				= 'data-type-view="'.
$d['typeview'].'"';// In which view are attributes
displayed: Category, Items, Item, Quick Item
$attr[]				= 'data-type-icon="'.
$iconType.'"';// Which icons are used on the site (Bootstrap
Glyphicons | Font Awesome | ...)
$attr[]				=
'data-required="'.$d['required']['required'].'"';
$attr[]				=
'data-alias="'.htmlspecialchars($v->alias).'"';


echo '<div
id="phItemBoxAttribute'.$attributeIdName.'">';
echo '<select '.implode(' ',
$attr).'>';
if ((int)$d['required']['required'] == 1 &&
(int)$d['remove_select_option_attribute'] == 1) {
	// If the attribute is requried, there cannot be select option in select
box (to select no value)
	// this is not a problem for "add to cart" button as it just
checks for the selected options
	// but for ajaxes like chaning price or stock in item view, this is why
this option is not displayed when attribute required
} else {
	echo '<option value="">'.
JText::_('COM_PHOCACART_SELECT_OPTION').'</option>';
}

foreach ($v->options as $k2 => $v2) {
	if($v2->operator == '=') {
		$operator = '';
	} else {
		$operator = $v2->operator;
	}
	$amount = $d['price']->getPriceFormat($v2->amount);

	// Switch large image
	$attrO		= '';

	if ($d['dynamic_change_image'] == 1) {
		if ($d['image_size'] == 'large' &&
isset($v2->image) && $v2->image != '') {
			$imageO 	= PhocacartImage::getThumbnailName($d['pathitem'],
$v2->image, $d['image_size']);
		} else if ($d['image_size'] == 'medium' &&
isset($v2->image) && $v2->image != '') {
			$imageO 	= PhocacartImage::getThumbnailName($d['pathitem'],
$v2->image, $d['image_size']);
		}

		if (isset($imageO->rel) && $imageO->rel != '') {
			$linkO 		= JURI::base(true).'/'.$imageO->rel;

			if (JFile::exists($imageO->abs)) {
				$attrO		.=
'data-image-option="'.htmlspecialchars($linkO).'"';
			}
		}

	}

	// SELECTBOX COLOR
	if ($v->type == 2 && isset($v2->color) &&
$v2->color != '') {
		$attrO		.= '
data-color="'.strip_tags($v2->color).'"';
	}

	// SELECTBOX IMAGE
	if ($v->type == 3 && isset($v2->image_small) &&
$v2->image_small != '') {
		$linkI 		=
JURI::base(true).'/'.$d['pathitem']['orig_rel'].'/'.$v2->image_small;
		$attrO		.= '
data-image="'.strip_tags($linkI).'"';
	}

	// SELECTED SOME VALUE?
	if ($v2->default_value == 1) {
		$attrO		.= ' selected="seleced"';
	}

	$suffix =  ' ('.$operator.' '.$amount.')';
	if (isset($d['zero_attribute_price']) &&
$d['zero_attribute_price'] == 0 &&
$price->roundPrice($v2->amount) < 0.01 &&
$price->roundPrice($v2->amount) > -0.01) {
		$suffix = '';
	} else if (isset($d['zero_attribute_price']) &&
$d['zero_attribute_price'] == 2) {
		$suffix = '';// hide always
	}

	echo '<option '.$attrO.'
value="'.$v2->id.'"
data-value-alias="'.htmlspecialchars($v2->alias).'">'.htmlspecialchars($v2->title).$suffix.'</option>';
}

echo '</select>';// end select box
echo '</div>';// end attribute
echo '<div
id="phItemHiddenAttribute'.$attributeIdName.'"
style="display:none;"></div>';

?>
layouts/attribute_options_text.php000064400000011410151167552070013605
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license   http://www.gnu.org/copyleft/gpl.html GNU/GPL, see
LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license   http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */

use Joomla\CMS\HTML\HTMLHelper;

defined('_JEXEC') or die();
$d               = $displayData;
$displayData     = null;
$v               = $d['attribute'];
$attributeIdName = 'V' . $d['typeview'] . 'P'
. (int)$d['product_id'] . 'A' . (int)$v->id;
$productIdName   = 'V' . $d['typeview'] . 'P'
. (int)$d['product_id'];
$iconType        =
$d['s']['i']['icon-type'];
$price           = new PhocacartPrice();

$attr   = array();
$attr[] = 'id="phItemAttribute' . $attributeIdName .
'"';// ID
$attr[] = 'class="ph-checkbox-attribute
ph-item-input-set-attributes phj' . $d['typeview'] . '
phjProductAttribute ' . $d['required']['class'] .
'"';// CLASS
$attr[] = 'data-product-id="' . $d['product_id'] .
'"';// Product ID
$attr[] = 'data-product-id-name="' . $productIdName .
'"';// Product ID - Unique name between different views
$attr[] = 'data-attribute-type="' . $v->type .
'"';// Type of attribute (select, checkbox, color, image)
$attr[] = 'data-attribute-id-name="' . $attributeIdName .
'"';// Attribute ID - Unique name between different views
and products
$attr[] = 'data-type-view="' . $d['typeview'] .
'"';// In which view are attributes displayed: Category,
Items, Item, Quick Item
$attr[] = 'data-type-icon="' . $iconType .
'"';// Which icons are used on the site (Bootstrap
Glyphicons | Font Awesome | ...)


echo '<div id="phItemBoxAttribute' . $attributeIdName .
'">';
echo '<div ' . implode(' ', $attr) .
'>';


// CHECKBOX COLOR CHECKBOX IMAGE
/*if ($v->type == 5 || $v->type == 6) {
	echo '<div class="ph-item-input-checkbox-color"
data-toggle="buttons">';
}*/

foreach ($v->options as $k2 => $v2) {
	// Extends required part for some specific parameters
	$req = PhocacartRenderJs::renderRequiredParts((int)$v->id,
(int)$v2->required );
	$d['required'] = $req;												  
    if ($v2->operator == '=') {
        $operator = '';
    } else {
        $operator = $v2->operator;
    }
    $amount = $d['price']->getPriceFormat($v2->amount);


    // SET SOME VALUE?
    $active = '';
    if ($v2->default_value == 1) {
        $active = ' active';
    }

    $suffix = ' (' . $operator . ' ' . $amount .
')';
    if (isset($d['zero_attribute_price']) &&
$d['zero_attribute_price'] == 0 &&
$price->roundPrice($v2->amount) < 0.01 &&
$price->roundPrice($v2->amount) > -0.01) {
        $suffix = '';
    } else if (isset($d['zero_attribute_price']) &&
$d['zero_attribute_price'] == 2) {
        $suffix = '';// hide always
    }

    $maxLength = ' maxlength="' .
PhocacartAttribute::getAttributeLength($v->type) . '"';

	echo '<div class="'.
$d['s']['c']['row'].'
ph-gift-box-form">';															   
    echo '<div
class="'.$d['s']['c']['col.xs12.sm6.md6'].'"><label
class="' . $d['s']['c']['btn'] .
' phTextAttributeInput ' . $active . '"
style="background-color: ' . strip_tags($v2->color) .
'">' . htmlspecialchars($v2->title) . $suffix .
$d['required']['span'] .
'</label></div>';
	echo '<div
class="'.$d['s']['c']['col.xs12.sm6.md6'].'">';																					
 
    switch ($v->type) {
        case 10:
        case 11:
		case 23: // GIFT SENDER MESSAGE

            echo '<textarea class="ph-attribute-textarea"
name="attribute[' . $v->id . '][' . $v2->id .
']" ' . $d['required']['attribute'] .
$maxLength . '></textarea>';

        break;

        case 12:

        	HTMLHelper::_('jquery.framework');
			HTMLHelper::_('script',
'media/com_phocacart/js/jcp/picker.js', array('version'
=> 'auto'));
			HTMLHelper::_('stylesheet',
'media/com_phocacart/js/jcp/picker.css',
array('version' => 'auto'));

        	$idA = 'phColorText';
			$idAC = $idA.'PickerName'. $v->id . 'Id'.
$v2->id;

        	echo '<span class="input-append">';
            echo '<input type="text" id="' .
$idAC . '" name="attribute[' . $v->id .
'][' . $v2->id . ']" value="" ' .
$d['required']['attribute'] . $maxLength . '
class="text_area phColorText" />';
			echo ' <a href="javascript:void(0);"
role="button" class="btn btn-primary
'.$idA.'PickerButton" onclick="openPicker(\''
. $idAC . '\');">';
			echo '<span class="icon-list
icon-white"></span> ';
			echo JText::_('COM_PHOCACART_FORM_SELECT_COLOR') .
'</a>';
			echo '</span>';
        break;

        default:

            echo '<input type="text"
name="attribute[' . $v->id . '][' . $v2->id .
']" value="" ' .
$d['required']['attribute'] . $maxLength . '
/>';

        break;
    }
    echo '</div>';
	echo '</div>';
}


echo '</div>';// end attribute box
echo '</div>';// end attribute
?>
layouts/button_add_to_cart_icon.php000064400000003046151167552070013637
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;

// Add to Cart Form needs to be loaded in default view
//echo $layoutPFS->render($dF);// Start Form
//echo $layoutPFE->render();// End Form


if ($d['selectoptions'] == 1) {
	// ICON ATTRIBUTE REQUIRED AND ATTRIBUTES NOT DISPLAYED - so we should
redirect to detail view

	echo '<div
class="ph-category-item-addtocart">';
	echo '<a href="'.$d['link'].'"
title="'. JText::_('COM_PHOCACART_CHOOSE_VARIANT') /*
JText::_('COM_PHOCACART_SELECT_OPTIONS') */.'"
data-toggle="tooltip" data-placement="top">';
	echo '<span
class="'.$d['s']['i']['shopping-cart'].'"></span>';
	echo '</a>';
	echo '</div>';

} else {
	// ICON ATTRIBUTE IS REQUIRED/IS NOT REQUIRED BUT ATTRIBUTES ARE LISTED IN
CATEGROY/TEMS VIEW

	$onClick =
'onclick="jQuery(\'#phCartAddToCartButton'.(int)$d['id'].'\').find(\':submit\').click();return
false;"';

	echo '<div class="ph-category-item-addtocart
phProductAddToCartIcon'.$d['typeview'].(int)$d['id'].'
'.$d['class_icon'].'"><a
href="javascript:void(0);" '.$onClick.'
title="'.JText::_('COM_PHOCACART_ADD_TO_CART').'"
data-toggle="tooltip" data-placement="top">';
	echo '<span
class="'.$d['s']['i']['shopping-cart'].'"></span>';
	echo '</a>';
	echo '</div>';
}
layouts/button_add_to_cart_item.php000064400000004240151167552070013642
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;

?>
<div class="<?php echo
$d['s']['c']['pull-right'] ?> <?php
echo $d['s']['c']['form-group'] ?>
ph-item-add-to-cart-box">
	<input type="hidden" name="id" value="<?php
echo (int)$d['id']; ?>">
	<input type="hidden" name="catid"
value="<?php echo (int)$d['catid']; ?>">
	<input type="hidden" name="task"
value="checkout.add">
	<input type="hidden" name="tmpl"
value="component" />
	<input type="hidden" name="option"
value="com_phocacart" />
	<input type="hidden" name="return"
value="<?php echo $d['return']; ?>" />
	<div class="<?php echo
$d['s']['c']['form-group'] ?>
ph-form-quantity phProductAddToCart<?php echo $d['typeview'].
(int)$d['id'] .' '.$d['class_btn'];
?>">
	<label><?php echo JText::_('COM_PHOCACART_QTY'); ?>:
</label>
	<input class="<?php echo
$d['s']['c']['form-control'] ?>
ph-input-quantity" type="text" name="quantity"
value="1" />
	</div>
	 <div class="<?php echo
$d['s']['c']['form-group'] ?>
ph-form-button"><?php
	if ($d['addtocart'] == 1) {
		?><button type="submit" class="<?php echo
$d['s']['c']['btn.btn-primary'] ?> ph-btn
phProductAddToCart<?php echo $d['typeview'] .
(int)$d['id'] .' '.$d['class_btn'];
?>"><span class="<?php echo
$d['s']['i']['shopping-cart']
?>"></span> <?php echo
JText::_('COM_PHOCACART_ADD_TO_CART');
?></button><?php
	} else if ($d['addtocart'] == 4) {
		?><button type="submit" class="<?php echo
$d['s']['c']['btn.btn-primary'] ?> ph-btn
phProductAddToCart<?php echo $d['typeview'].
(int)$d['id'] .' '.$d['class_btn'];
?>" title="<?php echo
JText::_('COM_PHOCACART_ADD_TO_CART'); ?>"><span
class="<?php echo
$d['s']['i']['shopping-cart']
?>"></span></button><?php
	} ?>
	<?php /* <input type="submit" value="submit"
name="submit" role="button" /> */ ?>
	</div>
	<div class="ph-cb"></div>
<?php echo Joomla\CMS\HTML\HTMLHelper::_('form.token'); ?>
</div>

layouts/button_add_to_cart_list.php000064400000015553151167552070013670
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */

defined('_JEXEC') or die();
$d = $displayData;



// Be aware when overwriting this layout
// There are different combinations of buttons
// ATTRIBUTE REQUIRED/ATTRIBUTE NOT REQUIRED - BUTTON/ICON - STANDARD/AJAX
// THIS LAYOUT can be display twice for item - first for ICON, second for
BUTTON - so only ICON have ID to run AJAX, etc.


if ($d['selectoptions'] == 1) {
	// ATTRIBUTE REQUIRED - One of the attributes is required, cannot add to
cart when we don't display attributes in category/items view
	echo '<div
class="'.$d['s']['c']['pull-right'].'">';


	if ($d['addtocart'] == 1) {

		echo '<a href="'.$d['link'].'"
class="'.$d['s']['c']['btn.btn-primary.btn-sm'].'
ph-btn
phProductAddToCart'.$d['typeview'].$d['id'].'
'.$d['class_btn'].'"
role="button">';
		echo '<span
class="'.$d['s']['i']['shopping-cart'].'"></span>
';
		echo JText::_('COM_PHOCACART_CHOOSE_VARIANT'); //
JText::_('COM_PHOCACART_SELECT_OPTIONS');
		echo '</a>';

	} else if ($d['addtocart'] == 4) {

		echo '<a href="'.$d['link'].'"
class="'.$d['s']['c']['btn.btn-primary.btn-sm'].'
ph-btn
phProductAddToCart'.$d['typeview'].$d['id'].'
'.$d['class_btn'].'" role="button"
title="'.JText::_('COM_PHOCACART_CHOOSE_VARIANT') /*
JText::_('COM_PHOCACART_SELECT_OPTIONS') */.'"
data-toggle="tooltip" data-placement="top">';
		echo '<span
class="'.$d['s']['i']['shopping-cart'].'"></span>';
		echo '</a>';
	}



	echo '</div>';
	echo '<div class="ph-cb"></div>';

} else {

	echo '<div
class="'.$d['s']['c']['pull-right'].'">';

	// BUTTON ATTRIBUTE NOT REQUIRED OR REQUIRED BUT we list the attributes in
category/items view so we can submit
	$onClick = '';
	if ($d['addtocart'] == 1) { // Standard

		echo '<button type="submit"
class="'.$d['s']['c']['btn.btn-primary.btn-sm'].'
ph-btn
phProductAddToCart'.$d['typeview'].$d['id'].'
'.$d['class_btn'].'"
'.$onClick.'>';
		echo '<span
class="'.$d['s']['i']['shopping-cart'].'"></span>
';
		echo JText::_('COM_PHOCACART_ADD_TO_CART');
		echo '</button>';

	} else if ($d['addtocart'] == 4) { // Icon Only
		echo '<button type="submit"
class="'.$d['s']['c']['btn.btn-primary.btn-sm'].'
ph-btn
phProductAddToCart'.$d['typeview'].$d['id'].'
'.$d['class_btn'].'"
title="'.JText::_('COM_PHOCACART_ADD_TO_CART').'"
data-toggle="tooltip" data-placement="top"
'.$onClick.'>';
		echo '<span
class="'.$d['s']['i']['shopping-cart'].'"></span>';
		echo '</button>';
	}



	echo '</div>';// pull right
	echo '<div class="ph-cb"></div>';
}


/*
if ($d['icon'] == 1) {
	// ICON ATTRIBUTE NOT REQUIRED
	if ($d['method'] == 0) {
		// STANDARD (add to cart method)
		$onClick =
'onclick="document.getElementById(\'phCartAddToCartButton'.(int)$d['id'].'\').submit();"';
	} else {
		// AJAX (add to cart method)
		$onClick =
'onclick="phEventClickFormAddToCart(\'phCartAddToCartButton'.(int)$d['id'].'\');"';
	}

	echo '<div class="ph-category-item-addtocart"><a
href="javascript:void(0);" '.$onClick.'
title="'.JText::_('COM_PHOCACART_ADD_TO_CART').'"
data-toggle="tooltip" data-placement="top">';
	echo '<span
class="'.PhocacartRenderIcon::getClass('shopping-cart').'"></span>';
	echo '</a>';
	echo '</div>';

} else {
	*/


/*
if ($d['attrrequired'] == 1) {
	// ATTRIBUTE REQUIRED - One of the attributes is required, cannot add to
cart
	echo '<div class="ph-pull-right">';

	if ($d['icon'] == 1) {

		// ICON - ATTRIBUTE REQUIRED
		echo '<div
class="ph-category-item-addtocart">';
		echo '<a href="'.$d['link'].'"
title="'.
JText::_('COM_PHOCACART_ADD_TO_CART').'"
data-toggle="tooltip" data-placement="top">';
		echo '<span
class="'.PhocacartRenderIcon::getClass('shopping-cart').'"></span>';
		echo '</a>';
		echo '</div>';

	} else {
		// BUTTON - ATTRIBUTE REQUIRED
		if ($d['addtocart'] == 1) {

			echo '<a href="'.$d['link'].'"
class="btn btn-primary btn-sm ph-btn btn-small"
role="button">';
			echo '<span
class="'.PhocacartRenderIcon::getClass('shopping-cart').'"></span>
';
			echo JText::_('COM_PHOCACART_ADD_TO_CART');
			echo '</a>';

		} else if ($d['addtocart'] == 4) {

			echo '<a href="'.$d['link'].'"
class="btn btn-primary btn-sm ph-btn btn-small"
role="button"
title="'.JText::_('COM_PHOCACART_ADD_TO_CART').'"
data-toggle="tooltip" data-placement="top">';
			echo '<span
class="'.PhocacartRenderIcon::getClass('shopping-cart').'"></span>';
			echo '</a>';
		}
	}

	echo '</div>';

} else { */
	// ATTRIBUTE NOT REQUIRED
/*	if ($d['icon'] == 1) {
		// If icon then we need ID of form to run it per jquery
		echo '<form class="phItemCartBoxForm"
id="phCartAddToCartIcon'.(int)$d['id'].'"
action="'.$d['linkch'].'"
method="post">';
	} else {
		// If button then we need ID of form to run it per jquery like by icon -
because of loaded items per ajax
		echo '<form class="phItemCartBoxForm"
id="phCartAddToCartButton'.(int)$d['id'].'"
action="'.$d['linkch'].'"
method="post">';
	}*/



/*	echo '<div class="ph-pull-right">';

	if ($d['icon'] == 1) {
		// ICON ATTRIBUTE NOT REQUIRED
		if ($d['method'] == 0) {
			// STANDARD (add to cart method)
			$onClick =
'onclick="document.getElementById(\'phCartAddToCartButton'.(int)$d['id'].'\').submit();"';
		} else {
			// AJAX (add to cart method)
			$onClick =
'onclick="phEventClickFormAddToCart(\'phCartAddToCartButton'.(int)$d['id'].'\');"';
		}

		echo '<div class="ph-category-item-addtocart"><a
href="javascript:void(0);" '.$onClick.'
title="'.JText::_('COM_PHOCACART_ADD_TO_CART').'"
data-toggle="tooltip" data-placement="top">';
		echo '<span
class="'.PhocacartRenderIcon::getClass('shopping-cart').'"></span>';
		echo '</a>';
		echo '</div>';

	} else {
		// BUTTON ATTRIBUTE NOT REQUIRED
		if ($d['method'] == 0) {
			// STANDARD (add to cart method)
			$onClick = '';
		} else {
			// AJAX (add to cart method)
			$onClick =
'onclick="phEventClickFormAddToCart(\'phCartAddToCartButton'.(int)$d['id'].'\');event.preventDefault();return
false;"';
		}

		if ($d['addtocart'] == 1) {
			echo '<button type="submit" class="btn
btn-primary btn-sm ph-btn btn-small"
'.$onClick.'>';
			echo '<span
class="'.PhocacartRenderIcon::getClass('shopping-cart').'"></span>
';
			echo JText::_('COM_PHOCACART_ADD_TO_CART');
			echo '</button>';

		} else if ($d['addtocart'] == 4) {
			echo '<button type="submit" class="btn
btn-primary btn-sm ph-btn btn-small"
title="'.JText::_('COM_PHOCACART_ADD_TO_CART').'"
data-toggle="tooltip" data-placement="top"
'.$onClick.'>';
			echo '<span
class="'.PhocacartRenderIcon::getClass('shopping-cart').'"></span>';
			echo '</button>';
		}
	}

	echo '</div>';// pull right
	echo '<div class="clearfix"></div>';*/


//}
?>
layouts/button_ask_question.php000064400000003256151167552070013074
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;

if ($d['popup'] == 2) { ?>

<div class="<?php echo
$d['s']['c']['pull-right'];?>">
        <a href="javascript:void(0)"
data-toggle="modal" data-id="phAskAQuestionPopup"
data-src="<?php echo $d['link'] ?>"
class="<?php echo
$d['s']['c']['btn.btn-default.btn-sm'];?>
ph-btn phModalContainerButton" role="button"
title="<?php echo
JText::_('COM_PHOCACART_ASK_A_QUESTION'); ?>" 
data-toggle="tooltip" data-placement="top"><span
class="<?php echo
$d['s']['i']['question-sign']
?>"></span> <?php echo
JText::_('COM_PHOCACART_ASK_A_QUESTION'); ?></a>
</div>

<?php } else if ($d['popup'] == 1) { ?>

<div class="<?php echo
$d['s']['c']['pull-right'];?>">
	<a href="<?php echo $d['link']; ?>"
class="<?php echo
$d['s']['c']['btn.btn-default.btn-sm'];?>
ph-btn" role="button" onclick="phWindowPopup(this.href,
'phWindowPopup', 2.5, 1.2);return false;"><span
class="<?php echo
$d['s']['i']['question-sign']
?>"></span> <?php echo
JText::_('COM_PHOCACART_ASK_A_QUESTION'); ?></a>
</div>

<?php } else { ?>

<div class="<?php echo
$d['s']['c']['pull-right'];?>">
	<a href="<?php echo $d['link']; ?>"
class="<?php echo
$d['s']['c']['btn.btn-default.btn-sm'];?>
ph-btn" role="button"><span class="<?php echo
$d['s']['i']['question-sign']
?>"></span> <?php echo
JText::_('COM_PHOCACART_ASK_A_QUESTION'); ?></a>
</div>
<?php }




layouts/button_buy_now_paddle.php000064400000001577151167552070013366
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;
$document = JFactory::getDocument();
$document->addScript('https://paddle.s3.amazonaws.com/checkout/checkout.js');

?>
<div class="<?php echo
$d['s']['c']['pull-right'];?>
ph-item-buy-now-box">
	<button type="submit" class="<?php echo
$d['s']['c']['btn.btn-primary'];?> ph-btn
paddle_button" data-product="<?php echo
$d['external_id']; ?>"
data-theme="green"><span class="<?php echo
$d['s']['i']['shopping-cart'];
?>"></span> <?php echo
JText::_('COM_PHOCACART_BUY_NOW'); ?></button>
</div>
<div class="ph-cb"></div>
layouts/button_category_view.php000064400000002026151167552070013230
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;

echo '<div
class="'.$d['s']['c']['pull-right'].'">';

if ($d['display_view_category_button'] == 1) {

    echo '<a href="'.$d['link'].'"
class="'.$d['s']['c']['btn.btn-primary'].'"
role="button">';
    echo '<span
class="'.$d['s']['i']['view-category'].'"></span>
';
    echo
JText::_('COM_PHOCACART_VIEW_CATEGORY').'</a>';

} else if ($d['display_view_category_button'] == 2) {

    echo '<a href="'.$d['link'].'"
class="'.$d['s']['c']['btn.btn-primary'].'"
role="button"
title="'.JText::_('COM_PHOCACART_VIEW_CATEGORY').'">';
    echo '<span
class="'.$d['s']['i']['view-category'].'"></span></a>';

}

echo '</div>';
echo '<div class="ph-cb"></div>';
?>
layouts/button_compare.php000064400000003437151167552070012016
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;
?>
<div class="<?php echo
$d['s']['c']['pull-right'] ?>">
    <div class="ph-category-item-compare">
        <form action="<?php echo $d['linkc'];
?>" method="post" id="phCompare<?php echo
(int)$d['id']; ?>"
class="phItemCompareBoxForm">
            <input type="hidden" name="id"
value="<?php echo (int)$d['id']; ?>" />
            <input type="hidden" name="catid"
value="<?php echo (int)$d['catid']; ?>" />
            <input type="hidden" name="task"
value="comparison.add" />
            <input type="hidden" name="tmpl"
value="component" />
            <input type="hidden" name="option"
value="com_phocacart" />
            <input type="hidden" name="return"
value="<?php echo $d['return']; ?>" />

            <?php if (isset($d['method']) &&
(int)$d['method'] > 0) { ?>
                <a href="javascript:void(0)"
onclick="phItemCompareBoxFormAjax('phCompare<?php echo
(int)$d['id']; ?>');" title="<?php echo
JText::_('COM_PHOCACART_COMPARE'); ?>"><span
class="<?php echo
$d['s']['i']['compare']
?>"></span></a>
            <?php } else { ?>
                <a href="javascript:void(0)"
onclick="document.getElementById('phCompare<?php echo
(int)$d['id']; ?>').submit();" title="<?php
echo JText::_('COM_PHOCACART_COMPARE'); ?>"><span
class="<?php echo
$d['s']['i']['compare']
?>"></span></a>
            <?php } ?>

            <?php echo
Joomla\CMS\HTML\HTMLHelper::_('form.token'); ?>
        </form>
    </div>
</div>
layouts/button_external_link.php000064400000001436151167552070013224
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d 		= $displayData;
$text	= ' ';
if ($d['external_text'] != '') {
	$text = $d['external_text'];
}
?>
<div class="<?php echo
$d['s']['c']['pull-right']; ?>
ph-item-buy-now-box">
	<a class="<?php echo
$d['s']['c']['btn.btn-primary.btn-sm']; ?>
ph-btn" href="<?php echo $d['external_link'];
?>" target="_blank"><span class="<?php echo
$d['s']['i']['ext-link']
?>"></span> <?php echo JText::_($text);
?></a>
</div>
<div class="ph-cb"></div>
layouts/button_product_view.php000064400000002077151167552070013101
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;
?>
<div class="<?php echo
$d['s']['c']['pull-left']; ?>">
<?php
if ($d['display_view_product_button'] == 1) {

	?><a href="<?php echo $d['link']; ?>"
class="<?php echo
$d['s']['c']['btn.btn-primary.btn-sm']; ?>
ph-btn" role="button"><span class="<?php echo
$d['s']['i']['view-product']
?>"></span> <?php echo
JText::_('COM_PHOCACART_VIEW_PRODUCT'); ?></a><?php

} else if ($d['display_view_product_button'] == 2) {

	?><a href="<?php echo $d['link']; ?>"
class="<?php echo
$d['s']['c']['btn.btn-primary.btn-sm']; ?>
ph-btn" role="button" title="<?php echo
JText::_('COM_PHOCACART_VIEW_PRODUCT'); ?>"><span
class="<?php echo
$d['s']['i']['view-product']
?>"></span></a><?php

} ?>
</div>

<?php




layouts/button_public_download.php000064400000002504151167552070013527
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;
?>
<form action="<?php echo $d['linkdownload'];
?>" method="post" id="phPublicDownload<?php echo
(int)$d['id']; ?>"
class="phItemPublicDownloadBoxForm">
	<input type="hidden" name="id" value="<?php
echo (int)$d['id']; ?>" />
	<input type="hidden" name="task"
value="download.downloadpublic" />
	<input type="hidden" name="tmpl"
value="component" />
	<input type="hidden" name="option"
value="com_phocacart" />
	<input type="hidden" name="return"
value="<?php echo $d['return']; ?>" />
	<div class="ph-pull-right">
		<div class="ph-category-item-public-download">
		<button type="submit" class="<?php echo
$d['s']['c']['btn.btn-primary'] ?>
ph-btn"><span class="<?php echo
$d['s']['i']['download']
?>"></span><?php
		if ($d['title'] != '') {
			echo ' '. $d['title'];
		} else {
			echo ' '. JText::_('COM_PHOCACART_DOWNLOAD');
		}
		?></button>
		</div>
	</div>
	<div class="ph-cb"></div>
	<?php echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
?>
</form>
layouts/button_quickview.php000064400000003740151167552070012374
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;
?>
<div class="<?php echo
$d['s']['c']['pull-right'] ?>">
    <?php echo isset($d['button']) &&
$d['button'] == 1 ? '' : '<div
class="ph-category-item-quickview">'; ?>
        <form action="<?php echo $d['linkqvb'];
?>" method="post" id="phQuickView<?php echo
(int)$d['id']; ?>"
class="phItemQuickViewBoxForm">
            <input type="hidden" name="id"
value="<?php echo (int)$d['id']; ?>" />
            <input type="hidden" name="catid"
value="<?php echo (int)$d['catid']; ?>" />
            <input type="hidden" name="tmpl"
value="component" />
            <input type="hidden" name="option"
value="com_phocacart" />
            <input type="hidden" name="return"
value="<?php echo $d['return']; ?>" />

            <?php if (isset($d['button']) &&
$d['button'] == 1) { ?>
                <a href="javascript:void(0)"
onclick="phItemQuickViewBoxFormAjax('phQuickView<?php echo
(int)$d['id']; ?>');" class="<?php echo
$d['s']['c']['btn.btn-primary.btn-sm']; ?>
ph-btn" role="button"><span class="<?php echo
$d['s']['i']['quick-view']
?>"></span> <?php echo
JText::_('COM_PHOCACART_QUICK_VIEW'); ?></a>

            <?php } else { ?>
                <a href="javascript:void(0)"
onclick="phItemQuickViewBoxFormAjax('phQuickView<?php echo
(int)$d['id']; ?>');" title="<?php echo
JText::_('COM_PHOCACART_QUICK_VIEW'); ?>" 
data-toggle="tooltip" data-placement="top"><span
class="<?php echo
$d['s']['i']['quick-view']
?>"></span></a>
            <?php } ?>
            <?php echo
Joomla\CMS\HTML\HTMLHelper::_('form.token'); ?>
        </form>
    <?php echo isset($d['button']) &&
$d['button'] == 1 ? '' : '</div>';
?>
</div>
layouts/button_submit_hidden.php000064400000001352151167552070013200
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
// In case we don't display the add to cart button
// but we display add to cart icon only - in this case add to cart icon is
located outside the add to cart form
// so with add to cart icon we run jQuery event: click on submit button
// but if there is no submit button in form (no add to cart button) we need
to add some which will be hidden
?>
<input type="submit" style="display:none"
/>layouts/button_wishlist.php000064400000003471151167552070012234
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;
?>
<div class="<?php echo
$d['s']['c']['pull-right'] ?>">
    <div class="ph-category-item-wishlist">
        <form action="<?php echo $d['linkw'];
?>" method="post" id="phWishList<?php echo
(int)$d['id']; ?>"
class="phItemWishListBoxForm">
            <input type="hidden" name="id"
value="<?php echo (int)$d['id']; ?>" />
            <input type="hidden" name="catid"
value="<?php echo (int)$d['catid']; ?>" />
            <input type="hidden" name="task"
value="wishlist.add" />
            <input type="hidden" name="tmpl"
value="component" />
            <input type="hidden" name="option"
value="com_phocacart" />
            <input type="hidden" name="return"
value="<?php echo $d['return']; ?>" />

            <?php if (isset($d['method']) &&
(int)$d['method'] > 0) { ?>
                <a href="javascript:void(0)"
onclick="phItemWishListBoxFormAjax('phWishList<?php echo
(int)$d['id']; ?>');" title="<?php echo
JText::_('COM_PHOCACART_ADD_TO_WISH_LIST');
?>"><span class="<?php echo
$d['s']['i']['wish-list']
?>"></span></a>
            <?php } else { ?>
                <a href="javascript:void(0)"
onclick="document.getElementById('phWishList<?php echo
(int)$d['id']; ?>').submit();" title="<?php
echo JText::_('COM_PHOCACART_ADD_TO_WISH_LIST');
?>"><span class="<?php echo
$d['s']['i']['wish-list']
?>"></span></a>
            <?php } ?>

            <?php echo
Joomla\CMS\HTML\HTMLHelper::_('form.token'); ?>
        </form>
    </div>
</div>
layouts/cart_cart.php000064400000044157151167552070010743 0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

$layoutI	= new JLayoutFile('image', null,
array('component' => 'com_phocacart'));

$d 		= $displayData;
$price	= new PhocacartPrice();
$app 	= JFactory::getApplication();

// Component parameters params
// Module parameters paramsmodule
$p = array();
$p['tax_calculation']					= $d['params']->get(
'tax_calculation', 0 );
$p['stock_checkout']					= $d['params']->get(
'stock_checkout', 0 );
$p['stock_checking']					= $d['params']->get(
'stock_checking', 0 );
$p['display_discount_product']			=
$d['params']->get( 'display_discount_product', 1 );
$p['zero_shipping_price_calculation']	=
$d['params']->get(
'zero_shipping_price_calculation', 0 );
$p['zero_payment_price_calculation']	=
$d['params']->get( 'zero_payment_price_calculation',
0 );
$p['display_webp_images']				= $d['params']->get(
'display_webp_images', 0 );
$p['display_zero_total']			    = $d['params']->get(
'display_zero_total', 0 );

if (!empty($d['fullitems'])) {


	// CLASS NAMES
	// Display image next to product title, one more column
	if (isset($d['paramsmodule']['display_image'])
&& $d['paramsmodule']['display_image'] == 1) {
		//$c2 = 3;// Colspans of table;
		//$c3 = 4;
		$cI 	= $d['s']['c']['col.xs12.sm2.md2'];//
+2
		$cX 	= $d['s']['c']['col.xs12.sm1.md1'];
		$cXT 	= $d['s']['c']['col.xs12.sm5.md5'];//
-1
		$cXP 	= $d['s']['c']['col.xs12.sm4.md4'];//
-1
		$cS		= '-i';
	} else {
		//$c2 = 2;
		//$c3 = 3;
		$cI 	= '';
		$cX 	= $d['s']['c']['col.xs12.sm1.md1']; //
X Emtpy space
		$cXT 	= $d['s']['c']['col.xs12.sm6.md6'];
// T Text/Title
		$cXP 	= $d['s']['c']['col.xs12.sm5.md5'];
// P Price
		$cS		= ''; // S Suffix
	}
	//$r	= 'row-fluid';
	$r	= $d['s']['c']['row'];
	$cT = $d['s']['c']['col.xs12.sm7.md7'];
	$cP = $d['s']['c']['col.xs12.sm5.md5'];
	$cA = $d['s']['c']['col.xs12.sm12.md12'];

	// echo '<table class="ph-cart-small-box">';
	echo '<div class="ph-cart-small-box">';
	// echo '<div class="container">';

	/*
	HEAD
	echo '<tr>';
	echo '<td><span
class="ph-small">'.JText::_('MOD_PHOCACART_CART_PRODUCT').'</span></td>';
	echo '<td><span
class="ph-small">'.JText::_('MOD_PHOCACART_CART_COUNT').'</span></td>';
	echo '<td><span
class="ph-small">'.JText::_('MOD_PHOCACART_CART_PRICE').'</span></td>';
	echo '</tr>';*/

	// echo '<tr>';
	// echo '<td colspan="'.$c2.'"
class="ph-small">'.
count($d['fullitems']).'
'.JText::_('COM_PHOCACART_ITEM_S').'</td>';
	// echo '<td class="ph-small ph-right">';
	if (isset($d['countitems'])) {
		echo '<div class="'.$r.'">';
		echo '<div class="'.$cT.'
ph-small">'. $d['countitems'].'
'.JText::_('COM_PHOCACART_ITEM_S').'</div>';
		echo '<div class="'.$cP.' ph-small
ph-right">';
	}

	if (isset($d['total']['brutto'])) {
		echo
$price->getPriceFormat($d['total']['brutto']);
	}

	// echo '</td>';
	//echo '</tr>';
	echo '</div>';
	echo '</div>';// end row


	//echo '<tr><td
colspan="'.$c3.'"><div
class="ph-hr"></div></td></tr>';
	echo '<div class="'.$r.'">';
	echo '<div class="'.$cA.'"><div
class="ph-hr"></div></div>';
	echo '</div>';// end row

	foreach($d['fullitems'][1] as $k => $v) {

		$link = PhocacartRoute::getItemRoute((int)$v['id'],
(int)$v['catid'], $v['alias']);
		if ($v['netto']) {
			$priceItem = (int)$v['quantity'] * $v['netto'];
		} else {
			$priceItem = (int)$v['quantity'] * $v['brutto'];
		}
		$priceItem = $price->getPriceFormat($priceItem);


		// echo '<tr>';
		echo '<div class="'.$r.'">';
		// Display image next to product title
		if (isset($d['paramsmodule']['display_image'])
&& $d['paramsmodule']['display_image'] == 1) {
			if (isset($v['image']) && $v['image'] !=
'') {


				if (empty($v['attributes'])){ $v['attributes'] =
array();}
				$image = PhocacartImage::getImageDisplay($v['image'],
'', $d['pathitem'], '', '',
'', 'small', '', $v['attributes'],
2);


				if (isset($image['image']->rel)) {
					echo '<div class="'.$cI.' ph-small
ph-mod-cart-image">';

                    $d2								= array();
                    $d2['s']                        =
$d['s'];
                    $d2['t']['display_webp_images']	=
$p['display_webp_images'];
                    $d2['src']						=
JURI::base(true).'/'.$image['image']->rel;
                    $d2['srcset-webp']				=
JURI::base(true).'/'.$image['image']->rel_webp;
                    $d2['alt-value']				=
PhocaCartImage::getAltTitle($v['title'],
$image['image']->rel);
                    $d2['class']					=
PhocacartRenderFront::completeClass(array($d['s']['c']['img-responsive'],
'ph-img-cart-cart'));

                    echo $layoutI->render($d2);


					echo '</div>';
				}


			}
		}

		//- echo '<td class="ph-small
ph-cart-small-quantity">'.$v['quantity'].'x
</td>';
		//- echo '<td class="ph-small
ph-cart-small-title">';
		//- echo '<a
href="'.$link.'">'.$v['title'].'</a>';
		//- echo '</td>';

		//- echo '<td class="ph-small ph-cart-small-price
ph-right">'.$priceItem.'</td>';
		//- echo '</tr>';

		echo '<div class="'.$cX.' ph-small
ph-cart-small-quantity">'.$v['quantity'].'x
</div>';
		echo '<div class="'.$cXT.' ph-small
ph-cart-small-title">';

		// No link in admin
		if ($d['client'] == 1) {
			echo $v['title'];
		} else {
			echo '<a
href="'.$link.'">'.$v['title'].'</a>';
		}

		echo '</div>';

		echo '<div class="'.$cXP.' ph-small
ph-cart-small-price
ph-right">'.$priceItem.'</div>';
		echo '</div>';// end row



		if (!empty($v['attributes'])) {
			//- echo '<tr>';
			//- echo '<td
colspan="'.$c3.'"><ul>';
			echo '<div class="'.$r.'">';
			echo '<div class="'.$cA.'"><ul
class="ph-cart-attribute-box'.$cS.'">';

			foreach($v['attributes'] as $k2 => $v2) {

				if (!empty($v2)) {
					foreach($v2 as $k3 => $v3) {
						echo '<li
class="ph-cart-attribute-item'.$cS.'"><span
class="ph-small
ph-cart-small-attribute">'.$v3['atitle'] . '
'.$v3['otitle'].'</span>';

						if (isset($v3['ovalue']) &&
urldecode($v3['ovalue']) != '') {
							echo ': <span class="ph-small
ph-cart-small-attribute">'.htmlspecialchars(urldecode($v3['ovalue']),
ENT_QUOTES, 'UTF-8').'</span>';
						}
						echo '</li>';
					}
				}

			}

			//- echo '</ul></td>';
			//- echo '</tr>';
			echo '</ul></div>';
			echo '</div>';// end row


		}
	}

	//- echo '<tr><td
colspan="'.$c3.'"><div
class="ph-hr"></div></td></tr>';
	echo '<div class="'.$r.'">';
	echo '<div class="'.$cA.'"><div
class="ph-hr"></div></div>';
	echo '</div>';// end row


	// SUBTOTAL NETTO
	if ($d['total'][1]['netto'] !== 0) {
		//- echo '<tr>';
		//- echo '<td colspan="'.$c2.'"
class="ph-small">'.JText::_('COM_PHOCACART_SUBTOTAL').'</td>';
		//- echo '<td class="ph-small
ph-right">'.$price->getPriceFormat($d['total']['netto']).'</td>';
		//- echo '</tr>';
		echo '<div class="'.$r.'">';
		echo '<div class="'.$cT.' ph-small
ph-cart-subtotal-netto-txt">'.JText::_('COM_PHOCACART_SUBTOTAL').'</div>';
		echo '<div class="'.$cP.' ph-small ph-right
ph-cart-subtotal-netto">'.$price->getPriceFormat($d['total'][1]['netto']).'</div>';
		echo '</div>';// end row
	}

	// REWARD DISCOUNT
	if ($d['total'][5]['dnetto']) {
		echo '<div class="'.$r.'">';
		echo '<div class="'.$cT.' ph-small
ph-cart-reward-discount-txt">'.JText::_('COM_PHOCACART_REWARD_POINTS').$d['total'][5]['rewardproducttxtsuffix'].'</div>';
		echo '<div class="'.$cP.' ph-small ph-right
ph-cart-reward-discount">'.$price->getPriceFormat($d['total'][5]['dnetto'],
1).'</div>';
		echo '</div>';// end row
	}

	// PRODUCT DISCOUNT
	if ($d['total'][2]['dnetto']) {
		echo '<div class="'.$r.'">';
		echo '<div class="'.$cT.' ph-small
ph-cart-product-discount-txt">'.JText::_('COM_PHOCACART_PRODUCT_DISCOUNT').'</div>';
		echo '<div class="'.$cP.' ph-small ph-right
ph-cart-product-discount">'.$price->getPriceFormat($d['total'][2]['dnetto'],
1).'</div>';
		echo '</div>';// end row
	}

	// CART DISCOUNT
	if ($d['total'][3]['dnetto']) {
		echo '<div class="'.$r.'">';
		echo '<div class="'.$cT.' ph-small
ph-cart-cart-discount-txt">'.JText::_('COM_PHOCACART_CART_DISCOUNT').$d['total'][3]['discountcarttxtsuffix'].'</div>';
		echo '<div class="'.$cP.' ph-small ph-right
ph-cart-cart-discount">'.$price->getPriceFormat($d['total'][3]['dnetto'],
1).'</div>';
		echo '</div>';// end row
	}

	// COUPON
	if ($d['total'][4]['dnetto'] &&
$d['couponvalid']) {
		$couponTitle = JText::_('COM_PHOCACART_COUPON');
		if (isset($d['coupontitle']) &&
$d['coupontitle'] != '') {
			$couponTitle = $d['coupontitle'];
		}
		echo '<div class="'.$r.'">';
		echo '<div class="'.$cT.' ph-small
ph-cart-coupon-txt">'.$couponTitle.$d['total'][4]['couponcarttxtsuffix'].'</div>';
		echo '<div class="'.$cP.' ph-small ph-right
ph-cart-coupon">'.$price->getPriceFormat($d['total'][4]['dnetto'],
1).'</div>';
		echo '</div>';// end row
	}



	// TAX
	if (!empty($d['total'][0]['tax'])) {
		foreach($d['total'][0]['tax'] as $k3 => $v3) {
			if($v3['tax'] > 0) {

				echo '<div class="'.$r.'">';
				echo '<div class="'.$cT.' ph-small
ph-cart-tax-txt">'.$v3['title'].'</div>';
				echo '<div class="'.$cP.' ph-small ph-right
ph-cart-tax">'.$price->getPriceFormat($v3['tax']).'</div>';
				echo '</div>';// end row
			}
		}
	}




	//SHIPPING
	// Add Shipping costs if there are some
	if (!empty($d['shippingcosts'])) {
		$sC = $d['shippingcosts'];

		if ($p['zero_shipping_price_calculation'] == -1 &&
$sC['zero'] == 1) {
			// Hide completely
		} else 	if ($p['zero_shipping_price_calculation'] == 0
&& $sC['zero'] == 1) {
			// Display blank price field
			echo '<div class="'.$r.'">';
			echo '<div class="'.$cT.' ph-small
ph-cart-shipping-txt">'.$sC['title'].'</div>';
			echo '<div class="'.$cP.' ph-small ph-right
ph-cart-shipping"></div>';
			echo '</div>';// end row

		} else if ($p['zero_shipping_price_calculation'] == 2
&& $sC['zero'] == 1) {
			// Display free text
			echo '<div class="'.$r.'">';
			echo '<div class="'.$cT.' ph-small
ph-cart-shipping-txt">'.$sC['title'].'</div>';
			echo '<div class="'.$cP.' ph-small ph-right
ph-cart-shipping">'.JText::_('COM_PHOCACART_FREE').'</div>';
			echo '</div>';// end row
		} else {

			if ($sC['title'] != '') {
				$sC['title'] = $sC['title']. ' - ';
			}
			if (isset($sC['nettoformat']) &&
$sC['nettoformat'] != '' &&
isset($sC['nettotxt']) && $sC['nettotxt'] !=
'') {
				echo '<div class="'.$r.'">';
				echo '<div class="'.$cT.' ph-small
ph-cart-shipping-netto-txt">'.$sC['title'].$sC['nettotxt'].'</div>';
				echo '<div class="'.$cP.' ph-small ph-right
ph-cart-shipping-netto">'.$sC['nettoformat'].'</div>';
				echo '</div>';// end row
			}

			if (isset($sC['taxformat']) &&
$sC['taxformat'] != '' &&
isset($sC['taxtxt']) && $sC['taxtxt'] !=
'') {
				echo '<div class="'.$r.'">';
				echo '<div class="'.$cT.' ph-small
ph-cart-shipping-tax-txt">'.$sC['title'].$sC['taxtxt'].'</div>';
				echo '<div class="'.$cP.' ph-small ph-right
ph-cart-shipping-tax">'.$sC['taxformat'].'</div>';
				echo '</div>';// end row
			}

			if ((isset($sC['bruttoformat']) &&
$sC['bruttoformat'] != '' &&
isset($sC['bruttotxt']) && $sC['bruttotxt'] !=
'') || $sC['freeshipping'] == 1) {
				echo '<div class="'.$r.'">';
				echo '<div class="'.$cT.' ph-small
ph-cart-shipping-brutto-txt">'.$sC['title'].$sC['bruttotxt'].'</div>';
				echo '<div class="'.$cP.' ph-small ph-right
ph-cart-shipping-brutto">'.$sC['bruttoformat'].'</div>';
				echo '</div>';// end row
			}
		}
	}

	// PAYMENT

	// Add Payment costs if there are some
	if (!empty($d['paymentcosts'])) {
		$pC = $d['paymentcosts'];

		if ($p['zero_payment_price_calculation'] == -1 &&
$pC['zero'] == 1) {
			// Hide completely
		} else 	if ($p['zero_payment_price_calculation'] == 0
&& $pC['zero'] == 1) {
			// Display blank price field
			echo '<div class="'.$r.'">';
			echo '<div class="'.$cT.' ph-small
ph-cart-payment-txt">'.$pC['title'].'</div>';
			echo '<div class="'.$cP.' ph-small ph-right
ph-cart-payment"></div>';
			echo '</div>';// end row

		} else if ($p['zero_payment_price_calculation'] == 2 &&
$pC['zero'] == 1) {
			// Display free text
			echo '<div class="'.$r.'">';
			echo '<div class="'.$cT.' ph-small
ph-cart-payment-txt">'.$pC['title'].'</div>';
			echo '<div class="'.$cP.' ph-small ph-right
ph-cart-payment">'.JText::_('COM_PHOCACART_FREE').'</div>';
			echo '</div>';// end row
		} else {

			if ($pC['nettotxt'] != '') {
				$pC['title'] = $pC['title']. ' - ';
			}

			if (isset($pC['nettoformat']) &&
$pC['nettoformat'] != '' &&
isset($pC['nettotxt']) && $pC['nettotxt'] !=
'') {

				echo '<div class="'.$r.'">';
				echo '<div class="'.$cT.' ph-small
ph-cart-payment-netto-txt">'.$pC['title'].
$pC['nettotxt'].'</div>';
				echo '<div class="'.$cP.' ph-small ph-right
ph-cart-payment-netto">'.$pC['nettoformat'].'</div>';
				echo '</div>';// end row
			}

			if (isset($pC['taxformat']) &&
$pC['taxformat'] != '' &&
isset($pC['taxtxt']) && $pC['taxtxt'] !=
'') {

				echo '<div class="'.$r.'">';
				echo '<div class="'.$cT.' ph-small
ph-cart-payment-tax-txt">'.$pC['title'].
$pC['taxtxt'].'</div>';
				echo '<div class="'.$cP.' ph-small ph-right
ph-cart-payment-tax">'.$pC['taxformat'].'</div>';
				echo '</div>';// end row
			}

			if ((isset($pC['bruttoformat']) &&
$pC['bruttoformat'] != '' &&
isset($pC['bruttotxt']) && $pC['bruttotxt'] !=
'') || $pC['freepayment'] == 1) {

				echo '<div class="'.$r.'">';
				echo '<div class="'.$cT.' ph-small
ph-cart-payment-brutto-txt">'.$pC['title'].
$pC['bruttotxt'].'</div>';
				echo '<div class="'.$cP.' ph-small ph-right
ph-cart-payment-brutto">'.$pC['bruttoformat'].'</div>';
				echo '</div>';// end row
			}
		}

		//-
/*
		if (isset($pC['nettoformat']) &&
$pC['nettoformat'] != '' &&
isset($pC['nettotxt']) && $pC['nettotxt'] !=
'') {
			//- echo '<tr>';
			//- echo '<td colspan="'.$c2.'"
class="ph-small">'.$pC['nettotxt'].'</td>';
			//- echo '<td class="ph-small
ph-right">'.$pC['nettoformat'].'</td>';
			//- echo '</tr>';
			echo '<div class="'.$r.'">';
			echo '<div class="'.$cT.' ph-small
ph-cart-netto-txt">'.$pC['nettotxt'].'</div>';
			echo '<div class="'.$cP.' ph-small ph-right
ph-cart-netto">'.$pC['nettoformat'].'</div>';
			echo '</div>';// end row
		}

		if (isset($pC['taxformat']) &&
$pC['taxformat'] != '' &&
isset($pC['taxtxt']) && $pC['taxtxt'] !=
'') {
			//- echo '<tr>';
			//- echo '<td colspan="'.$c2.'"
class="ph-small">'.$pC['taxtxt'].'</td>';
			//- echo '<td class="ph-small
ph-right">'.$pC['taxformat'].'</td>';
			//- echo '</tr>';
			echo '<div class="'.$r.'">';
			echo '<div class="'.$cT.' ph-small
ph-cart-tax-txt">'.$pC['taxtxt'].'</div>';
			echo '<div class="'.$cP.' ph-small ph-right
ph-cart-tax">'.$pC['taxformat'].'</div>';
			echo '</div>';// end row
		}

		if ((isset($pC['bruttoformat']) &&
$pC['bruttoformat'] != '' &&
isset($pC['bruttotxt']) && $pC['bruttotxt'] !=
'') || $pC['freepayment'] == 1) {
			//- echo '<tr>';
			//- echo '<td colspan="'.$c2.'"
class="ph-small">'.$pC['bruttotxt'].'</td>';
			//- echo '<td class="ph-small
ph-right">'.$pC['bruttoformat'].'</td>';
			//- echo '</tr>';
			echo '<div class="'.$r.'">';
			echo '<div class="'.$cT.' ph-small
ph-cart-brutto-txt">'.$pC['bruttotxt'].'</div>';
			echo '<div class="'.$cP.' ph-small ph-right
ph-cart-brutto">'.$pC['bruttoformat'].'</div>';
			echo '</div>';// end row
		}
		*/
		//-
	}

	// ROUNDING | ROUNDING CURRENCY
	if ($d['total'][0]['rounding_currency'] != 0) {
		echo '<div class="'.$r.'">';
		echo '<div class="'.$cT.' ph-small
ph-cart-rounding-currency-txt">'.JText::_('COM_PHOCACART_ROUNDING_CURRENCY').'</div>';
		echo '<div class="'.$cP.' ph-small ph-right
ph-cart-rounding-currency">'.$price->getPriceFormat($d['total'][0]['rounding_currency'],
0, 1).'</div>';
		echo '</div>';// end row
	} else if ($d['total'][0]['rounding'] != 0) {
		echo '<div class="'.$r.'">';
		echo '<div class="'.$cT.' ph-small
ph-cart-rounding-txt">'.JText::_('COM_PHOCACART_ROUNDING').'</div>';
		echo '<div class="'.$cP.' ph-small ph-right
ph-cart-rounding">'.$price->getPriceFormat($d['total'][0]['rounding']).'</div>';
		echo '</div>';// end row
	}


	// BRUTTO (Because of rounding currency we need to display brutto in
currency which is set)
	//if
(!($price->roundPrice($d['total'][0]['brutto_currency'])
> -0.01 &&
$price->roundPrice($d['total'][0]['brutto_currency']
< 0.01)) == 1) {
	if ($d['total'][0]['brutto_currency'] !== 0) {
		echo '<div class="'.$r.'">';
		echo '<div class="'.$cT.' ph-small
ph-cart-brutto-currency-txt">'.JText::_('COM_PHOCACART_TOTAL').'</div>';
		echo '<div class="'.$cP.' ph-small ph-right ph-b
ph-cart-brutton-currency">'.$price->getPriceFormat($d['total'][0]['brutto_currency'],
0, 1).'</div>';
		echo '</div>';// end row
	//} else if
(!($price->roundPrice($d['total'][0]['brutto']) >
-0.01 &&
$price->roundPrice($d['total'][0]['brutto'] <
0.01)) == 1) {
	} else if ($d['total'][0]['brutto'] !== 0 ||
($d['total'][0]['brutto'] === 0 &&
$p['display_zero_total'] == 1)) {
		echo '<div class="'.$r.'">';
		echo '<div class="'.$cT.' ph-small
ph-cart-total-txt">'.JText::_('COM_PHOCACART_TOTAL').'</div>';
		echo '<div class="'.$cP.' ph-small ph-right ph-b
ph-cart-total">'.$price->getPriceFormat($d['total'][0]['brutto']).'</div>';
		echo '</div>';// end row
	}



	//- echo '</table>'. "\n";
	// echo '</div>'; // end container
	echo '</div>'. "\n"; // end small box

} else {
	echo
'<div>'.JText::_('COM_PHOCACART_SHOPPING_CART_IS_EMPTY').'</div>';
}

if ($app->getName() != 'administrator') {


	$linkCheckout		= JRoute::_(PhocacartRoute::getCheckoutRoute());
	$linkCheckoutHtml	= '<div class="ph-small ph-right ph-u
ph-cart-link-checkout"><a
href="'.$linkCheckout.'">'.JText::_('COM_PHOCACART_VIEW_CART_CHECKOUT').'</a></div>';

	if (isset($d['paramsmodule']['display_checkout_link'])
&& $d['paramsmodule']['display_checkout_link']
== 1) {
		echo $linkCheckoutHtml;
	} else if
(isset($d['paramsmodule']['display_checkout_link'])
&& $d['paramsmodule']['display_checkout_link']
== 2 && !empty($d['fullitems'])) {
		echo $linkCheckoutHtml;
	}
}
?>
layouts/cart_checkout.php000064400000101760151167552070011611
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

$layoutI	= new JLayoutFile('image', null,
array('component' => 'com_phocacart'));

$app 		= JFactory::getApplication();
$d 			= $displayData;
$price		= new PhocacartPrice();
$msgSuffix	= '<span id="ph-msg-ns"
class="ph-hidden"></span>';

$p['tax_calculation']					= $d['params']->get(
'tax_calculation', 0 );
$p['stock_checkout']					= $d['params']->get(
'stock_checkout', 0 );
$p['stock_checking']					= $d['params']->get(
'stock_checking', 0 );
$p['display_discount_product']			=
$d['params']->get( 'display_discount_product', 1 );
$p['display_discount_price_product']	=
$d['params']->get( 'display_discount_price_product',
1 );
$p['zero_shipping_price_calculation']	=
$d['params']->get(
'zero_shipping_price_calculation', 0 );
$p['zero_payment_price_calculation']	=
$d['params']->get( 'zero_payment_price_calculation',
0 );
$p['display_reward_points_receive_info']=
$d['params']->get(
'display_reward_points_receive_info', 0 );
$p['display_webp_images']				= $d['params']->get(
'display_webp_images', 0 );
$p['display_zero_total']			    = $d['params']->get(
'display_zero_total', 0 );


//$p['min_quantity_calculation']	=
$d['params']->get( 'min_quantity_calculation', 0 );
set in product xml - product options, not in global

// POS
$task 			= $d['pos'] == true ? 'pos.update' :
'checkout.update';
$inputNumber	= $d['pos'] == true ? 'number' :
'text';
$displayTax		= true;// Specific settings for POS - to make smaller widht of
cart

// A) MINIMUM QUANTITY FOR GROUPS - MAIN PRODUCT
if (!empty($d['fullitemsgroup'][0])) {
	foreach($d['fullitemsgroup'][0] as $k => $v) {

		if (isset($v['minqtyvalid']) &&
$v['minqtyvalid'] == 0) {
			echo '<div class="alert
alert-error">'.JText::_('COM_PHOCACART_MINIMUM_ORDER_QUANTITY_FOR_PRODUCT').
' '.$v['title']. '
'.JText::_('COM_PHOCACART_IS').':
'.$v['minqty']. $msgSuffix .'</div>';

		}

		if (isset($v['minmultipleqtyvalid']) &&
$v['minmultipleqtyvalid'] == 0) {
			echo '<div class="alert
alert-error">'.JText::_('COM_PHOCACART_MINIMUM_MULTIPLE_ORDER_QUANTITY_FOR_PRODUCT').
' '.$v['title']. '
'.JText::_('COM_PHOCACART_IS').':
'.$v['minmultipleqty']. $msgSuffix
.'</div>';

		}
	}
}

if (!empty($d['fullitems'][1])) {

	$r		= $d['s']['c']['row'];
	$cA 	= $d['s']['c']['col.xs12.sm12.md12'];//
whole row
	$cI 	= $d['s']['c']['col.xs2.sm2.md2'];//
image
	$cQ		= $d['s']['c']['col.xs2.sm2.md2'];//
quantity
	$cN 	= $d['s']['c']['col.xs2.sm2.md2'];//
netto
	$cT 	= $d['s']['c']['col.xs2.sm2.md2'];//
tax
	$cB 	= $d['s']['c']['col.xs2.sm2.md2'];//
brutto
	$cV		= ' ph-vertical-align';
	$cVRow	= ' ph-vertical-align-row';
	$cAT	= $d['s']['c']['col.xs10.sm10.md10'];//
attributes

	// Total summarization
	$cTotE = $d['s']['c']['col.xs0.sm6.md6']; //
empty space
	$cTotT = $d['s']['c']['col.xs8.sm4.md4']; //
title
	$cTotB = $d['s']['c']['col.xs4.sm2.md2']; //
price
	if ((int)$p['tax_calculation'] > 0) {
		$cP 	= $d['s']['c']['col.xs2.sm2.md2'];//
title - 4 (Tax, Netto)
	} else {
		$cP 	= $d['s']['c']['col.xs6.sm6.md6'];//
title + 4 (Tax, Netto)
	}

	if ($d['pos']) {

		// HIDE TAX for POS
		$displayTax = false;

		$cI 	= $d['s']['c']['col.xs0.sm0.md0'];//
image (display: none in css)
		//$cQ		= 'col-sm-3 col-md-3 col-xs-3';// quantity
		if ((int)$p['tax_calculation'] > 0 && $displayTax)
{
			$cP 	= $d['s']['c']['col.xs2.sm2.md2'];//
- 4 (Tax, Netto)
		} else {
			$cP 	= $d['s']['c']['col.xs6.sm6.md6'];//
+ 4 (Tax, Netto)
		}
		$cQ		=
$d['s']['c']['col.xs3.sm3.md3'].'
ph-pd-zero';// quantity
		$cN 	= $d['s']['c']['col.xs3.sm3.md3'];//
netto
		$cT 	= $d['s']['c']['col.xs3.sm3.md3'];//
tax
		$cB 	= $d['s']['c']['col.xs3.sm3.md3'];//
brutto

		$cAT	=
$d['s']['c']['col.xs12.sm12.md12'];//
attributes

		// Total summarization
		$cTotE = $d['s']['c']['col.xs0.sm0.md0'];
// empty space
		$cTotT = $d['s']['c']['col.xs8.sm8.md8'];
// title
		$cTotB = $d['s']['c']['col.xs4.sm4.md4'];
// price

		$cV		= '';
		$cVRow	= '';



	}


	echo '<div class="ph-checkout-cart-box">';


	// HEADER
	echo '<div class="'.$r.'">';
	echo '<div class="'.$cI.'
ph-checkout-cart-image">'.JText::_('COM_PHOCACART_IMAGE').'</div>';
	echo '<div class="'.$cP.'
ph-checkout-cart-product">'.JText::_('COM_PHOCACART_PRODUCT').'</div>';

	if ((int)$p['tax_calculation'] > 0 && $displayTax) {
		echo '<div class="'.$cN.'
ph-checkout-cart-netto">'.JText::_('COM_PHOCACART_PRICE_EXCL_TAX').'</div>';
	}

	echo '<div class="'.$cQ.'
ph-checkout-cart-quantity">'.JText::_('COM_PHOCACART_QUANTITY').'</div>';

	if ((int)$p['tax_calculation'] > 0 && $displayTax) {
		echo '<div class="'.$cT.'
ph-checkout-cart-tax">'.JText::_('COM_PHOCACART_TAX').'</div>';
	}

	echo '<div class="'.$cB.'
ph-checkout-cart-brutto">'.JText::_('COM_PHOCACART_PRICE').'</div>';
	echo '</div>'. "\n"; // end row


	// ROW
	echo '<div class="'.$r.'">';
	echo '<div class="'.$cA.'"><div
class="ph-hr"></div></div>';
	echo '</div>'. "\n"; // end row

	foreach($d['fullitems'][1] as $k => $v) {

		$link 				= PhocacartRoute::getItemRoute((int)$v['id'],
(int)$v['catid'], $v['alias']);

		// Design only
		$lineThroughClass	= '';
		if ($p['display_discount_product'] == 1 &&
($d['fullitems'][2][$k]['discountproduct'] ||
$d['fullitems'][3][$k]['discountcart'] ||
$d['couponvalid'])) {
			$lineThroughClass	= ' ph-line-through';
		}


		if (isset($v['image']) && $v['image'] !=
'') {

			if (empty($v['attributes'])){ $v['attributes'] =
array();}
			$image = PhocacartImage::getImageDisplay($v['image'],
'', $d['pathitem'], '', '',
'', 'small', '', $v['attributes'],
2);

			if (isset($image['image']->rel)) {

				$d2								= array();
				$d2['t']['display_webp_images']	=
$p['display_webp_images'];
				$d2['src']						=
JURI::base(true).'/'.$image['image']->rel;
				$d2['srcset-webp']				=
JURI::base(true).'/'.$image['image']->rel_webp;
				$d2['alt-value']				=
PhocaCartImage::getAltTitle($v['title'],
$image['image']->rel);
				$d2['class']					=
PhocacartRenderFront::completeClass(array($d['s']['c']['img-responsive'],
'ph-img-cart-checkout'));

				$imageOutput = $layoutI->render($d2);
			}
		} else {
			$imageOutput = '<div class="ph-no-image"><span
class="'.$d['s']['i']['ban'].'"</span></div>';
		}

		echo '<div class="'.$r.$cV.'">';
		echo '<div class="'.$cI.$cVRow.'
ph-checkout-cart-image
ph-row-image">'.$imageOutput.'</div>';
		echo '<div class="'.$cP.$cVRow.'
ph-checkout-cart-title"><a
href="'.$link.'">'.$v['title'].'</a>';
		echo '</div>';


		if ((int)$p['tax_calculation'] > 0 && $displayTax)
{
			echo '<div
class="'.$cN.$cVRow.$lineThroughClass.'
ph-checkout-cart-netto">'.$price->getPriceFormat($v['netto']).'</div>';
		}

		echo '<div class="'.$cQ.$cVRow.'
ph-checkout-cart-quantity">';

		echo '<form
action="'.$d['linkcheckout'].'"
class="form-inline phItemCartUpdateBoxForm"
method="post">';
		echo '<div class="form-group">';
		echo '<input type="hidden" name="id"
value="'.(int)$v['id'].'">';
		echo '<input type="hidden" name="catid"
value="'.(int)$v['catid'].'">';
		echo '<input type="hidden" name="idkey"
value="'.$v['idkey'].'">';
		echo '<input type="hidden" name="ticketid"
value="'.(int)$d['ticketid'].'">';
		echo '<input type="hidden" name="unitid"
value="'.(int)$d['unitid'].'">';
		echo '<input type="hidden" name="sectionid"
value="'.(int)$d['sectionid'].'">';
		echo '<input type="'.$inputNumber.'"
class="form-control ph-input-quantity ph-input-sm"
name="quantity"
value="'.$v['quantity'].'">';
		echo '<input type="hidden" name="task"
value="'.$task.'">';
		echo '<input type="hidden" name="tmpl"
value="component" />';
		echo '<input type="hidden" name="option"
value="com_phocacart" />';
		echo '<input type="hidden" name="return"
value="'.$d['actionbase64'].'" />';
		//UPDATE
		echo ' <button
class="'.$d['s']['c']['btn.btn-success.btn-sm'].'
ph-btn" type="submit" name="action"
value="update"><span
title="'.JText::_('COM_PHOCACART_UPDATE_QUANTITY_IN_CART').'"
class="'.$d['s']['i']['refresh'].'"></span></button>';
		//DELETE
		echo ' <button
class="'.$d['s']['c']['btn.btn-danger.btn-sm'].'
ph-btn" type="submit" name="action"
value="delete"><span
title="'.JText::_('COM_PHOCACART_REMOVE_PRODUCT_FROM_CART').'"
class="'.$d['s']['i']['trash'].'"></span></button>';
		echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
		echo '</div>';
		echo '</form>';


		echo '</div>';// end quantity

		if ((int)$p['tax_calculation'] > 0 && $displayTax)
{
			echo '<div
class="'.$cT.$cVRow.$lineThroughClass.'
ph-checkout-cart-tax">'.$price->getPriceFormat($v['tax']
* $v['quantity']).'</div>';
		}

		echo '<div class="'.$cB.$cVRow.$lineThroughClass.'
ph-checkout-cart-brutto">'.$price->getPriceFormat($v['final']).'</div>';
		echo '</div>'. "\n"; // end row


		// ATTRIBUTES
		if (!empty($v['attributes'])) {

			echo '<div class="'.$r.'">';
			echo '<div
class="'.$cI.'"></div>';
			echo '<div class="'.$cAT.'">';
			echo '<ul
class="ph-checkout-attribute-box">';
			foreach($v['attributes'] as $k2 => $v2) {
				if (!empty($v2)) {
					foreach($v2 as $k3 => $v3) {
						echo '<li
class="ph-checkout-attribute-item"><span
class="ph-small
ph-cart-small-attribute">'.$v3['atitle'] . '
'.$v3['otitle'].'</span>';
						if (isset($v3['ovalue']) &&
urldecode($v3['ovalue']) != '') {
							echo ': <span class="ph-small
ph-cart-small-attribute">'.htmlspecialchars(urldecode($v3['ovalue']),
ENT_QUOTES, 'UTF-8').'</span>';
						}
						echo '</li>';
					}
				}
			}
			echo '</ul>';
			echo '</div>';
			echo '</div>'. "\n"; // end row
		}


		// DISCOUNT price for each product

		if ($p['display_discount_product'] == 1) {




			// REWARD DISCOUNT
			if($d['fullitems'][5][$k]['rewardproduct']
&& $p['display_discount_price_product'] > 0) {

				$discountTitle =
JText::_('COM_PHOCACART_REWARD_POINTS_PRICE');
				if
(isset($d['fullitems'][5][$k]['rewardproducttitle'])
&& $d['fullitems'][5][$k]['rewardproducttitle']
!= '') {
					$discountTitle =
$d['fullitems'][5][$k]['rewardproducttitle'];
				}

				$rewardNetto 	=
$price->getPriceFormat($d['fullitems'][5][$k]['netto']);
				$rewardTax 		=
$price->getPriceFormat($d['fullitems'][5][$k]['tax']
* $v['quantity']);
				$rewardFinal 	=
$price->getPriceFormat($d['fullitems'][5][$k]['final']);


				if ($p['display_discount_price_product'] == 2 &&
isset($d['fullitems'][5][$k]['finaldiscount'])) {
					$rewardNetto 	=
$price->getPriceFormat($d['fullitems'][5][$k]['nettodiscount'],
1);
					$rewardTax 		=
$price->getPriceFormat($d['fullitems'][5][$k]['taxdiscount']
* $v['quantity'], 1);
					$rewardFinal 	=
$price->getPriceFormat($d['fullitems'][5][$k]['finaldiscount'],
1);
				}

				echo '<div class="'.$r.$cV.'
ph-checkout-discount-row">';
				echo '<div
class="'.$cI.$cVRow.'"></div>';
				echo '<div class="'.$cP.$cVRow.'
ph-checkout-cart-title">'.$discountTitle.'
'.$d['fullitems'][5][$k]['rewardproducttxtsuffix'].'</div>';
				if ((int)$p['tax_calculation'] > 0 && $displayTax)
{
					echo '<div class="'.$cN.$cVRow.'
ph-checkout-cart-netto">'.$rewardNetto.'</div>';
				}
				echo '<div class="'.$cQ.$cVRow.'
ph-checkout-cart-quantity"></div>';
				if ((int)$p['tax_calculation'] > 0 && $displayTax)
{
					echo '<div class="'.$cT.$cVRow.'
ph-checkout-cart-tax">'.$rewardTax.'</div>';
				}
				echo '<div class="'.$cB.$cVRow.'
ph-checkout-cart-brutto">'.$rewardFinal.'</div>';
				echo '</div>'. "\n"; // end row
			}

			// PRODUCT DISCOUNT

			if($d['fullitems'][2][$k]['discountproduct']
&& (($p['display_discount_price_product'] == 1 &&
$d['fullitems'][2][$k]['netto'] > 0) ||
$p['display_discount_price_product'] == 2)) {

				$discountTitle =
JText::_('COM_PHOCACART_PRODUCT_DISCOUNT_PRICE');
				if
(isset($d['fullitems'][2][$k]['discountproducttitle'])
&&
$d['fullitems'][2][$k]['discountproducttitle'] !=
'') {
					$discountTitle =
$d['fullitems'][2][$k]['discountproducttitle'];
				}

				$productNetto 	=
$price->getPriceFormat($d['fullitems'][2][$k]['netto']);
				$productTax 	=
$price->getPriceFormat($d['fullitems'][2][$k]['tax']
* $v['quantity']);
				$productFinal 	=
$price->getPriceFormat($d['fullitems'][2][$k]['final']);


				if ($p['display_discount_price_product'] == 2 &&
isset($d['fullitems'][2][$k]['finaldiscount'])) {
					$productNetto 	=
$price->getPriceFormat($d['fullitems'][2][$k]['nettodiscount'],
1);
					$productTax 	=
$price->getPriceFormat($d['fullitems'][2][$k]['taxdiscount']
* $v['quantity'], 1);
					$productFinal 	=
$price->getPriceFormat($d['fullitems'][2][$k]['finaldiscount'],
1);
				}

				echo '<div class="'.$r.$cV.'
ph-checkout-discount-row">';
				echo '<div
class="'.$cI.$cVRow.'"></div>';
				echo '<div class="'.$cP.$cVRow.'
ph-checkout-cart-title">'.$discountTitle.'</div>';
				if ((int)$p['tax_calculation'] > 0 && $displayTax)
{
					echo '<div class="'.$cN.$cVRow.'
ph-checkout-cart-netto">'.$productNetto.'</div>';
				}
				echo '<div class="'.$cQ.$cVRow.'
ph-checkout-cart-quantity"></div>';
				if ((int)$p['tax_calculation'] > 0 && $displayTax)
{
					echo '<div class="'.$cT.$cVRow.'
ph-checkout-cart-tax">'.$productTax.'</div>';
				}
				echo '<div class="'.$cB.$cVRow.'
ph-checkout-cart-brutto">'.$productFinal.'</div>';
				echo '</div>'. "\n"; // end row
			}

			// CART DISCOUNT

			if($d['fullitems'][3][$k]['discountcart'] &&
(($p['display_discount_price_product'] == 1 &&
$d['fullitems'][3][$k]['netto'] > 0) ||
$p['display_discount_price_product'] == 1)) {

				$discountTitle =
JText::_('COM_PHOCACART_CART_DISCOUNT_PRICE');
				if
(isset($d['fullitems'][3][$k]['discountcarttitle'])
&& $d['fullitems'][3][$k]['discountcarttitle']
!= '') {
					$discountTitle =
$d['fullitems'][3][$k]['discountcarttitle'];
				}

				$cartNetto 	=
$price->getPriceFormat($d['fullitems'][3][$k]['netto']);
				$cartTax 	=
$price->getPriceFormat($d['fullitems'][3][$k]['tax']
* $v['quantity']);
				$cartFinal 	=
$price->getPriceFormat($d['fullitems'][3][$k]['final']);

				if ($p['display_discount_price_product'] == 2 &&
isset($d['fullitems'][3][$k]['finaldiscount'])) {
					$cartNetto 	=
$price->getPriceFormat($d['fullitems'][3][$k]['nettodiscount'],
1);
					$cartTax 	=
$price->getPriceFormat($d['fullitems'][3][$k]['taxdiscount']
* $v['quantity'], 1);
					$cartFinal 	=
$price->getPriceFormat($d['fullitems'][3][$k]['finaldiscount'],
1);
				}

				echo '<div class="'.$r.$cV.'
ph-checkout-discount-row">';
				echo '<div
class="'.$cI.$cVRow.'"></div>';
				echo '<div class="'.$cP.$cVRow.'
ph-checkout-cart-title">'.$discountTitle.'</div>';
				if ((int)$p['tax_calculation'] > 0 && $displayTax)
{
					echo '<div class="'.$cN.$cVRow.'
ph-checkout-cart-netto">'.$cartNetto.'</div>';
				}
				echo '<div class="'.$cQ.$cVRow.'
ph-checkout-cart-quantity"></div>';
				if ((int)$p['tax_calculation'] > 0 && $displayTax)
{
					echo '<div class="'.$cT.$cVRow.'
ph-checkout-cart-tax">'.$cartTax.'</div>';
				}
				echo '<div class="'.$cB.$cVRow.'
ph-checkout-cart-brutto">'.$cartFinal.'</div>';
				echo '</div>'. "\n"; // end row
			}

			// CART COUPON
			if($d['couponvalid'] &&
$d['fullitems'][4][$k]['couponcart'] &&
$p['display_discount_price_product'] > 0) {

				$couponTitle = JText::_('COM_PHOCACART_COUPON');
				if (isset($d['coupontitle']) &&
$d['coupontitle'] != '') {
					$couponTitle = $d['coupontitle'];
				}

				$couponNetto 	=
$price->getPriceFormat($d['fullitems'][4][$k]['netto']);
				$couponTax 		=
$price->getPriceFormat($d['fullitems'][4][$k]['tax']
* $v['quantity']);
				$couponFinal 	=
$price->getPriceFormat($d['fullitems'][4][$k]['final']);

				if ($p['display_discount_price_product'] == 2 &&
isset($d['fullitems'][4][$k]['finaldiscount'])) {
					$couponNetto 	=
$price->getPriceFormat($d['fullitems'][4][$k]['nettodiscount'],
1);
					$couponTax 		=
$price->getPriceFormat($d['fullitems'][4][$k]['taxdiscount']
* $v['quantity'], 1);
					$couponFinal 	=
$price->getPriceFormat($d['fullitems'][4][$k]['finaldiscount'],
1);
				}

				echo '<div class="'.$r.$cV.'
ph-checkout-discount-row">';
				echo '<div
class="'.$cI.$cVRow.'"></div>';
				echo '<div class="'.$cP.$cVRow.'
ph-checkout-cart-title">'.$couponTitle.'</div>';
				if ((int)$p['tax_calculation'] > 0 && $displayTax)
{
					echo '<div class="'.$cN.$cVRow.'
ph-checkout-cart-netto">'.$couponNetto.'</div>';
				}
				echo '<div class="'.$cQ.$cVRow.'
ph-checkout-cart-quantity"></div>';
				if ((int)$p['tax_calculation'] > 0 && $displayTax)
{
					echo '<div class="'.$cT.$cVRow.'
ph-checkout-cart-tax">'.$couponTax.'</div>';
				}
				echo '<div class="'.$cB.$cVRow.'
ph-checkout-cart-brutto">'.$couponFinal.'</div>';
				echo '</div>'. "\n"; // end row
			}
		}




		// STOCK VALID
		if ($v['stockvalid'] == 0 &&
$p['stock_checkout'] == 1 &&
$p['stock_checking'] == 1) {

			echo '<div class="'.$r.'">';
			echo '<div class="'.$cA.'">';
			echo '<div class="alert alert-error
ph-alert-small">'.JText::_('COM_PHOCACART_PRODUCT_NOT_AVAILABLE_IN_QUANTITY_OR_NOT_IN_STOCK').'</div>';

			echo '</div>';
			echo '</div>'. "\n"; // end row
		}

		// B) MINIMUM QUANTITY - PRODUCT VARIATIONS - EACH PRODUCT VARIATION
		// see cart/calculation class - it is explained why a) method is not
used
		if ($v['minqtyvalid'] == 0 &&
($v['minqtycalculation'] == 1 ||
$v['minqtycalculation'] == 2)) {
			echo '<div class="'.$r.'">';
			echo '<div class="'.$cA.'">';
			echo '<div class="alert alert-error
ph-alert-small">'.JText::_('COM_PHOCACART_MINIMUM_ORDER_QUANTITY_FOR_THIS_PRODUCT_IS').':
'.$v['minqty'].'</div>';
			echo '</div>';
			echo '</div>'. "\n"; // end row
		}

		if ($v['minmultipleqtyvalid'] == 0 &&
($v['minqtycalculation'] == 1 ||
$v['minqtycalculation'] == 2)) {
			echo '<div class="'.$r.'">';
			echo '<div class="'.$cA.'">';
			echo '<div class="alert alert-error
ph-alert-small">'.JText::_('COM_PHOCACART_MINIMUM_MULTIPLE_ORDER_QUANTITY_FOR_PRODUCT').':
'.$v['minmultipleqty'].'</div>';
			echo '</div>';
			echo '</div>'. "\n"; // end row
		}
	}


	// ROW
	echo '<div class="'.$r.'">';
	echo '<div class="'.$cA.'"><div
class="ph-hr"></div></div>';
	echo '</div>'. "\n"; // end row



	// SUBTOTAL NETTO
	if ($d['total'][1]['netto'] !== 0) {

		echo '<div class="'.$r.'
ph-cart-subtotal-box">';
		echo '<div
class="'.$cTotE.'"></div>';
		echo '<div class="'.$cTotT.'
ph-cart-subtotal-netto-txt">'.JText::_('COM_PHOCACART_SUBTOTAL').'</div>';
		echo '<div class="'.$cTotB.' ph-right
ph-cart-subtotal-netto">'.$price->getPriceFormat($d['total'][1]['netto']).'</div>';
		echo '</div>';// end row
	}

	// REWARD DISCOUNT
	if ($d['total'][5]['dnetto']) {
		echo '<div class="'.$r.'
ph-cart-reward-discount-box">';
		echo '<div
class="'.$cTotE.'"></div>';
		echo '<div class="'.$cTotT.'
ph-cart-reward-discount-txt">'.JText::_('COM_PHOCACART_REWARD_POINTS').$d['total'][5]['rewardproducttxtsuffix'].'</div>';
		echo '<div class="'.$cTotB.' ph-right
ph-cart-reward-discount">'.$price->getPriceFormat($d['total'][5]['dnetto'],
1).'</div>';
		echo '</div>';// end row
	}

	// PRODUCT DISCOUNT

	if ($d['total'][2]['dnetto']) {
		echo '<div class="'.$r.'
ph-cart-product-discount-box">';
		echo '<div
class="'.$cTotE.'"></div>';
		echo '<div class="'.$cTotT.'
ph-cart-product-discount-txt">'.JText::_('COM_PHOCACART_PRODUCT_DISCOUNT').'</div>';
		echo '<div class="'.$cTotB.' ph-right
ph-cart-product-discount">'.$price->getPriceFormat($d['total'][2]['dnetto'],
1).'</div>';
		echo '</div>';// end row
	}

	// CART DISCOUNT

	if ($d['total'][3]['dnetto']) {
	    echo '<div class="'.$r.'
ph-cart-discount-box">';
		echo '<div
class="'.$cTotE.'"></div>';
		echo '<div class="'.$cTotT.'
ph-cart-cart-discount-txt">'.JText::_('COM_PHOCACART_CART_DISCOUNT').$d['total'][3]['discountcarttxtsuffix'].'</div>';
		echo '<div class="'.$cTotB.' ph-right
ph-cart-cart-discount">'.$price->getPriceFormat($d['total'][3]['dnetto'],
1).'</div>';
		echo '</div>';// end row
	}

	// COUPON

	if ($d['total'][4]['dnetto'] &&
$d['couponvalid']) {
		$couponTitle = JText::_('COM_PHOCACART_COUPON');
		if (isset($d['coupontitle']) &&
$d['coupontitle'] != '') {
			$couponTitle = $d['coupontitle'];
		}
		echo '<div class="'.$r.'
ph-cart-coupon-box">';
		echo '<div
class="'.$cTotE.'"></div>';
		echo '<div class="'.$cTotT.'
ph-cart-coupon-txt">'.$couponTitle.$d['total'][4]['couponcarttxtsuffix'].'</div>';
		echo '<div class="'.$cTotB.'
ph-checkout-total-coupon ph-right
ph-cart-coupon">'.$price->getPriceFormat($d['total'][4]['dnetto'],
1).'</div>';
		echo '</div>';// end row
	}


	/*
	// SUBTOTAL AFTER DISCOUNTS
	if ($d['total'][0]['wdnetto']) {

		echo '<div class="'.$r.'
ph-cart-subtotal-box">';
		echo '<div
class="'.$cTotE.'"></div>';
		echo '<div class="'.$cTotT.'
ph-cart-subtotal-netto-txt">'.JText::_('COM_PHOCACART_SUBTOTAL_AFTER_DISCOUNTS').'</div>';
		echo '<div class="'.$cTotB.' ph-right
ph-cart-subtotal-netto">'.$price->getPriceFormat($d['total'][0]['wdnetto']).'</div>';
		echo '</div>';// end row
	}
	*/

	// TAX
	if (!empty($d['total'][0]['tax'])) {
		foreach($d['total'][0]['tax'] as $k3 => $v3) {
			if($v3['tax'] !== 0 && $v3['tax'] != 0
&& $p['tax_calculation'] != 0) {
				echo '<div class="'.$r.'
ph-cart-tax-box">';
				echo '<div
class="'.$cTotE.'"></div>';
				echo '<div class="'.$cTotT.'
ph-cart-tax-txt">'.$v3['title'].'</div>';
				echo '<div class="'.$cTotB.'
ph-checkout-total-amount ph-right
ph-cart-tax">'.$price->getPriceFormat($v3['tax']).'</div>';
				echo '</div>';// end row
			}
		}
	}




	// SHIPPING
	// Add Shipping costs if there are some

	if (!empty($d['shippingcosts'])) {
		$sC = $d['shippingcosts'];

		if ($p['zero_shipping_price_calculation'] == -1 &&
$sC['zero'] == 1) {
			// Hide completely
		} else 	if ($p['zero_shipping_price_calculation'] == 0
&& $sC['zero'] == 1) {
			// Display blank price field
			echo '<div class="'.$r.'
ph-cart-shipping-box">';
			echo '<div
class="'.$cTotE.'"></div>';
			echo '<div class="'.$cTotT.'
ph-cart-shipping-txt">'.$sC['title'].'</div>';
			echo '<div class="'.$cTotB.'
ph-checkout-total-amount ph-right
ph-cart-shipping"></div>';
			echo '</div>';// end row
		} else if ($p['zero_shipping_price_calculation'] == 2
&& $sC['zero'] == 1) {
			// Display free text
			echo '<div class="'.$r.'
ph-cart-shipping-box">';
			echo '<div
class="'.$cTotE.'"></div>';
			echo '<div class="'.$cTotT.'
ph-cart-shipping-txt">'.$sC['title'].'</div>';
			echo '<div class="'.$cTotB.'
ph-checkout-total-amount ph-right
ph-cart-shipping">'.JText::_('COM_PHOCACART_FREE').'</div>';
			echo '</div>';// end row
		} else {


			if (isset($sC['nettoformat']) &&
$sC['nettoformat'] != '' &&
isset($sC['nettotxt'])/* && $sC['nettotxt'] !=
'' can be empty */) {
				echo '<div class="'.$r.'
ph-cart-shipping-box">';
				echo '<div
class="'.$cTotE.'"></div>';
				echo '<div class="'.$cTotT.'
ph-cart-shipping-netto-txt">'.$sC['title'].
PhocacartUtils::addSeparator($sC['nettotxt']).'</div>';
				echo '<div class="'.$cTotB.'
ph-checkout-total-amount ph-right
ph-cart-shipping-netto">'.$sC['nettoformat'].'</div>';
				echo '</div>';// end row
			}

			if (isset($sC['taxformat']) &&
$sC['taxformat'] != '' &&
isset($sC['taxtxt'])/* && $sC['taxtxt'] !=
'' can be empty */) {
				echo '<div class="'.$r.'
ph-cart-shipping-box">';
				echo '<div
class="'.$cTotE.'"></div>';
				echo '<div class="'.$cTotT.'
ph-cart-shipping-tax-txt">'.$sC['title'].
PhocacartUtils::addSeparator($sC['taxtxt']).'</div>';
				echo '<div class="'.$cTotB.'
ph-checkout-total-amount ph-right
ph-cart-shipping-tax">'.$sC['taxformat'].'</div>';
				echo '</div>';// end row
			}

			if ((isset($sC['bruttoformat']) &&
$sC['bruttoformat'] != '' &&
isset($sC['bruttotxt']) /* && $sC['bruttotxt']
!= '' - can be empty */) || $sC['freeshipping'] == 1)
{

				echo '<div class="'.$r.'
ph-cart-shipping-box">';
				echo '<div
class="'.$cTotE.'"></div>';
				echo '<div class="'.$cTotT.'
ph-cart-shipping-brutto-txt">'.$sC['title'].
PhocacartUtils::addSeparator($sC['bruttotxt']).'</div>';
				echo '<div class="'.$cTotB.'
ph-checkout-total-amount ph-right
ph-cart-shipping-brutto">'.$sC['bruttoformat'].'</div>';
				echo '</div>';// end row
			}
		}
	}

	// PAYMENT
	// Add Payment costs if there are some
	if (!empty($d['paymentcosts'])) {
		$pC = $d['paymentcosts'];


		if ($p['zero_payment_price_calculation'] == -1 &&
$pC['zero'] == 1) {
			// Hide completely
		} else 	if ($p['zero_payment_price_calculation'] == 0
&& $pC['zero'] == 1) {
			// Display blank price field
			echo '<div class="'.$r.'
ph-cart-payment-box">';
			echo '<div
class="'.$cTotE.'"></div>';
			echo '<div class="'.$cTotT.'
ph-cart-payment-txt">'.$pC['title'].'</div>';
			echo '<div class="'.$cTotB.'
ph-checkout-total-amount ph-right
ph-cart-payment"></div>';
			echo '</div>';// end row
		} else if ($p['zero_payment_price_calculation'] == 2 &&
$pC['zero'] == 1) {
			// Display free text
			echo '<div class="'.$r.'
ph-cart-payment-box">';
			echo '<div
class="'.$cTotE.'"></div>';
			echo '<div class="'.$cTotT.'
ph-cart-payment-txt">'.$pC['title'].'</div>';
			echo '<div class="'.$cTotB.'
ph-checkout-total-amount ph-right
ph-cart-payment">'.JText::_('COM_PHOCACART_FREE').'</div>';
			echo '</div>';// end row
		} else {


			if (isset($pC['nettoformat']) &&
$pC['nettoformat'] != '' &&
isset($pC['nettotxt'])/* && $pC['nettotxt'] !=
'' can be empty */) {


				echo '<div class="'.$r.'
ph-cart-payment-box">';
				echo '<div
class="'.$cTotE.'"></div>';
				echo '<div class="'.$cTotT.'
ph-cart-payment-netto-txt">'.$pC['title'].
PhocacartUtils::addSeparator($pC['nettotxt']).'</div>';
				echo '<div class="'.$cTotB.'
ph-checkout-total-amount ph-right
ph-cart-payment-netto">'.$pC['nettoformat'].'</div>';
				echo '</div>';// end row
			}

			if (isset($pC['taxformat']) &&
$pC['taxformat'] != '' &&
isset($pC['taxtxt'])/* && $pC['taxtxt'] !=
'' can be empty */) {
				echo '<div class="'.$r.'
ph-cart-payment-box">';
				echo '<div
class="'.$cTotE.'"></div>';
				echo '<div class="'.$cTotT.'
ph-cart-payment-tax-txt">'.$pC['title'].
PhocacartUtils::addSeparator($pC['taxtxt']).'</div>';
				echo '<div class="'.$cTotB.'
ph-checkout-total-amount ph-right
ph-cart-payment-tax">'.$pC['taxformat'].'</div>';
				echo '</div>';// end row
			}

			if ((isset($pC['bruttoformat']) &&
$pC['bruttoformat'] != '' &&
isset($pC['bruttotxt'])/* && $pC['bruttotxt']
!= '' can be empty */) || $pC['freepayment'] == 1) {

				echo '<div class="'.$r.'
ph-cart-payment-box">';
				echo '<div
class="'.$cTotE.'"></div>';
				echo '<div class="'.$cTotT.'
ph-cart-payment-brutto-txt">'.$pC['title'].
PhocacartUtils::addSeparator($pC['bruttotxt']).'</div>';
				echo '<div class="'.$cTotB.'
ph-checkout-total-amount ph-right
ph-cart-payment-brutto">'.$pC['bruttoformat'].'</div>';
				echo '</div>';// end row
			}
		}
	}

	// Posible feature request
	// Sum all taxes together: Product + Shipping + Payment
	// Different rates will be of course not be added together

	/*
	// SUM OF ALL TAXES ON ONE LINE
	if (!empty($d['total'][0]['tax'])) {
		foreach($d['total'][0]['tax'] as $k3 => $v3) {
			if($v3['tax'] !== 0 && $v3['tax'] != 0
&& $p['tax_calculation'] != 0) {
				$tax = $v3['tax'];
				// Add shipping method taxes to sum of all taxes
				if (isset($sC['taxkey']) && $sC['taxkey']
== $k3) {
					if (isset($sC['tax']) && $sC['tax'] >
0) {
						$tax = $tax + $sC['tax'];
					}

				}
				// Add payment method taxes to sum of all taxes
				if (isset($pC['taxkey']) && $pC['taxkey']
== $k3) {
					if (isset($pC['tax']) && $pC['tax'] >
0) {
						$tax = $tax + $pC['tax'];
					}

				}

				echo '<div class="'.$r.'
ph-cart-tax-box">';
				echo '<div
class="'.$cTotE.'"></div>';
				echo '<div class="'.$cTotT.'
ph-cart-tax-txt">SUM OF ALL TAXES -
'.$v3['title'].'</div>';
				echo '<div class="'.$cTotB.'
ph-checkout-total-amount ph-right
ph-cart-tax">'.$price->getPriceFormat($tax).'</div>';
				echo '</div>';// end row
			}
		}
	}
	*/



	// ROUNDING | ROUNDING CURRENCY

	if ($d['total'][0]['rounding_currency'] !== 0) {

		echo '<div class="'.$r.'
ph-cart-currency-box">';
		echo '<div
class="'.$cTotE.'"></div>';
		echo '<div class="'.$cTotT.'
ph-cart-rounding-currency-txt">'.JText::_('COM_PHOCACART_ROUNDING_CURRENCY').'</div>';
		echo '<div class="'.$cTotB.' ph-right
ph-cart-rounding-currency">'.$price->getPriceFormat($d['total'][0]['rounding_currency'],
0, 1).'</div>';
		echo '</div>';// end row
	} else if ($d['total'][0]['rounding'] !== 0) {

		echo '<div class="'.$r.'
ph-cart-currency-box">';
		echo '<div
class="'.$cTotE.'"></div>';
		echo '<div class="'.$cTotT.' 
ph-cart-rounding-txt">'.JText::_('COM_PHOCACART_ROUNDING').'</div>';
		echo '<div class="'.$cTotB.' ph-right
ph-cart-rounding">'.$price->getPriceFormat($d['total'][0]['rounding']).'</div>';
		echo '</div>';// end row
	}

	// BRUTTO (Because of rounding currency we need to display brutto in
currency which is set)
	//if
(!($price->roundPrice($d['total'][0]['brutto_currency'])
> -0.01 &&
$price->roundPrice($d['total'][0]['brutto_currency']
< 0.01)) == 1) {
	if ($d['total'][0]['brutto_currency'] !== 0) {
		echo '<div class="'.$r.'
ph-cart-currency-box">';
		echo '<div
class="'.$cTotE.'"></div>';
		echo '<div class="'.$cTotT.'
ph-cart-brutto-currency-txt">'.JText::_('COM_PHOCACART_TOTAL').'</div>';
		echo '<div class="'.$cTotB.'
ph-checkout-total-amount ph-cart-total ph-right
ph-cart-brutto-currency">'.$price->getPriceFormat($d['total'][0]['brutto_currency'],
0, 1).'</div>';
		echo '</div>';// end row
	//} else if
(!($price->roundPrice($d['total'][0]['brutto']) >
-0.01 &&
$price->roundPrice($d['total'][0]['brutto'] <
0.01)) == 1) {
	} else if ($d['total'][0]['brutto'] !== 0 ||
($d['total'][0]['brutto'] === 0 &&
$p['display_zero_total'] == 1)) {
		echo '<div class="'.$r.'
ph-cart-total-box">';
		echo '<div
class="'.$cTotE.'"></div>';
		echo '<div class="'.$cTotT.'
ph-cart-total-txt">'.JText::_('COM_PHOCACART_TOTAL').'</div>';
		echo '<div class="'.$cTotB.'
ph-checkout-total-amount ph-cart-total
ph-right">'.$price->getPriceFormat($d['total'][0]['brutto']).'</div>';
		echo '</div>';// end row

	}


	// Tax Recapitulation Possible part to display TC
	/*if(!empty($d['total'][0]['taxrecapitulation']['items']))
{

		echo '<table class="pc-tax-recapitulation">';

		echo
'<tr><th>'.JText::_('COM_PHOCACART_TAX_TITLE').'</th><th>'.JText::_('COM_PHOCACART_TAX_BASIS').'</th><th>'.JText::_('COM_PHOCACART_TAX_TAX').'</th><th>'.JText::_('COM_PHOCACART_TAX_TOTAL').'</th></tr>';

		/*if ($d['total'][0]['brutto_currency'] !== 0) {

			foreach($d['total'][0]['taxrecapitulation']['items']
as $k => $v) {
				echo
'<tr><td>'.$v['title'].'</td><td>'.$price->getPriceFormat($v['netto']).'</td><td>'.$price->getPriceFormat($v['tax']).'</td><td>'.$price->getPriceFormat($v['brutto_currency'],
0, 1).' '.'</td></tr>';
			}
			if
($d['total'][0]['taxrecapitulation']['rounding_currency']
> 0 &&
$d['total'][0]['taxrecapitulation']['corrected_currency']
== 1) {
				echo
'<tr><td>'.JText::_('COM_PHOCACART_ROUNDING').'</td><td
colspan="3">'.$price->getPriceFormat($d['total'][0]['taxrecapitulation']['rounding_currency'],
0, 1).'</td></tr>';
				echo
'<tr><td>'.JText::_('COM_PHOCACART_TOTAL').'</td><td
colspan="3">'.$price->getPriceFormat($d['total'][0]['brutto_currency'],
0, 1).'</td></tr>';
			}

		} else {*//*


		$b = 0; $c = 0;
			foreach($d['total'][0]['taxrecapitulation']['items']
as $k => $v) {
				echo
'<tr><td>'.$v['title'].'</td><td>'.$price->getPriceFormat($v['netto']).'</td><td>'.$price->getPriceFormat($v['tax']).'</td><td>'.$price->getPriceFormat($v['brutto']).'
'.'</td></tr>';
				$b += $v['brutto'];
			}

			if
(!($price->roundPrice($d['total'][0]['taxrecapitulation']['rounding'])
> -0.01 &&
$price->roundPrice($d['total'][0]['taxrecapitulation']['rounding']
< 0.01)) == 1) {

				echo
'<tr><td>'.JText::_('COM_PHOCACART_ROUNDING').'</td><td
colspan="3">'.$price->getPriceFormat($d['total'][0]['taxrecapitulation']['rounding_currency'],
0, 1).' '.'</td></tr>';
				//-
*$price->getPriceFormat($d['total'][0]['taxrecapitulation']['rounding_currency'])*//*.
				$c =
$d['total'][0]['taxrecapitulation']['rounding'];
			}
			echo
'<tr><td>'.JText::_('COM_PHOCACART_TOTAL').'</td><td
colspan="3">'.$price->getPriceFormat($d['total'][0]['brutto'])./*'
'.$price->getPriceFormat($d['total'][0]['brutto_currency']).'
<b>'.$b.'</b> <b>'.($b +
$c).*//*'</b></td></tr>';

		//}

		echo '</table>';
	} */

	// Possible points received

	if ($p['display_reward_points_receive_info'] == 1 &&
isset($d['total'][0]['points_received']) &&
$d['total'][0]['points_received'] > 0) {

		echo '<div
class="ph-ceckout-points-received">'.JText::_('COM_PHOCACART_POINTS_RECEIVED_FOR_THIS_PURCHASE').':
'
.$d['total'][0]['points_received'].'</div>';
	}


	echo '</div>'. "\n"; // end checkout box
} else {

	if ($d['pos']) {
		echo '<div class="ph-cart-icon"><span
class="'.$d['s']['i']['shopping-cart'].'"></span></div>';
	}
	echo '<div
class="ph-cart-empty">'.JText::_('COM_PHOCACART_SHOPPING_CART_IS_EMPTY').'</div>';
}


?>
layouts/cart_total.php000064400000001230151167552070011116
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */

/* Total amount used when product added to cart with ajax method and it
returns updated cart, updated count of items in cart and updated total
amount */
defined('_JEXEC') or die();
$d 		= $displayData;
$price	= new PhocacartPrice();
if (isset($d['total'][0]['brutto'])) {
	echo
$price->getPriceFormat($d['total'][0]['brutto']);
}
?>
layouts/categories_category.php000064400000005247151167552070013020
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

$layoutV	= new JLayoutFile('button_category_view', null,
array('component' => 'com_phocacart'));
$layoutI	= new JLayoutFile('category_image', null,
array('component' => 'com_phocacart'));

$d 		= $displayData;
$v		= $d['v'];
$t		= $d['t'];
$s      = $d['s'];

$image 	= PhocacartImage::getThumbnailName($t['path'],
$v->image, $d['image_size']);
$link	= JRoute::_(PhocacartRoute::getCategoryRoute($v->id,
$v->alias));

//echo '<div class="ph-image-box">';
$dI	= array();
if (isset($image->rel) && $image->rel != '') {

    $dI['t']			    = $t;
    $dI['s']			    = $s;
    $dI['image']['title']	= $v->title;
    $dI['image']['image']	= $image;

    echo '<a href="'.$link.'">';
    echo $layoutI->render($dI);
	echo '</a>';

} else if ($v->icon_class != '') {
    echo '<div class="ph-image-box-content">';
	echo '<div class="ph-image-box-content-item"><span
class="'. PhocacartText::filterValue($v->icon_class,
'text').'
ph-image-box-content-icon"></span></div>';
	echo '</div>';
}  else {
	// No image, add possible image per CSS
	//echo '<a href="'.$link.'">';
	echo '<div class="ph-image-box-content">';
	echo '<div
class="ph-image-box-content-item-'.strip_tags($v->alias).'"></div>';
	echo '</div>';
	//echo '</a>';
}


//echo '</div>';
//echo '<div class="ph-caption">';

echo
PhocacartRenderFront::renderCategoryHeader($t['category_name_link'],
$v);


if (!empty($v->subcategories) &&
(int)$t['csv_display_subcategories'] > 0) {
	echo '<ul>';
	$j = 0;
	foreach($v->subcategories as $v2) {
		if ($j == (int)$t['csv_display_subcategories']) {
			break;
		}
		$link2	= JRoute::_(PhocacartRoute::getCategoryRoute($v2->id,
$v2->alias));
		echo '<li><a
href="'.$link2.'">'.$v2->title.'</a></li>';
		$j++;
	}
	echo '</ul>';
}

// Description box will be displayed even no description is set - to set
height and have all columns same height
echo '<div class="ph-cat-desc">';
if ($v->description != '' &&
(int)$t['csv_display_category_desc'] > 0) {
	echo $v->description;
}
echo '</div>';


if ((int)$t['display_view_category_button'] > 0) {

	$d2									= array();
	$d2['link']							= $link;
    $d2['s']							= $s;
	$d2['display_view_category_button']	=
$t['display_view_category_button'];
	echo '<div class="ph-item-action-box">';
	echo $layoutV->render($d2);
	echo '</div>';
}
//echo '</div>';
layouts/category_image.php000064400000005571151167552070011755
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d                      = $displayData;

$altValue               =
PhocaCartImage::getAltTitle($d['image']['title'],
$d['image']['image']->rel);
$d['image']['style']    = '';
$srcPlaceHolder = 'data:image/svg+xml,%3Csvg
xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0
'.(int)$d['t']['medium_image_width'] .'
'.(int)$d['t']['medium_image_height']
.'\'%3E%3C/svg%3E';
if (isset($d['t']['image_width_cats']) &&
$d['t']['image_width_cats'] != '' &&
isset($d['t']['image_height_cats']) &&
$d['t']['image_height_cats'] != '') {
    $d['image']['style'] =
'style="width:'.$d['t']['image_width_cats'].';height:'.$d['t']['image_height_cats'].'"';
    $srcPlaceHolder = 'data:image/svg+xml,%3Csvg
xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0
'.(int)$d['t']['image_width_cats'] .'
'.(int)$d['t']['image_height_cats']
.'\'%3E%3C/svg%3E';
}

$class          =
PhocacartRenderFront::completeClass(array($d['s']['c']['img-responsive'],
'ph-image', $d['t']['class_lazyload']));
$src            =
JURI::base(true).'/'.$d['image']['image']->rel;
$srcImg         =
JURI::base(true).'/'.$d['image']['image']->rel;
// fallback

if ($d['t']['display_webp_images'] == 1) {

    $srcWebP        =
JURI::base(true).'/'.$d['image']['image']->rel_webp;
    $srcSetWebP     =
JURI::base(true).'/'.$d['image']['image']->rel_webp;

    if ($d['t']['lazy_load_categories'] == 1) {

        echo '<picture>';
        echo '<source type="image/webp"
data-src="'. $srcWebP.'" alt="' . $altValue .
'" class="' . $class . '" ' .
$d['image']['style'] . ' data-srcset="'
. $srcSetWebP . '" />';
        echo '<img src="'.$srcPlaceHolder.'"
data-src="'. $src.'"
alt="'.$altValue.'"
class="'.$class.'"
'.$d['image']['style'].' />';
        echo '</picture>';

    } else {

        echo '<picture>';
        echo '<source type="image/webp" alt="'
. $altValue . '" class="' . $class . '"
' . $d['image']['style'] . '
srcset="' . $srcSetWebP . '" />';
        echo '<img src="' . $srcImg . '"
alt="' . $altValue . '" class="' . $class .
'" ' . $d['image']['style'] . '
/>';
        echo '</picture>';
    }

} else {

    if (($d['t']['view'] == 'categories'
&& $d['t']['lazy_load_categories'] == 1) ||
(($d['t']['view'] == 'category' ||
$d['t']['view'] == 'items') &&
$d['t']['lazy_load_category_items'] == 1)) {
        echo '<img src="'.$srcPlaceHolder.'"
data-src="'. $src.'"
alt="'.$altValue.'"
class="'.$class.'"
'.$d['image']['style'].' />';
    } else {
        echo '<img src="'. $src.'"
alt="'.$altValue.'"
class="'.$class.'"
'.$d['image']['style'].' />';
    }
}
?>
layouts/category_pagination.php000064400000004616151167552070013023
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d  = $displayData;

echo '<div class="ph-cb"></div>';
echo '<form
action="'.$d['t']['action'].'"
method="post" name="adminForm">'.
"\n";
echo '<div
class="'.$d['s']['c']['row'].'
ph-pagination">';
if ($d['t']['show_pagination']) {

    echo '<div
class="'.$d['s']['c']['col.xs12.sm6.md6'].'
ph-center-pagination">';
	if ($d['t']['display_item_ordering']) {
		echo $d['t']['display_pagination_labels']  == 1 ?
JText::_('COM_PHOCACART_ORDER_FRONT') .':&nbsp;' :
'';
        echo str_replace( 'class="inputbox"',
'class="'.$d['s']['c']['inputbox.form-control'].'
chosen-select" style="width: 16em"
aria-label="'.JText::_('COM_PHOCACART_ORDER_FRONT').'"',
$d['t']['ordering']);
	}
	echo '</div>';

    echo '<div
class="'.$d['s']['c']['col.xs12.sm6.md6'].'
ph-center-pagination">';
	if ($d['t']['show_pagination_limit'] ) {
		echo $d['t']['display_pagination_labels'] == 1 ?
JText::_('COM_PHOCACART_DISPLAY_NUM') .':&nbsp;' :
'';
        echo str_replace( 'class="inputbox"',
'class="'.$d['s']['c']['inputbox.form-control'].'
chosen-select"
aria-label="'.JText::_('COM_PHOCACART_DISPLAY_NUM').'"',
$d['t']['pagination']->getLimitBox());
	}
    echo '</div>';

	echo '<div class="ph-cb"></div>';

	// .phPaginationBox used for AJAX pagination
	echo '<div
class="'.$d['s']['c']['col.xs12.sm12.md12'].'
ph-center-pagination pagination phPaginationBox">'.
str_replace( 'class="inputbox"',
'class="'.$d['s']['c']['inputbox.form-control'].'
chosen-select"',
$d['t']['pagination']->getPagesLinks()) .
'</div>';

    echo '<div class="ph-cb"></div>';

	echo '<div
class="'.$d['s']['c']['col.xs12.sm12.md12'].'
ph-center-pagination ph-pagination-mt pagination">';
	echo str_replace( 'class="inputbox"',
'class="'.$d['s']['c']['inputbox.form-control'].'
chosen-select"',
$d['t']['pagination']->getPagesCounter());
	echo '</div>';

    echo '<div class="ph-cb"></div>';
}
echo '</div>';
if ($d['t']['ajax_pagination_category'] == 1) {
	echo '<input type="hidden" name="format"
value="raw" />';
}
echo Joomla\CMS\HTML\HTMLHelper::_( 'form.token' );
echo '</form>';

?>
layouts/category_pagination_top.php000064400000006024151167552070013700
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d  = $displayData;


echo '<div class="ph-cb"></div>';

echo '<form id="phItemTopBoxForm"
action="'.$d['t']['action'].'"
method="post" name="phitemstopboxform">'.
"\n";
echo '<div
class="'.$d['s']['c']['row'].'
ph-pagination-top">';

if ($d['t']['show_pagination_top']) {

    echo '<div
class="'.$d['s']['c']['col.xs12.sm5.md5'].'
ph-pag-top-row">';
	if ($d['t']['display_item_ordering_top']) {

		$ordering = str_replace( 'class="inputbox"',
'class="'.$d['s']['c']['inputbox.form-control'].'
chosen-select" style="width: 16em;"
aria-label="'.JText::_('COM_PHOCACART_ORDER_FRONT').'"',
$d['t']['ordering']);
		$ordering = str_replace( 'id="itemordering"',
'id="itemorderingtop"
aria-label="'.JText::_('COM_PHOCACART_ORDER_FRONT').'"',
$ordering);// possible two the same ID
		echo $d['t']['display_pagination_labels'] == 1 ?
JText::_('COM_PHOCACART_ORDER_FRONT') .':&nbsp;' :
'';
		echo $ordering;

	}
    echo '</div>';

    echo '<div
class="'.$d['s']['c']['col.xs12.sm3.md3'].'
ph-pag-top-row">';
	if ($d['t']['show_pagination_limit_top']) {

		$limit = str_replace( 'class="inputbox"',
'class="'.$d['s']['c']['inputbox.form-control'].'
chosen-select"
aria-label="'.JText::_('COM_PHOCACART_DISPLAY_NUM').'"',
$d['t']['pagination']->getLimitBox());
		$limit = str_replace( 'id="limit"',
'id="limittop"
aria-label="'.JText::_('COM_PHOCACART_DISPLAY_NUM').'"',
$limit);// possible two the same ID
		echo $d['t']['display_pagination_labels'] == 1 ?
JText::_('COM_PHOCACART_DISPLAY_NUM') .':&nbsp;' :
'';
		echo $limit;

	}
    echo '</div>';


    echo '<div
class="'.$d['s']['c']['col.xs12.sm4.md4'].'
ph-pag-top-row">';
	if ($d['t']['show_switch_layout_type']) {

		echo '<button type="button"
aria-label="'.JText::_('COM_PHOCACART_GRID').'"
class="'.$d['s']['c']['btn.btn-default'].'
phItemSwitchLayoutType grid
'.$d['t']['layouttypeactive'][0].'"
data-layouttype="grid"><span
class="'.$d['s']['i']['grid'].'"></span></button>
';
		echo '<button type="button"
aria-label="'.JText::_('COM_PHOCACART_GRID_LIST').'"
class="'.$d['s']['c']['btn.btn-default'].'
phItemSwitchLayoutType gridlist
'.$d['t']['layouttypeactive'][1].'"
data-layouttype="gridlist"><span
class="'.$d['s']['i']['gridlist'].'"></span></button>
';
		echo '<button type="button"
aria-label="'.JText::_('COM_PHOCACART_LIST').'"
class="'.$d['s']['c']['btn.btn-default'].'
phItemSwitchLayoutType list
'.$d['t']['layouttypeactive'][2].'"
data-layouttype="list"><span
class="'.$d['s']['i']['list'].'"></span></button>';

	}
    echo '</div>';

    echo '<div class="ph-cb"></div>';
}
echo '</div>';
echo '<input type="hidden" name="format"
value="raw" />';
echo Joomla\CMS\HTML\HTMLHelper::_( 'form.token' );
echo '</form>';
?>
layouts/email_ask_question.php000064400000003615151167552070012647
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d 				= $displayData;
$displayData 	= null;

?>
<p><?php echo JText::_(
'COM_PHOCACART_NEW_QUESTION_POSTED' ) ?></p>

<table style="border:0">

	<?php if (isset($d['name']) && $d['name']
!= '') { ?>
	<tr style="border:0">
		<td style="border:0"><?php echo JText::_(
'COM_PHOCACART_NAME' ) ?>:</td>
		<td style="border:0"><?php echo $d['name']
?></td>
	</tr>
	<?php } ?>
	
	<?php if (isset($d['email']) && $d['email']
!= '') { ?>
	<tr style="border:0">
		<td style="border:0"><?php echo JText::_(
'COM_PHOCACART_EMAIL' ) ?>:</td>
		<td style="border:0"><?php echo $d['email']
?></td>
	</tr>
	<?php } ?>
	
	<?php if (isset($d['phone']) && $d['phone']
!= '') { ?>
	<tr style="border:0">
		<td style="border:0"><?php echo JText::_(
'COM_PHOCACART_PHONE' ) ?>:</td>
		<td style="border:0"><?php echo $d['phone']
?></td>
	</tr>
	<?php } ?>
	
	<tr style="border:0">
		<td style="border:0"><?php echo JText::_(
'COM_PHOCACART_DATE' ) ?>:</td>
		<td style="border:0"><?php echo
Joomla\CMS\HTML\HTMLHelper::_('date',  gmdate('Y-m-d
H:i:s'), JText::_( 'DATE_FORMAT_LC2' )) ?></td>
	</tr>
</table>

<p><?php echo JText::_( 'COM_PHOCACART_SUBJECT' ) ?>:
<b><?php echo $d['subject'] ?></b></p>
<p><?php echo JText::_( 'COM_PHOCACART_MESSAGE' )
?>:</p>
<div><?php echo
PhocacartUtils::wordDelete($d['message'],
$d['numcharemail'], '...') ?></div>

<p>&nbsp;</p>
<p><a href="<?php echo $d['url']
?>"><?php echo $d['url'] ?></a></p>

<p>&nbsp;</p>
<p><?php echo JText::_( 'COM_PHOCACART_REGARDS' )
?>,<br><?php echo $d['sitename'] ?></p>

<p>&nbsp;</p>
layouts/email_submit_item.php000064400000004101151167552070012452
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d 				= $displayData;
$displayData 	= null;

?>
<p><?php echo JText::_(
'COM_PHOCACART_NEW_ITEM_SUBMITTED' ) ?></p>

<table style="border:0">

	<?php if (isset($d['name']) && $d['name']
!= '') { ?>
	<tr style="border:0">
		<td style="border:0"><?php echo JText::_(
'COM_PHOCACART_NAME' ) ?>:</td>
		<td style="border:0"><?php echo $d['name']
?></td>
	</tr>
	<?php } ?>

	<?php if (isset($d['email']) && $d['email']
!= '') { ?>
	<tr style="border:0">
		<td style="border:0"><?php echo JText::_(
'COM_PHOCACART_EMAIL' ) ?>:</td>
		<td style="border:0"><?php echo $d['email']
?></td>
	</tr>
	<?php } ?>

	<?php if (isset($d['phone']) && $d['phone']
!= '') { ?>
	<tr style="border:0">
		<td style="border:0"><?php echo JText::_(
'COM_PHOCACART_PHONE' ) ?>:</td>
		<td style="border:0"><?php echo $d['phone']
?></td>
	</tr>
	<?php } ?>

    <?php if (isset($d['title']) &&
$d['title'] != '') { ?>
	<tr style="border:0">
		<td style="border:0"><?php echo JText::_(
'COM_PHOCACART_TITLE' ) ?>:</td>
		<td style="border:0"><?php echo $d['title']
?></td>
	</tr>
	<?php } ?>

	<tr style="border:0">
		<td style="border:0"><?php echo JText::_(
'COM_PHOCACART_DATE' ) ?>:</td>
		<td style="border:0"><?php echo
Joomla\CMS\HTML\HTMLHelper::_('date',  gmdate('Y-m-d
H:i:s'), JText::_( 'DATE_FORMAT_LC2' )) ?></td>
	</tr>
</table>

<p><?php echo JText::_( 'COM_PHOCACART_SUBJECT' ) ?>:
<b><?php echo $d['subject'] ?></b></p>

<div><?php echo
PhocacartUtils::wordDelete($d['message'],
$d['numcharemail'], '...') ?></div>

<p>&nbsp;</p>
<p><a href="<?php echo $d['url']
?>"><?php echo $d['url'] ?></a></p>

<p>&nbsp;</p>
<p><?php echo JText::_( 'COM_PHOCACART_REGARDS' )
?>,<br><?php echo $d['sitename'] ?></p>

<p>&nbsp;</p>
layouts/form_filter_checkbox.php000064400000007041151167552070013146
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d 				= $displayData;
$displayData 	= null;
$dParamAttr		= str_replace(array('[',']'),
'', $d['param']);

if ($d['params']['open_filter_panel'] == 0) {
    $d['collapse_class'] =
$d['s']['c']['panel-collapse.collapse'];
    $d['triangle_class'] =
$d['s']['i']['triangle-right'];
} else if ($d['params']['open_filter_panel'] == 2) {
    $d['collapse_class'] =
$d['s']['c']['panel-collapse.collapse'];//
closed as default and wait if there is some active item to open it
    $d['triangle_class'] =
$d['s']['i']['triangle-right'];
} else {
    $d['collapse_class'] =
$d['s']['c']['panel-collapse.collapse.in'];
    $d['triangle_class'] =
$d['s']['i']['triangle-bottom'];
}

$output = '';
foreach ($d['items'] as $k => $v) {

    $checked 	= '';
    $value		= htmlspecialchars($v->alias);
    if (isset($d['nrinalias']) &&
$d['nrinalias'] == 1) {
        $value 		= (int)$v->id .'-'.
htmlspecialchars($v->alias);
    }

    if (in_array($value, $d['getparams'])) {
        $checked 	= 'checked';
        $d['collapse_class'] =
$d['s']['c']['panel-collapse.collapse.in'];
    }


    $jsSet = '';
    if (isset($d['forcecategory']['idalias'])
&& $d['forcecategory']['idalias']  !=
'') {
        // Category View - force the category parameter if set in
parameters
        $jsSet .= 'phChangeFilter(\'c\',
\''.$d['forcecategory']['idalias'].'\',
1, \'text\', 0, 1, 1);';
    }
    $jsSet .=
'phChangeFilter(\''.$d['param'].'\',
\''. $value.'\', this,
\''.$d['formtype'].'\',\''.$d['uniquevalue'].'\',
0, 1);';

    $count = '';
    if (isset($v->count_products) &&
isset($d['params']['display_count']) &&
$d['params']['display_count'] == 1 ) {
        $count = ' <span
class="ph-filter-count">'.(int)$v->count_products.'</span>';
    }


    $output .= '<div class="checkbox">';
    $output .= '<label
class="ph-checkbox-container"><input
type="checkbox" name="tag"
value="'.$value.'" '.$checked.'
onchange="'.$jsSet.'"
/>'.$v->title.$count.'<span
class="ph-checkbox-checkmark"></span></label>';
    $output .= '</div>';

}

$title = isset($d['titleheader']) &&
$d['titleheader'] != '' ? $d['titleheader'] :
$d['title'];

?><div class="<?php echo
$d['s']['c']['panel.panel-default'] ?>
panel-<?php echo $dParamAttr; ?>">
	<div class="<?php echo
$d['s']['c']['panel-heading'] ?>"
role="tab" id="heading<?php echo $dParamAttr;
?>">
		<h4 class="<?php echo
$d['s']['c']['panel-title'] ?>">
			<a data-toggle="collapse" href="#collapse<?php echo
$dParamAttr; ?>" aria-expanded="true"
aria-controls="collapse<?php echo $dParamAttr; ?>"
class="panel-collapse" aria-label="<?php echo
JText::_('COM_PHOCACART_COLLAPSE') . ' ' .
$d['title'] ?>"><span class="<?php echo
$d['triangle_class'] ?>"></span></a>
			<a data-toggle="collapse" href="#collapse<?php echo
$dParamAttr; ?>" aria-expanded="true"
aria-controls="collapse<?php echo$dParamAttr; ?>"
class="panel-collapse" aria-label="<?php echo $title
?>"><?php echo $title ?></a>
		</h4>
	</div>

	<div id="collapse<?php echo $dParamAttr; ?>"
class="<?php echo $d['collapse_class'] ?>"
role="tabpanel" aria-labelledby="heading<?php echo
$dParamAttr; ?>">
		<div class="<?php echo
$d['s']['c']['panel-body'] ?>">
			<?php echo $output ?>
		</div>
	</div>
</div>


layouts/form_filter_checkbox_categories.php000064400000003133151167552070015351
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d 				= $displayData;
$displayData 	= null;
$dParamAttr		= str_replace(array('[',']'),
'', $d['param']);


?>
<div class="<?php echo
$d['s']['c']['panel.panel-default'] ?>
panel-<?php echo $dParamAttr; ?>">
	<div class="<?php echo
$d['s']['c']['panel-heading'] ?>"
role="tab" id="heading<?php echo $dParamAttr;
?>">
		<h4 class="<?php echo
$d['s']['c']['panel-title'] ?>">
			<a data-toggle="collapse" href="#collapse<?php echo
$dParamAttr; ?>" aria-expanded="true"
aria-controls="collapse<?php echo $dParamAttr; ?>"
class="panel-collapse" aria-label="<?php echo
JText::_('COM_PHOCACART_COLLAPSE') . ' ' .
$d['title'] ?>"><span class="<?php echo
$d['triangle_class'] ?>"></span></a>
			<a data-toggle="collapse" href="#collapse<?php echo
$dParamAttr; ?>" aria-expanded="true"
aria-controls="collapse<?php echo$dParamAttr; ?>"
class="panel-collapse" aria-label="<?php echo
$d['title'] ?>"><?php echo $d['title']
?></a>
		</h4>
	</div>

	<div id="collapse<?php echo $dParamAttr; ?>"
class="<?php echo $d['collapse_class'] ?>"
role="tabpanel" aria-labelledby="heading<?php echo
$dParamAttr; ?>">
		<div class="<?php echo
$d['s']['c']['panel-body']
?>"><div
class="ph-filter-module-categories-tree">
			<?php echo $d['output'];?>
		</div></div>
	</div>
</div>
layouts/form_filter_color.php000064400000007255151167552070012505
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d 				= $displayData;
$displayData 	= null;
$dParamAttr		= str_replace(array('[',']'),
'', $d['param']);
$iconType		= $d['s']['i']['icon-type'];

if ($d['params']['open_filter_panel'] == 0) {
    $d['collapse_class'] =
$d['s']['c']['panel-collapse.collapse'];
    $d['triangle_class'] =
$d['s']['i']['triangle-right'];
} else if ($d['params']['open_filter_panel'] == 2) {
    $d['collapse_class'] =
$d['s']['c']['panel-collapse.collapse'];//
closed as default and wait if there is some active item to open it
    $d['triangle_class'] =
$d['s']['i']['triangle-right'];
} else {
    $d['collapse_class'] =
$d['s']['c']['panel-collapse.collapse.in'];
    $d['triangle_class'] =
$d['s']['i']['triangle-bottom'];
}

// This output is outside html to get the useful information from foreach
about if the panel is active (this is needed to open or clode the panel)
$output = '';
foreach ($d['items'] as $k => $v) {

    $checked 	= '';
    $checkedInt = 0;
    $value		= htmlspecialchars($v->alias);
    if (isset($d['nrinalias']) &&
$d['nrinalias'] == 1) {
        $value 		= (int)$v->id .'-'.
htmlspecialchars($v->alias);
    }

    if (in_array($value, $d['getparams'])) {
        $checked 	= 'checked';
        $checkedInt	= 0;
    } else {
        $checkedInt	= 1;
    }

    $class = $iconType . ' ';
    if ($checked) {
        $class .= 'on';
        $d['collapse_class'] =
$d['s']['c']['panel-collapse.collapse.in'];
    }

    if (isset($v->color) && $v->color != '') {

        $jsSet = '';
        if (isset($d['forcecategory']['idalias'])
&& $d['forcecategory']['idalias']  !=
'') {
            // Category View - force the category parameter if set in
parameters
            $jsSet .= 'phChangeFilter(\'c\',
\''.$d['forcecategory']['idalias'].'\',
1, \'text\', 0, 1, 1);';
        }
        $jsSet .=
'phChangeFilter(\''.$d['param'].'\',
\''. $value.'\', '.(int)$checkedInt.',
\''.$d['formtype'].'\',
\''.$d['uniquevalue'].'\', 0, 1);return
false;';

        $output .= '<a href="#"
class="phSelectBoxButton '.$class.'
color-'.str_replace('#', '',
$v->color).'"
style="background-color:'.$v->color.'"
onclick="'.$jsSet.'"
title="'.htmlspecialchars($v->title).'">&nbsp;</a>';
    }
}

$title = isset($d['titleheader']) &&
$d['titleheader'] != '' ? $d['titleheader'] :
$d['title'];
?>
<div class="<?php echo
$d['s']['c']['panel.panel-default'] ?>
panel-<?php echo $dParamAttr; ?>">
	<div class="<?php echo
$d['s']['c']['panel-heading'] ?>"
role="tab" id="heading<?php echo $dParamAttr;
?>">
		<h4 class="<?php echo
$d['s']['c']['panel-title'] ?>">
			<a data-toggle="collapse" href="#collapse<?php echo
$dParamAttr; ?>" aria-expanded="true"
aria-controls="collapse<?php echo $dParamAttr; ?>"
class="panel-collapse"><span class="<?php echo
$d['triangle_class'] ?>"></span></a>
			<a data-toggle="collapse" href="#collapse<?php echo
$dParamAttr; ?>" aria-expanded="true"
aria-controls="collapse<?php echo$dParamAttr; ?>"
class="panel-collapse"><?php echo $title ?></a>
		</h4>
	</div>

	<div id="collapse<?php echo $dParamAttr; ?>"
class="<?php echo $d['collapse_class'] ?>"
role="tabpanel" aria-labelledby="heading<?php echo
$dParamAttr; ?>">
		<div class="<?php echo
$d['s']['c']['panel-body'] ?>
ph-panel-body-color">
				<div class="ph-mod-color-box">
			    <?php echo $output ?>
                </div>
		</div>
	</div>
</div>
layouts/form_filter_image.php000064400000007422151167552070012445
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d 				= $displayData;
$displayData 	= null;
$dParamAttr		= str_replace(array('[',']'),
'', $d['param']);
$iconType		= $d['s']['i']['icon-type'];

if ($d['params']['open_filter_panel'] == 0) {
    $d['collapse_class'] =
$d['s']['c']['panel-collapse.collapse'];
    $d['triangle_class'] =
$d['s']['i']['triangle-right'];
} else if ($d['params']['open_filter_panel'] == 2) {
    $d['collapse_class'] =
$d['s']['c']['panel-collapse.collapse'];//
closed as default and wait if there is some active item to open it
    $d['triangle_class'] =
$d['s']['i']['triangle-right'];
} else {
    $d['collapse_class'] =
$d['s']['c']['panel-collapse.collapse.in'];
    $d['triangle_class'] =
$d['s']['i']['triangle-bottom'];
}

// This output is outside html to get the useful information from foreach
about if the panel is active (this is needed to open or clode the panel)
$output = '';
foreach ($d['items'] as $k => $v) {

    $checked 	= '';
    $checkedInt = 0;
    $value		= htmlspecialchars($v->alias);
    if (isset($d['nrinalias']) &&
$d['nrinalias'] == 1) {
        $value 		= (int)$v->id .'-'.
htmlspecialchars($v->alias);
    }

    if (in_array($value, $d['getparams'])) {
        $checked 	= 'checked';
        $checkedInt	= 0;
    } else {
        $checkedInt	= 1;
    }

    $class = $iconType . ' ';
    if ($checked) {
        $class .= 'on';
        $d['collapse_class'] =
$d['s']['c']['panel-collapse.collapse.in'];
    }

    if (isset($v->image_small) && $v->image_small !=
'') {

        $linkI 		=
JURI::base(true).'/'.$d['pathitem']['orig_rel'].'/'.$v->image_small;

        $jsSet = '';
        if (isset($d['forcecategory']['idalias'])
&& $d['forcecategory']['idalias']  !=
'') {
            // Category View - force the category parameter if set in
parameters
            $jsSet .= 'phChangeFilter(\'c\',
\''.$d['forcecategory']['idalias'].'\',
1, \'text\', 0, 1, 1);';
        }
        $jsSet .=
'phChangeFilter(\''.$d['param'].'\',
\''. $value.'\', '.(int)$checkedInt.',
\''.$d['formtype'].'\',
\''.$d['uniquevalue'].'\', 0, 1);return
false;';

        $output .= '<a href="#"
class="phSelectBoxImage '.$class.'"
onclick="'.$jsSet.'"
title="'.htmlspecialchars($v->title).'">'
        .'<img
style="'.$d['style'].'"
src="'.$linkI.'"
alt="'.$v->title.'" />'
        .'</a>';
    }
}

$title = isset($d['titleheader']) &&
$d['titleheader'] != '' ? $d['titleheader'] :
$d['title'];
?>
<div class="<?php echo
$d['s']['c']['panel.panel-default'] ?> 
panel-<?php echo $dParamAttr; ?>">
	<div class="<?php echo
$d['s']['c']['panel-heading'] ?>"
role="tab" id="heading<?php echo $dParamAttr;
?>">
		<h4 class="<?php echo
$d['s']['c']['panel-title'] ?>">
			<a data-toggle="collapse" href="#collapse<?php echo
$dParamAttr; ?>" aria-expanded="true"
aria-controls="collapse<?php echo $dParamAttr; ?>"
class="panel-collapse"><span class="<?php echo
$d['triangle_class'] ?>"></span></a>
			<a data-toggle="collapse" href="#collapse<?php echo
$dParamAttr; ?>" aria-expanded="true"
aria-controls="collapse<?php echo$dParamAttr; ?>"
class="panel-collapse"><?php echo $title ?></a>
		</h4>
	</div>

	<div id="collapse<?php echo $dParamAttr; ?>"
class="<?php echo $d['collapse_class'] ?>"
role="tabpanel" aria-labelledby="heading<?php echo
$dParamAttr; ?>">
		<div class="<?php echo
$d['s']['c']['panel-body'] ?>
ph-panel-body-color">
			<div class="ph-mod-color-box">
			<?php echo $output ?>
            </div>
		</div>
	</div>
</div>
layouts/form_filter_text.php000064400000016435151167552070012353
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d 				= $displayData;

$d['paramname']	= str_replace('_', '',
$d['param']);
if (isset($d['param2']) && $d['param2'] !=
'') {
	$d['param2name']	= str_replace('_', '',
$d['param2']);
}

if (isset($d['param2']) && $d['param2'] !=
'') {
	// We have second parameter, so in first we define that the javascript
should wait with re-direct

    $jsSet = '';
    if (isset($d['forcecategory']['idalias'])
&& $d['forcecategory']['idalias']  !=
'') {
        // Category View - force the category parameter if set in
parameters
        $jsSet .= 'phChangeFilter(\'c\',
\''.$d['forcecategory']['idalias'].'\',
1, \'text\', 0, 1, 1);';
    }
    $jsSet	.=
'phChangeFilter(\''.$d['param'].'\',
jQuery(\'#'. $d['id'].'
input[name=&quot;'.$d['paramname'].'&quot;]\').val(),
1, \'text\', 1, 1, 1);';
	$jsSet	.=
'phChangeFilter(\''.$d['param2'].'\',
jQuery(\'#'. $d['id'].'
input[name=&quot;'.$d['param2name'].'&quot;]\').val(),
1, \'text\', 1, 0, 1);';

	$jsClear		 =
'phClearField(\'#'.$d['id'].$d['paramname'].'\');';
	$jsClear		.=
'phClearField(\'#'.$d['id'].$d['param2name'].'\');';
	$jsClear		.=
'phChangeFilter(\''.$d['param'].'\',
\'\', 0, \'text\', 1, 1, 1);';
	$jsClear		.=
'phChangeFilter(\''.$d['param2'].'\',
\'\', 0, \'text\', 1, 0, 1);';
} else {
	// We have only one parameter so we don't need define wait and the
site is reloaded immediately
    $jsSet = '';
    if (isset($d['forcecategory']['idalias'])
&& $d['forcecategory']['idalias']  !=
'') {
        // Category View - force the category parameter if set in
parameters
        $jsSet .= 'phChangeFilter(\'c\',
\''.$d['forcecategory']['idalias'].'\',
1, \'text\', 0, 1, 1);';
    }
	$jsSet	.=
'phChangeFilter(\''.$d['param'].'\',
jQuery(\'#'. $d['id'].'
input[name=&quot;'.$d['paramname'].'&quot;]\').val(),
1, \'text\', 1, 0, 1);';
	$jsClear=
'phChangeFilter(\''.$d['param'].'\',
\'\', 0, \'text\', 1, 0 , 1);';
}


// Display Price input text or Price input range or both
$styleFormGroup = '';
if (isset($d['filterprice']) &&
$d['filterprice'] == 2) {
	// Hide form input text of price from and price to in case
	// only range (graphic output) should be displayed
	// 1 ... display only input text
	// 3 ... display input text and input range
	// 2 ... display only input range (the input text will be hidden because
they values we need to manage the form)
	$styleFormGroup = 'style="display:none"';
}

$title = isset($d['titleheader']) &&
$d['titleheader'] != '' ? $d['titleheader'] :
$d['title'];
$displayData 	= null;
?>
<div class="<?php echo
$d['s']['c']['panel.panel-default'] ?>
panel-<?php echo $d['param']; ?>">
	<div class="<?php echo
$d['s']['c']['panel-heading'] ?>"
role="tab" id="heading<?php echo $d['param'];
?>">
		<h4 class="<?php echo
$d['s']['c']['panel-title'] ?>">
			<a data-toggle="collapse" href="#collapse<?php echo
$d['param']; ?>" aria-expanded="true"
aria-controls="collapse<?php echo $d['param'];
?>" class="panel-collapse" aria-label="<?php echo
JText::_('COM_PHOCACART_COLLAPSE') . ' ' . $title
?>"><span class="<?php echo
$d['triangle_class'] ?>"></span></a>
			<a data-toggle="collapse" href="#collapse<?php echo
$d['param']; ?>" aria-expanded="true"
aria-controls="collapse<?php echo $d['param'];
?>" class="panel-collapse" aria-label="<?php echo
$title ?>"><?php echo $title ?></a>
		</h4>
	</div>

	<div id="collapse<?php echo $d['param']; ?>"
class="<?php echo $d['collapse_class'] ?>"
role="tabpanel" aria-labelledby="heading<?php echo
$d['param']; ?>">
		<div class="<?php echo
$d['s']['c']['panel-body'] ?> <?php
echo $d['s']['c']['form-horizontal']
?>" id="<?php echo $d['id']; ?>">

			<div class="<?php echo
$d['s']['c']['form-group'] ?> <?php
echo $d['s']['c']['row'] ?>" <?php
echo $styleFormGroup ?>>
				<label class="<?php echo
$d['s']['c']['col.xs12.sm5.md5'] ?>"
for="<?php echo $d['id'].$d['paramname'];
?>"><?php echo $d['title1']; ?></label>
				<div class="<?php echo
$d['s']['c']['col.xs12.sm7.md7']
?>"><input type="text" class="<?php echo
$d['s']['c']['form-control'] ?>"
name="<?php echo $d['paramname']; ?>"
value="<?php echo $d['getparams'][0]; ?>"
id="<?php echo $d['id'].$d['paramname'];
?>" /></div>
			</div>
			<?php
			if (isset($d['param2']) && $d['param2'] !=
'') { ?>
				<div class="<?php echo
$d['s']['c']['form-group'] ?> <?php
echo $d['s']['c']['row'] ?>" <?php
echo $styleFormGroup ?>>
					<label class="<?php echo
$d['s']['c']['col.xs12.sm5.md5'] ?>"
for="<?php echo $d['id'].$d['param2name'];
?>"><?php echo $d['title2']; ?></label>
					<div class="<?php echo
$d['s']['c']['col.xs12.sm7.md7']
?>"><input type="text" class="<?php echo
$d['s']['c']['form-control'] ?>"
name="<?php echo $d['param2name']; ?>"
value="<?php echo $d['getparams2'][0]; ?>"
id="<?php echo $d['id'].$d['param2name'];
?>" /></div>
				</div>
			<?php } ?>


			<?php
			// Display filter price range (graphic range)
			if (isset($d['filterprice']) &&
($d['filterprice'] == 2 || $d['filterprice'] == 3)) {
?>
            <div class="<?php echo
$d['s']['c']['row'] ?>">
			<div class="<?php echo
$d['s']['c']['col.xs12.sm12.md12'] ?>
ph-price-filter-box">
				<div id="phPriceFilterRange"></div>
				<div id="phPriceFilterPrice"></div>
			</div>
            </div>
			<?php } ?>

            <div class="<?php echo
$d['s']['c']['row'] ?>">
			<div class="<?php echo
$d['s']['c']['col.xs12.sm5.md5']
?>"></div>
			<div class="<?php echo
$d['s']['c']['col.xs12.sm7.md7']
?>">
				<div class="<?php echo
$d['s']['c']['pull-right'] ?> <?php
echo $d['s']['c']['btn-group'] ?> ph-zero
ph-right-zero">
					<button class="<?php echo
$d['s']['c']['btn.btn-success'] ?> tip
<?php echo $d['s']['c']['hastooltip']
?>" type="button" onclick="<?php echo $jsSet;
?>" title="<?php echo $d['titleset']; ?>"
 aria-label="<?php echo $d['titleset'];
?>"><span class="<?php echo
$d['s']['i']['ok']
?>"></span></button>
					<button class="<?php echo
$d['s']['c']['btn.btn-danger'] ?> tip
<?php echo $d['s']['c']['hastooltip']
?> <?php echo
$d['s']['c']['pull-right'] ?>"
type="button" onclick="<?php echo $jsClear; ?>"
title="<?php echo $d['titleclear']; ?>"
aria-label="<?php echo $d['titleclear'];
?>"><span class="<?php echo
$d['s']['i']['clear']
?>"></span></button>
				</div>
			</div>
            </div>
			<?php
			/*

			<button class="btn tip <?php echo
$d['s']['c']['hastooltip'] ?>"
type="button"
onclick="phChangeFilter('.$d['param'].',
\''. $value.'\', 0, \'text\');"
title="<?php echo JText::_('COM_PHOCACART_CLEAR_PRICE');
?>"><span
class="icon-remove"></span></button>

			foreach ($d['items'] as $k => $v) {

				$checked 	= '';
				$value 		= (int)$v->id .'-'.
htmlspecialchars($v->alias);

				if (in_array($value, $d['getparams'])) {
					$checked 	= 'checked';
				}

				echo '<div class="checkbox">';
				echo '<label><input type="checkbox"
name="tag" value="'.$value.'"
'.$checked.' onchange="phChangeFilter(this,
\''.$d['param'].'\', \''.
$value.'\');"
/>'.$v->title.'</label>';
				echo '</div>';

			}*/
		?>
            <div class="ph-cb"></div>
		</div>
	</div>
</div>
layouts/form_newsletter_checkbox.php000064400000001313151167552070014051
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d 				= $displayData;
$displayData 	= null;
$required		= $d['display'] == 2 ? 'required=""
aria-required="true"' : '';
?>
<div class="<?php echo $d['class'] ?>">
	<label><input type="<?php echo
$d['s']['c']['checkbox'] ?>"
id="<?php echo $d['name'] ?>" name="<?php
echo $d['name'] ?>" <?php echo $required ?>
/><?php echo $d['label_text'] ?></label>
</div>
layouts/form_part_end.php000064400000000733151167552070011610
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
// <--- FORM START MUST BE ADDED IN OUTPUT TEMPLATE
echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
echo '</form>';
?>
layouts/form_part_start_add_to_cart_list.php000064400000003464151167552070015561
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */

// Add to cart button
// 1 Standard Button
// 4 Icon Only Button
// 100 and above - specific external buttons
// 102 Paddle
// 103 External link
defined('_JEXEC') or die();
$d 				= $displayData;
$displayData 	= null;
$task 			= $d['typeview'] == 'Pos' ?
'pos.add' : 'checkout.add';
$ticketId 		= isset($d['ticketid']) ?
(int)$d['ticketid'] : 0;
$unitId 		= isset($d['unitid']) ? (int)$d['unitid'] :
0;
$sectionId 		= isset($d['sectionid']) ?
(int)$d['sectionid'] : 0;

echo '<form 
	id="phCartAddToCartButton'.(int)$d['id'].'"
	class="phItemCartBoxForm phjAddToCart
phj'.$d['typeview'].'
phjAddToCartV'.$d['typeview'].'P'.(int)$d['id'].'"

	action="'.$d['linkch'].'"
method="post">';

echo '<input type="hidden" name="id"
value="'.(int)$d['id'].'">';
echo '<input type="hidden" name="catid"
value="'.(int)$d['catid'].'">';
echo (int)$ticketId > 0 ? '<input type="hidden"
name="ticketid"
value="'.(int)$ticketId.'">' : '';
echo (int)$unitId > 0 ? '<input type="hidden"
name="unitid"
value="'.(int)$unitId.'">' : '';
echo (int)$sectionId > 0 ? '<input type="hidden"
name="sectionid"
value="'.(int)$sectionId.'">' : '';
echo '<input type="hidden" name="quantity"
value="1">';
echo '<input type="hidden" name="task"
value="'.$task.'">';
echo '<input type="hidden" name="tmpl"
value="component" />';
echo '<input type="hidden" name="option"
value="com_phocacart" />';
echo '<input type="hidden" name="return"
value="'.$d['return'].'" />';

// FORM END MUST BE ADDED IN OUTPUT TEMPLATE --->
?>
layouts/form_privacy_checkbox.php000064400000001313151167552070013332
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d 				= $displayData;
$displayData 	= null;
$required		= $d['display'] == 2 ? 'required=""
aria-required="true"' : '';
?>
<div class="<?php echo $d['class'] ?>">
	<label><input type="<?php echo
$d['s']['c']['checkbox'] ?>"
id="<?php echo $d['name'] ?>" name="<?php
echo $d['name'] ?>" <?php echo $required ?>
/><?php echo $d['label_text'] ?></label>
</div>
layouts/form_question.php000064400000004352151167552070011664
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d 	= $displayData;
// NOT USED
$d['paramname'] = $d['title1'] =
$d['param2name'] = $d['getparams'][0] = $jsSet =
$jsClear = $d['titleclear'] = $d['titleset'] =
'';

?>
<div class="<?php echo
$d['s']['c']['form-group'] ?>">
	<label class="<?php echo
$d['s']['c']['col.xs12.sm5.md5'] ?>"
for="<?php echo $d['paramname']; ?>"><?php
echo $d['title1']; ?></label>
	<div class="<?php echo
$d['s']['c']['col.xs12.sm7.md7']
?>"><input type="text" class="<?php echo
$d['s']['c']['form-control'] ?>"
name="<?php echo $d['paramname']; ?>"
value="<?php echo $d['getparams'][0]; ?>"
/></div>
</div>
<?php
if (isset($d['param2']) && $d['param2'] !=
'') { ?>
	<div class="<?php echo
$d['s']['c']['form-group'] ?>">
		<label class="<?php echo
$d['s']['c']['col.xs12.sm5.md5'] ?>"
for="<?php echo $d['param2name']; ?>"><?php
echo $d['title2']; ?></label>
		<div class="<?php echo
$d['s']['c']['col.xs12.sm7.md7']
?>"><input type="text" class="<?php echo
$d['s']['c']['form-control'] ?>"
name="<?php echo $d['param2name']; ?>"
value="<?php echo $d['getparams2'][0]; ?>"
/></div>
	</div>
<?php } ?>


<div class="<?php echo
$d['s']['c']['col.xs12.sm5.md5']
?>"></div>
<div class="<?php echo
$d['s']['c']['col.xs12.sm7.md7']
?>">
	<div class="<?php echo
$d['s']['c']['pull-right'] ?> <?php
echo $d['s']['c']['btn-group'] ?> ph-zero
ph-right-zero">
		<button class="<?php echo
$d['s']['c']['btn.btn-success'] ?> tip
<?php echo $d['s']['c']['hastooltip']
?>" type="button" onclick="<?php echo $jsSet;
?>" title="<?php echo $d['titleset'];
?>"><span class="<?php echo
$this->s['i']['ok']
?>"></span></button>
		<button class="<?php echo
$d['s']['c']['btn.btn-danger'] ?> tip
<?php echo $d['s']['c']['hastooltip']
?> <?php echo
$d['s']['c']['pull-right'] ?>"
type="button" onclick="<?php echo $jsClear; ?>"
title="<?php echo $d['titleclear'];
?>"><span class="<?php echo
$this->s['i']['clear']
?>"></span></button>
	</div>
</div>
layouts/form_search.php000064400000007504151167552070011264
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;
$d['paramname'] = str_replace('_', '',
$d['param']);
$jsSet = 'phChangeSearch(\'' . $d['param'] .
'\', jQuery(\'#' . $d['id'] . '
input[name=&quot;' . $d['paramname'] .
'&quot;]\').val(), 1, \'text\', 1);';
$jsClear = 'phClearField(\'#' . $d['id'] .
$d['paramname'] . '\');phChangeSearch(\'' .
$d['param'] . '\', \'\', 0,
\'text\', 1);';
$displayData = null;
$checkedAll = '';
$checkedFilter = '';

$js = ' ' . "\n";
$js .= 'jQuery(document).ready(function(){' . "\n";
$js .= '   jQuery("#' . $d['id'] .
$d['paramname'] . '").keyup(function(event){' .
"\n";
$js .= '      if(event.keyCode == 13){' . "\n";
$js .= '         jQuery("#' . $d['id'] .
$d['paramname'] . 'Btn' . '").click();'
. "\n";
$js .= '      }' . "\n";
$js .= '   });' . "\n";
$js .= '});' . "\n";
$js .= ' ' . "\n";
$document = JFactory::getDocument();
$document->addScriptDeclaration($js);

if (isset($d['activefilter']) &&
$d['activefilter']) {
    $checkedFilter = 'checked';
} else {
    $checkedAll = 'checked';
}

?>
<div class="input-group">

<?php if ($d['display_inner_icon'] == 1) { ?>

    <div class="inner-addon right-addon"><i
class="<?php echo
$d['s']['i']['search']
?>"></i><input type="text"
class="<?php echo
$d['s']['c']['form-control'] ?>"
name="<?php echo $d['paramname']; ?>"
placeholder="<?php echo JText::_($d['placeholder_text']);
?>" value="<?php echo $d['getparams'];
?>" id="<?php echo $d['id'] .
$d['paramname']; ?>"/></div>

<?php } else { ?>
    <input type="text" class="<?php echo
$d['s']['c']['form-control'] ?>"
name="<?php echo $d['paramname']; ?>"
placeholder="<?php echo JText::_($d['placeholder_text']);
?>" value="<?php echo $d['getparams'];
?>" id="<?php echo $d['id'] .
$d['paramname']; ?>" aria-label="<?php echo
JText::_('COM_PHOCACART_SEARCH'); ?>" />

<?php } ?>

<?php if ($d['hide_buttons'] == 1) { ?>
    <div style="display:none">
<?php } ?>

        <span class="input-group-btn">
        <button class="<?php echo
$d['s']['c']['btn.btn-success'] ?> tip
<?php echo $d['s']['c']['hastooltip']
?>" type="button" onclick="<?php echo $jsSet;
?>" title="<?php echo
JText::_('COM_PHOCACART_SEARCH'); ?>"
aria-label="<?php echo JText::_('COM_PHOCACART_SEARCH');
?>" id="<?php echo $d['id'] .
$d['paramname'] . 'Btn'; ?>"><span
class="<?php echo
$d['s']['i']['search']
?>"></span></button><button class="<?php
echo $d['s']['c']['btn.btn-danger'] ?> tip
<?php echo $d['s']['c']['hastooltip']
?>" type="button" onclick="<?php echo $jsClear;
?>" title="<?php echo
JText::_('COM_PHOCACART_CLEAR'); ?>"
aria-label="<?php echo JText::_('COM_PHOCACART_CLEAR');
?>"><span class="<?php echo
$d['s']['i']['clear']
?>"></span></button></span>

<?php if ($d['hide_buttons'] == 1) { ?>
    </div>
<?php } ?>

</div>


<?php if ($d['search_options'] == 1) { ?>
    <div class="radio ph-search-radio
ph-radio-container"><label><input type="radio"
name="phOptionSearchProducts" id="<?php echo
$d['id']; ?>SearchAllProducts"
value="phOptionSearchAllProducts" <?php echo $checkedAll;
?>><?php echo
JText::_('COM_PHOCACART_SEARCH_ALL_PRODUCTS'); ?><span
class="ph-radio-checkmark"></span></label>
    </div>

    <div class="radio ph-search-radio
ph-radio-container"><label><input type="radio"
name="phOptionSearchProducts" id="<?php echo
$d['id']; ?>SearchFilteredProducts"
value="phOptionSearchFilteredProducts" <?php echo
$checkedFilter; ?>><?php echo
JText::_('COM_PHOCACART_SEARCH_FILTERED_PRODUCTS'); ?><span
class="ph-radio-checkmark"></span></label>
    </div>
<?php } ?>




layouts/form_search_active_parameters.php000064400000007575151167552070015052
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d 				    = $displayData;
$filterItems        = 0;
$clearFilterLink    = JRoute::_(PhocacartRoute::getItemsRoute());

$price  = new PhocacartPrice();
$price->setPrefix('');
$price->setSuffix('');

if (!empty($d['f'])) {
    foreach ($d['f'] as $k => $v) {

        if ($k == 'price') {

            if ((isset($v['from']) &&
$v['from'] !== '') || (isset($v['to'])
&& $v['to'] !== '')) {


                $priceFrom  = $v['from'] !== '' ?
$price->getPriceFormat($v['from']) : '';
                $priceTo    = $v['to'] !== '' ?
$price->getPriceFormat($v['to']) : '';

                $title = JText::_('COM_PHOCACART_PRICE') .
': ' . $priceFrom . ' - ' . $priceTo;

                echo '<span class="' .
$d['s']['c']['label.label-info'] . '
ph-label-close">';
                echo '<a href="#"
onclick="event.preventDefault();
phClearField(\'#phPriceFromTopricefrom\');
phClearField(\'#phPriceFromTopriceto\');
phChangeFilter(\'price_from\', \'\', 0,
\'text\',1, 1, 2); phChangeFilter(\'price_to\',
\'\', 0, \'text\',1, 0, 2);">' . $title .
' <i class="' .
$d['s']['i']['remove-circle'] . '
ph-label-close-remove"></i></a>';
                echo '</span>';

                $filterItems = 1;
            }

        } else {

            if (!empty($v)) {

                foreach ($v as $k2 => $v2) {

                    if (isset($v2['parameteralias']) &&
isset($v2['alias']) && isset($v2['title'])
&& $v2['parameteralias'] != '' &&
$v2['alias'] != '' && $v2['title'] !=
'') {
                        $title = $v2['title'];
                        if (isset($v2['parametertitle'])
&& $v2['parametertitle'] != '') {
                            switch ($v2['parametertitle']) {
                                case 'category':
                                    $titlePrefix =
JText::_('COM_PHOCACART_CATEGORY');
                                break;
                                case 'tag':
                                    $titlePrefix =
JText::_('COM_PHOCACART_TAG');
                                break;
                                case 'label':
                                    $titlePrefix =
JText::_('COM_PHOCACART_LABEL');
                                break;
                                case 'manufacturer':
                                    $titlePrefix =
JText::_('COM_PHOCACART_MANUFACTURER');

                                break;
                                default:
                                    $titlePrefix =
$v2['parametertitle'];

                                break;

                            }
                            $title = $titlePrefix . ': ' .
$title;

                        }

                        echo '<span class="' .
$d['s']['c']['label.label-info'] . '
ph-label-close">';
                        echo '<a href="#"
onclick="event.preventDefault(); phChangeFilter(\'' .
$v2['parameteralias'] . '\', \'' .
$v2['alias'] . '\', this, \'checked\',0, 0,
2);">' . $title . ' <i class="' .
$d['s']['i']['remove-circle'] . '
ph-label-close-remove"></i></a>';
                        echo '</span>';

                        $filterItems = 1;
                    }
                }
            }
        }
    }
}

if ($filterItems == 1) {

    echo '<span class="' .
$d['s']['c']['label.label-danger'] . '
ph-label-close">';
    echo '<a onclick="startFullOverlay(1)"
href="' . JRoute::_($clearFilterLink) . '">' .
JText::_('COM_PHOCACART_CLEAR_ALL'). ' <i
class="' .
$d['s']['i']['remove-circle'] . '
ph-label-close-remove"></i></a>';
    echo '</span>';

}
layouts/gift_voucher.php000064400000037026151167552070011462
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license   http://www.gnu.org/copyleft/gpl.html GNU/GPL, see
LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license   http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */

 /*
 * +-------------------------------------------+
 * |        TYPE      |      FORMAT            |
 * +------------------+------------------------+
 * |                  |  html - HTML/SITE      |
 * |                  |  pdf - PDF             |
 * |                  |  mail - Mail           |
 * +------------------+------------------------+
 */

use Joomla\CMS\HTML\HTMLHelper;

defined('_JEXEC') or die();
$d               = $displayData;

$color1 = '#A3464B';// Main
$color2 = '#272728';// Secondary

// START EXAMPLES CODE
$color1Eats = '#7A5E51';
$color1Moments = '#F39A3D';
$color1Student = '#745a75';

if ($d['gift_class_name'] == 'eats') {$color1 =
$color1Eats;}
if ($d['gift_class_name'] == 'moments') {$color1 =
$color1Moments;}
if ($d['gift_class_name'] == 'student') {$color1 =
$color1Student;}
// END EXAMPLES CODE

$cs = array();
$cs['ph-gift-voucher-box'] 			= 'background: #ffffff;
border: 3px dashed #252A34;, box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
position: relative; padding: 0.5em;';
$cs['ph-gift-voucher-scissors'] 	= 'color: #000000;
position: absolute; bottom: -0.80em; right: 1em; font-size: 1.5em;';
$cs['ph-gift-voucher-body'] 		= 'background:
'.$color1.'; display:flex; width:100%;';
$cs['ph-gift-voucher-image-box'] 	= 'width: 100%; ';
$cs['ph-gift-voucher-image'] 		= 'object-fit: cover; width:
100%; height: 200px;';
$cs['ph-gift-voucher-title'] 		= ' color: #ffffff;
text-shadow: 2px 4px 3px rgba(0,0,0,0.3); font-size: 3em; font-weight:
bold; position: absolute; top: 1.5em; text-align: center; left: 0; right:
0;';
$cs['ph-gift-voucher-col1'] 		= 'color: #ffffff; width: 30%;
text-align: center; padding-top: 5%; display: flex; align-items: stretch;
justify-content: center;';
$cs['ph-gift-voucher-col2'] 		= 'color: #ffffff; width: 70%;
text-align: left; font-size: 0.7em; padding: 5%;';
$cs['ph-gift-voucher-head'] 		= 'background: #ffffff;
border-radius: 50%; width: 7em; height: 7em; margin: 1em; display: flex;
flex-direction: column; align-items: center; justify-content:
center;';
$cs['ph-gift-voucher-head-top'] 	= 'color:
'.$color1.'; font-weight: bold; text-transform: uppercase;
font-size: 1.8em; padding: 0;line-height:1;';
$cs['ph-gift-voucher-head-bottom'] 	= 'color:
'.$color2.'; font-weight: bold; text-transform: uppercase;
font-size: 1.1em;padding: 0;line-height:1;';
$cs['ph-gift-voucher-price'] 		= 'color: #ffffff;
text-align: center; font-weight: bold; font-size: 2.6em;margin: 0.2em
0;';
$cs['ph-gift-voucher-code'] 		= 'color:
'.$color2.';background-color: #ffffff; text-align: center;
font-weight: bold; font-size: 2.6em;margin: 0.2em 0; padding:0.5em;';
$cs['ph-gift-voucher-from']	= '';
$cs['ph-gift-voucher-to']	= '';
$cs['ph-gift-voucher-date-to']	= '';
$cs['ph-gift-voucher-message']	= '';
$cs['ph-gift-voucher-description']	= '';

// SET EMPTY INLINE STYLES AS DEFAULT
$s = array();
foreach ($cs as $k => $v) {
	$s[$k] = '';
}
// SET CLASS NAMES
foreach($cs as $k => $v) {
	$c[$k] = $k;
}



// RENDER CSS IN STYLE TAG FOR HTML
if ($d['format'] == 'html') {
	echo '<style>';

	foreach($cs as $k => $v) {
		echo '.'.$k.' {'.$v.'}' . "\n";
	}

	// START EXAMPLES CODE
	// Dynamic change of design of gift voucher in HTML
	// EXAMPLES - Eats
	echo '
	.eats .ph-gift-voucher-body {background: '.$color1Eats.';}
	.eats .ph-gift-voucher-head-top {color:
'.$color1Eats.';}';

	// EXAMPLES - moments
	echo '
	.moments .ph-gift-voucher-body {background:
'.$color1Moments.';}
	.moments .ph-gift-voucher-head-top {color:
'.$color1Moments.';}';

	// EXAMPLES - student
	echo '
	.student .ph-gift-voucher-body {background:
'.$color1Student.';}
	.student .ph-gift-voucher-head-top {color:
'.$color1Student.';}';
	// END EXAMPLES CODE

	echo '</style>';
}


// FIX image paths MAIL
$d['gift_description'] 	= str_replace('src="',
'src="'. JURI::root(), $d['gift_description']);
$d['gift_image'] 		= JURI::root() .  $d['gift_image'];

// ------------------------
// |     HTML | EMAIL     |
// ------------------------
if ($d['format'] == 'html' || $d['format'] ==
'mail') {


	if ($d['format'] == 'mail') {




		// Specific case for mail
		// IMAGE - in html we use standard image because of chaning the image
with help of javascript
		// MAIL - in mail we use background image because mail clients do not use
negative margins
		$cs['ph-gift-voucher-title'] 		= ' color: #ffffff;
text-shadow: 2px 4px 3px rgba(0,0,0,0.3); font-size: 4em; font-weight:
bold; text-align: center; padding-top: 2.5em;padding-bottom:2.5em;
background: url('.$d['gift_image'].');
background-repeat: no-repeat; background-size: cover;';
		$cs['ph-gift-voucher-head'] 		= 'background: #ffffff;
border-radius: 50%; width: 10em; height: 10em; margin: auto;';
		$cs['ph-gift-voucher-head-top'] 	= 'color:
'.$color1.'; font-weight: bold; text-transform: uppercase;
font-size: 2em; text-align: center;padding-top:1em;';
		$cs['ph-gift-voucher-head-bottom'] 	= 'color:
'.$color2.'; font-weight: bold; text-transform: uppercase;
font-size: 1.3em; text-align: center;';

		// Inline styles for mail
		foreach ($cs as $k => $v) {
			$s[$k] = ' style="'.$v.'"';
		}

	}

	echo '<div'.$s['ph-gift-voucher-box'].'
class="phAOGiftType '.$c['ph-gift-voucher-box'].'
'.$d['gift_class_name'].'">';

	echo '<span'.$s['ph-gift-voucher-scissors'].'
class="'.$c['ph-gift-voucher-scissors'].'">&#9986;</span>'.
"\n";

	if ($d['gift_image'] != '' &&
$d['format'] == 'html') {
		echo '<div'.$s['ph-gift-voucher-image-box'].'
class="'.$c['ph-gift-voucher-image-box'].'">';
		echo '<img'.$s['ph-gift-voucher-image'].'
class="phAOGiftImage
'.$c['ph-gift-voucher-image'].'"
src="'.$d['gift_image'].'" alt=""
/>';
		echo '</div>';
	}

	if ($d['gift_title'] != '') {
		echo '<div'.$s['ph-gift-voucher-title'].'
class="'.$c['ph-gift-voucher-title'].'
phAOGiftTitle">' .
$d['gift_title'].'</div>'. "\n";
	}

	echo '<div'.$s['ph-gift-voucher-body'].'
class="'.$c['ph-gift-voucher-body'].'">'.
"\n";

	echo '<div'.$s['ph-gift-voucher-col1'].'
class="'.$c['ph-gift-voucher-col1'].'">'.
"\n";

	echo '<div'.$s['ph-gift-voucher-head'].'
class="'.$c['ph-gift-voucher-head'].'">'.
"\n";
	echo '<div'.$s['ph-gift-voucher-head-top'].'
class="'.$c['ph-gift-voucher-head-top'].'">'.JText::_('COM_PHOCACART_TXT_GIFT_VOUCHER_GIFT').'</div>';
	echo
'<div'.$s['ph-gift-voucher-head-bottom'].'
class="'.$c['ph-gift-voucher-head-bottom'].'">'.JText::_('COM_PHOCACART_TXT_GIFT_VOUCHER_VOUCHER').'</div>';
	echo '</div>';// end ph-gift-voucher-head

	echo '</div>'. "\n";// end ph-gift-voucher-col1

	echo '<div'.$s['ph-gift-voucher-col2'].'
class="'.$c['ph-gift-voucher-col2'].'">'.
"\n";

	if ($d['gift_description'] != '') {
		echo
'<div'.$s['ph-gift-voucher-description'].'
class="'.$c['ph-gift-voucher-description'].'
phAOGiftDescription">'.$d['gift_description'].'</div>'.
"\n";
	}

	echo '<div'.$s['ph-gift-voucher-price'].'
id="phItemPriceGiftBox'. $d['typeview'] .
(int)$d['product_id'].'"
class="'.$c['ph-gift-voucher-price'].'">'
. $d['discount'].'</div>'. "\n";

	if ($d['gift_sender_name'] != '') {
		echo '<div'.$s['ph-gift-voucher-from'].'
class="'.$c['ph-gift-voucher-from'].'">'.JText::_('COM_PHOCACART_FROM').':
<span
class="phAOSenderName">'.$d['gift_sender_name'].'</span></div>'.
"\n";
	}
	if ($d['gift_recipient_name'] != '') {
		echo '<div'.$s['ph-gift-voucher-to'].'
class="'.$c['ph-gift-voucher-to'].'">'.JText::_('COM_PHOCACART_TO').':
 <span
class="phAORecipientName">'.$d['gift_recipient_name'].'</span></div>'.
"\n";
	}
	if ($d['gift_sender_message'] != '') {
		echo '<div'.$s['ph-gift-voucher-message'].'
class="'.$c['ph-gift-voucher-message'].'
phAOSenderMessage">'.$d['gift_sender_message'].'</div>'.
"\n";
	}

	if ($d['code'] != '') {
		echo '<div'.$s['ph-gift-voucher-code'].'
class="'.$c['ph-gift-voucher-code'].'
phAOGiftCode">'.$d['code'].'</div>'.
"\n";
	}

	if ($d['valid_to'] != '') {
		echo '<div'.$s['ph-gift-voucher-date-to'].'
class="'.$c['ph-gift-voucher-date-to'].'">'.JText::_('COM_PHOCACART_VALID_TILL').':
<span
class="phAOGiftDate">'.$d['valid_to'].'</span></div>'.
"\n";
	}

	echo '</div>'. "\n";// end ph-gift-voucher-col2
	echo '</div>'. "\n"; // end
ph-gift-voucher-body
	echo '</div>'. "\n"; // end ph-gift-voucher-box
}

// -----------------
// |     PDF      |
// -----------------
if ($d['format'] == 'pdf') {



	$cs['ph-gift-voucher-box'] 			= 'border: 1px dashed
#252A34;';
	$cs['ph-gift-voucher-scissors'] 	= '';
	$cs['ph-gift-voucher-body'] 		= 'color:
#fff;background-color: '.$color1.';';
	$cs['ph-gift-voucher-image-box'] 	= '';
	$cs['ph-gift-voucher-image'] 		= '';
	$cs['ph-gift-voucher-title'] 		= 'font-size:
18px;text-align:center;font-weight: bold; color: #ffffff;';
	$cs['ph-gift-voucher-col1'] 		= 'width: 30%;';
	$cs['ph-gift-voucher-col2'] 		= 'width: 70%;';
	$cs['ph-gift-voucher-head'] 		= 'text-align:
center;';
	$cs['ph-gift-voucher-head-top'] 	= 'color:
'.$color1.'; font-weight: bold; text-transform: uppercase;
font-size: 13px;';
	$cs['ph-gift-voucher-head-bottom'] 	= 'color:
'.$color2.'; font-weight: bold; text-transform: uppercase;
font-size: 11px;';
	$cs['ph-gift-voucher-price'] 		= 'color: #ffffff;
text-align: center; font-weight: bold; font-size: 14px;';
	$cs['ph-gift-voucher-code'] 		= 'color:
'.$color2.';background-color: #ffffff; text-align: center;
font-weight: bold; font-size: 14px;';

	if ($d['format'] == 'mail' || $d['format']
== 'pdf') {
		foreach ($cs as $k => $v) {
			$s[$k] = ' style="'.$v.'"';
		}
	}



	echo '<div nobr="true">';

	$svgScissors= '<svg xmlns="http://www.w3.org/2000/svg"
width="100" height="60"
xmlns:v="https://vecta.io/nano"><path d="M98.031
14.192c-4.319-5.182-12.083-4.976-17.876-2.727L43.761
25.227c-10.613-5.766-21.078-4.075-21.086-6.898-.007-2.206 2.021-1.729
1.701-7.473-.307-5.515-6.078-9.579-11.519-9.201C7.411 1.639 1.78 5.828
1.748 11.582 1.36 17.379 6.25 22.748 12.016 23.11c6.757.986 18.705-3.141
24.345 6.897-4.158 7.724-11.574 7.767-18.281 7.401-5.568-.304-12.25
1.311-14.889 6.791-2.55 5.252-.012 12.709 5.884 14.297 5.952 2.164
14.109-.617 15.503-7.458 1.074-5.273-2.664-7.738-1.237-9.655 1.077-1.447
7.943-.631 20.155-6.159L82.99 49.015c4.989 1.377 11.081 1.312
15.482-3.602l-40.95-15.341 40.51-15.88zM16.784 6c5.753 3.19 5.309
11.89-.654 13.592-5.392 1.895-12.303-3.331-10.6-9.185.994-4.803 7.316-6.59
11.254-4.407zm.355 35.568c5.999 2.195 5.012 12.338-1.079 13.719-4.038
1.415-9.822-.587-10.245-5.347-.805-5.788 5.984-11.039
11.324-8.372z"/></svg>';

	$params =
$d['pdf_instance']->serializeTCPDFtagParameters(array('@'
. $svgScissors, $x='', $y='', $w='6',
$h='4', $link='', $align='L',
$palign='L', $border=0, $fitonpage=true));
	echo '<div style="text-align:center"><tcpdf
style="text-align:center;" method="ImageSVG"
params="'.$params.'" /></div>';


	echo '<table
cellpadding="5"><tr><td'.$s['ph-gift-voucher-box'].'
class="phAOGiftType '.$c['ph-gift-voucher-box'].'
'.$d['gift_class_name'].'">';

	if ($d['gift_image'] != '') {
		echo '<div'.$s['ph-gift-voucher-image-box'].'
class="'.$c['ph-gift-voucher-image-box'].'">';


		$params =
$d['pdf_instance']->serializeTCPDFtagParameters(array($d['gift_image'],
$x='', $y='', $w='', $h='',
$type='', $link='', $align='', $resize=true,
$dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0,
$fitbox='CM', $hidden=false, $fitonpage=true, $alt=false,
$altimgs=array()));
		echo '<div style="text-align:center"><tcpdf
style="text-align:center;" method="Image"
params="'.$params.'" /></div>';
		echo '</div>';
		echo '<tcpdf method="setPageMark" params=""
/>';


		$html = '<div'.$s['ph-gift-voucher-title'].'
class="'.$c['ph-gift-voucher-title'].'
phAOGiftTitle">' .
$d['gift_title'].'</div>';
		$params =
$d['pdf_instance']->serializeTCPDFtagParameters(array($w='',
$h='', $x='', $y='', $html, $border=0, $ln=1,
$fill=false, $reseth=true, $align='C', $autopadding=true));
		echo '<div style="font-size:
6px">&nbsp;</div>';
		echo '<div style="text-align:center"><tcpdf
style="text-align:center;" method="writeHTMLCell"
params="'.$params.'" /></div>';
		echo '<div style="font-size:
6px">&nbsp;</div>';


		echo
'<table><tr'.$s['ph-gift-voucher-body'].'
class="'.$c['ph-gift-voucher-body'].'">'.
"\n";

		echo '<td'.$s['ph-gift-voucher-col1'].'
class="'.$c['ph-gift-voucher-col1'].'">'.
"\n";

		$svg = '<svg width="80"
height="80"><circle cx="40" cy="40"
r="35" fill="white" /></svg>';
		$params =
$d['pdf_instance']->serializeTCPDFtagParameters(array('@'
. $svg, $x='', $y='', $w='', $h='',
$link='', $align='', $palign='', $border=0,
$fitonpage=true));
		echo '<div style="text-align:center"><tcpdf
style="text-align:center;" method="ImageSVG"
params="'.$params.'" /></div>';
		echo '<div'.$s['ph-gift-voucher-head'].'
class="'.$c['ph-gift-voucher-head'].'"><div
style="font-size: 10px">&nbsp;</div>'.
"\n";
		echo '<div'.$s['ph-gift-voucher-head-top'].'
class="'.$c['ph-gift-voucher-head-top'].'">'.JText::_('COM_PHOCACART_TXT_GIFT_VOUCHER_GIFT').'</div>';
		echo
'<div'.$s['ph-gift-voucher-head-bottom'].'
class="'.$c['ph-gift-voucher-head-bottom'].'">'.JText::_('COM_PHOCACART_TXT_GIFT_VOUCHER_VOUCHER').'</div>';
		echo '</div>';// end ph-gift-voucher-head

		echo '</td>'. "\n";// end ph-gift-voucher-col1


		echo '<td'.$s['ph-gift-voucher-col2'].'
class="'.$c['ph-gift-voucher-col2'].'">'.
"\n";

		echo '<div>&nbsp;</div>';

		if ($d['gift_description'] != '') {
			$description =
PhocacartText::removeFirstTag($d['gift_description']);
			echo
'<div'.$s['ph-gift-voucher-description'].'
class="'.$c['ph-gift-voucher-description'].'
phAOGiftDescription">'.$description.'</div>'.
"\n";
		}

		echo '<div'.$s['ph-gift-voucher-price'].'
id="phItemPriceGiftBox'. $d['typeview'] .
(int)$d['product_id'].'"
class="'.$c['ph-gift-voucher-price'].'">'
. $d['discount'].'</div>'. "\n";

		if ($d['gift_sender_name'] != '') {
			echo '<div'.$s['ph-gift-voucher-from'].'
class="'.$c['ph-gift-voucher-from'].'">'.JText::_('COM_PHOCACART_FROM').':
<span
class="phAOSenderName">'.$d['gift_sender_name'].'</span></div>'.
"\n";
		}
		if ($d['gift_recipient_name'] != '') {
			echo '<div'.$s['ph-gift-voucher-to'].'
class="'.$c['ph-gift-voucher-to'].'">'.JText::_('COM_PHOCACART_TO').':
 <span
class="phAORecipientName">'.$d['gift_recipient_name'].'</span></div>'.
"\n";
		}
		if ($d['gift_sender_message'] != '') {
			echo '<div'.$s['ph-gift-voucher-message'].'
class="'.$c['ph-gift-voucher-message'].'
phAOSenderMessage">'.$d['gift_sender_message'].'</div>'.
"\n";
		}

		if ($d['code'] != '') {
			echo '<div'.$s['ph-gift-voucher-code'].'
class="'.$c['ph-gift-voucher-code'].'
phAOGiftCode">'.$d['code'].'</div>'.
"\n";
		}

		if ($d['valid_to'] != '') {
			echo '<div'.$s['ph-gift-voucher-date-to'].'
class="'.$c['ph-gift-voucher-date-to'].'">'.JText::_('COM_PHOCACART_VALID_TILL').':
<span
class="phAOGiftDate">'.$d['valid_to'].'</span></div>'.
"\n";
		}
		echo '<div>&nbsp;</div>';

		echo '</td>'. "\n";// end ph-gift-voucher-col2


		echo '</tr></table>';// end ph-gift-voucher-body
	}

	echo '</td></tr></table>'. "\n"; //
end ph-gift-voucher-box

	$params =
$d['pdf_instance']->serializeTCPDFtagParameters(array('@'
. $svgScissors, $x='', $y='', $w='6',
$h='4', $link='', $align='R',
$palign='R', $border=0, $fitonpage=true));
	echo '<div style="text-align:right"><tcpdf
style="text-align:right;" method="ImageSVG"
params="'.$params.'" /></div>';

	echo '</div>';// end no br

}
?>
layouts/icon_checkout_status.php000064400000001754151167552070013215
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;
// $d['number'];
// $d['suffix'];
// $d['status']; // 'finished' or 'pending'
// $d['type']; // parameter checkout_icon_status

$d['icon'] 	= $d['status'] == 'finished' ?
'ok' : 'not-ok';
$d['class']	=
$d['s']['i'][$d['icon']].
strip_tags($d['suffix']).'
ph-checkout-icon-'.$d['status'];

if ($d['type'] == 1) {

?><div class="<?php echo
$d['s']['c']['pull-right'] ?>">
	<span class="ph-checkout-icon-spec-<?php echo
$d['status'];?>"><?php echo
$d['number'];?></span>
</div><?php

} else {

?><div class="<?php echo
$d['s']['c']['pull-right'] ?>">
	<span class="<?php echo $d['class'];
?>"></span>
</div><?php

}
layouts/image.php000064400000007631151167552070010057 0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;


if ($d['t']['display_webp_images'] == 1) {

    echo '<picture>';
    echo ' <source type="image/webp"';
    echo isset($d['srcset-webp']) ? '
srcset="'.$d['srcset-webp'].'"' : '
srcset=""';
    echo isset($d['alt-value']) ? '
alt="'.$d['alt-value'].'"' : '
alt=""';
    //echo isset($d['class']) && $d['class'] !=
'' ? '
class="'.$d['class'].'"' : '';
// TEST
    //echo isset($d['style']) && $d['style'] !=
'' ? '
style="'.$d['style'].'"' : '';
// TEST
    echo isset($d['data-image']) &&
$d['data-image'] != '' ? '
data-image="'.$d['data-image'].'"' :
'';

    echo isset($d['data-image-small']) &&
$d['data-image-small'] != '' ? '
data-image-small="'.$d['data-image-small'].'"'
: '';
    echo isset($d['data-image-medium']) &&
$d['data-image-medium'] != '' ? '
data-image-medium="'.$d['data-image-medium'].'"'
: '';
    echo isset($d['data-image-large']) &&
$d['data-image-large'] != '' ? '
data-image-large="'.$d['data-image-large'].'"'
: '';
    echo isset($d['data-image-original']) &&
$d['data-image-original'] != '' ? '
data-image-original="'.$d['data-image-original'].'"'
: '';
    //echo isset($d['data-image-meta']) &&
$d['data-image-meta'] != '' ? '
data-image-meta="'.$d['data-image-meta'].'"'
: '';// Display only once in img tag
    echo '/>';

    echo ' <img';
    echo isset($d['src']) ? '
src="'.$d['src'].'"' : '
src=""';
    //echo isset($d['src']) ? '
srcset="'.$d['src'].'"' : '
srcset=""';
    echo isset($d['alt-value']) ? '
alt="'.$d['alt-value'].'"' : '
alt=""';
    echo isset($d['class']) && $d['class'] !=
'' ? '
class="'.$d['class'].'"' :
'';
    echo isset($d['style']) && $d['style'] !=
'' ? '
style="'.$d['style'].'"' :
'';
    echo isset($d['data-image']) &&
$d['data-image'] != '' ? '
data-image="'.$d['data-image'].'"' :
'';

    echo isset($d['data-image-small']) &&
$d['data-image-small'] != '' ? '
data-image-small="'.$d['data-image-small'].'"'
: '';
    echo isset($d['data-image-medium']) &&
$d['data-image-medium'] != '' ? '
data-image-medium="'.$d['data-image-medium'].'"'
: '';
    echo isset($d['data-image-large']) &&
$d['data-image-large'] != '' ? '
data-image-large="'.$d['data-image-large'].'"'
: '';
    echo isset($d['data-image-original']) &&
$d['data-image-original'] != '' ? '
data-image-original="'.$d['data-image-original'].'"'
: '';
    echo isset($d['data-image-meta']) &&
$d['data-image-meta'] != '' ? '
data-image-meta="'.$d['data-image-meta'].'"'
: '';
    echo '/>';

    echo '</picture>';


} else {
    echo '<img';
    echo isset($d['src']) ? '
src="'.$d['src'].'"' : '
src=""';
    echo isset($d['alt-value']) ? '
alt="'.$d['alt-value'].'"' : '
alt=""';
    echo isset($d['class']) && $d['class'] !=
'' ? '
class="'.$d['class'].'"' :
'';
    echo isset($d['style']) && $d['style'] !=
'' ? '
style="'.$d['style'].'"' :
'';
    echo isset($d['data-image']) &&
$d['data-image'] != '' ? '
data-image="'.$d['data-image'].'"' :
'';

    echo isset($d['data-image-small']) &&
$d['data-image-small'] != '' ? '
data-image-small="'.$d['data-image-small'].'"'
: '';
    echo isset($d['data-image-medium']) &&
$d['data-image-medium'] != '' ? '
data-image-medium="'.$d['data-image-medium'].'"'
: '';
    echo isset($d['data-image-large']) &&
$d['data-image-large'] != '' ? '
data-image-large="'.$d['data-image-large'].'"'
: '';
    echo isset($d['data-image-original']) &&
$d['data-image-original'] != '' ? '
data-image-original="'.$d['data-image-original'].'"'
: '';
    echo isset($d['data-image-meta']) &&
$d['data-image-meta'] != '' ? '
data-image-meta="'.$d['data-image-meta'].'"'
: '';
    echo '/>';
}
?>
layouts/index.html000064400000000054151167552070010251
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>layouts/items_grid.php000064400000012752151167552070011123
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$layoutI	= new JLayoutFile('product_image', null,
array('component' => 'com_phocacart'));
$layoutP	= new JLayoutFile('product_price', null,
array('component' => 'com_phocacart'));
$layoutAB	= new JLayoutFile('attribute_options_box', null,
array('component' => 'com_phocacart'));
$layoutV	= new JLayoutFile('button_product_view', null,
array('component' => 'com_phocacart'));
$layoutPFS	= new JLayoutFile('form_part_start_add_to_cart_list',
null, array('component' => 'com_phocacart'));
$layoutPFE	= new JLayoutFile('form_part_end', null,
array('component' => 'com_phocacart'));
$layoutA	= new JLayoutFile('button_add_to_cart_list', null,
array('component' => 'com_phocacart'));
$layoutA2	= new JLayoutFile('button_buy_now_paddle', null,
array('component' => 'com_phocacart'));
$layoutA3	= new JLayoutFile('button_external_link', null,
array('component' => 'com_phocacart'));
$layoutA4 	= new JLayoutFile('button_quickview', null,
array('component' => 'com_phocacart'));
$layoutBSH	= new JLayoutFile('button_submit_hidden', null,
array('component' => 'com_phocacart'));
$layoutQ	= new JLayoutFile('button_ask_question', null,
array('component' => 'com_phocacart'));

$d 		= $displayData;
$t		= $d['t'];
$s      = $d['s'];
$col    = $d['col'];

echo '<div
class="'.$s['c']['row-item'].'
'.$s['c']["col.xs12.sm{$col}.md{$col}"].'">';
echo '<div class="ph-item-box
'.$d['lt'].'">';

if (!empty($d['labels'])) { echo '<div
class="ph-label-box">' . $d['labels'] .
'</div>';}

echo '<div
class="'.PhocacartRenderFront::completeClass(array($s['c']['thumbnail'],
'ph-thumbnail', 'ph-thumbnail-c', 'ph-item',
$t['class_fade_in_action_icons'],
$d['lt'])).'">';
echo '<div class="ph-item-content
'.$d['lt'].'">';


echo '<div
class="'.$s['c']['cat_item_grid'].'
ph-category-action-box-icons
'.$d['lt'].'">';
// :L: IMAGE
echo '<a
href="'.$d['link'].'">';
if (!empty($d['layout']['dI'])) { echo
$layoutI->render($d['layout']['dI']);}
echo '</a>';

echo '<div
class="'.$s['c']['cat_item_btns'].'
ph-category-action-icons '.$d['lt'].'">';
if ($t['fade_in_action_icons'] == 0 &&
$t['display_action_icons'] == 1) {
    echo $d['icon']['compare']; // if set in options,
it will be displayed on other place, so this is why it is printed this way
    echo $d['icon']['wishlist'];
    echo $d['icon']['quickview'];
    echo $d['icon']['addtocart'];
}
echo '</div>';// end category_action_box_icons
echo '</div>';// end category_action_icons


echo '<div class="ph-cb"></div>';

// CAPTION, DESCRIPTION BOX
echo $d['product_header'];

// REVIEW - STAR RATING
if (!empty($d['review'])) { echo $d['review'];}

// DESCRIPTION
if (!empty($d['description'])) { echo
$d['description'];}

// TAGS
if (!empty($d['tags'])) { echo '<div
class="ph-tag-box">'  . '<span
class="ph-tag-box-header">'.JText::_('COM_PHOCACART_TAGS').
'</span>: ' .  $d['tags'] .
'</div>';}
// MANUFACTURER
if (!empty($d['manufacturer'])) { echo '<div
class="ph-manufacturer-box">'  . '<span
class="ph-manufacturer-box-header">'.JText::_('COM_PHOCACART_MANUFACTURER').
'</span>: ' .  $d['manufacturer'] .
'</div>';}


echo '<div class="ph-item-action-box ph-caption
ph-category-action-box-buttons
'.$d['lt'].'">';

// :L: PRICE
if (!empty($d['layout']['dP'])) { echo
$layoutP->render($d['layout']['dP']);}


// ACTION BUTTONS
echo '<div class="ph-category-action-buttons
'.$d['lt'].'">';

// :L: Stock status
if (!empty($d['layout']['dSO'])) { echo
$d['layout']['dSO'];}

// Start Form

if (!empty($d['layout']['dF'])) { echo
$layoutPFS->render($d['layout']['dF']);}

// :L: ATTRIBUTES AND OPTIONS
if (!empty($d['layout']['dAb'])) { echo
$layoutAB->render($d['layout']['dAb']);}

// :L: LINK TO PRODUCT VIEW
if (!empty($d['layout']['dV'])) { echo
$layoutV->render($d['layout']['dV']);}

// :L: ADD TO CART
if (!empty($d['layout']['dA'])) { echo
$layoutA->render($d['layout']['dA']);} else if
($d['icon']['addtocart'] != '') { echo
$layoutBSH->render();}

// :L: ASK A QUESTION
if (!empty($d['layout']['dQ'])) { echo
$layoutQ->render($d['layout']['dQ']);}


// End Form
if (!empty($d['layout']['dF'])) { echo
$layoutPFE->render();}

if (!empty($d['layout']['dA2'])) { echo
$layoutA2->render($d['layout']['dA2']);}
if (!empty($d['layout']['dA3'])) { echo
$layoutA3->render($d['layout']['dA3']);}
if (!empty($d['layout']['dA4'])) { echo
$layoutA4->render($d['layout']['dA4']);}


echo '</div>';// end category_action_buttons


echo $d['event']['onCategoryItemsItemAfterAddToCart'];
echo '<div class="ph-cb"></div>';

if ($t['fade_in_action_icons'] == 1 &&
$t['display_action_icons'] == 1) {

    echo '<div class="ph-category-action-box-fade-icons
'.$d['lt'].'">';
    echo '<div class="ph-item-action-fade
ph-category-action-fade-icons
'.$d['lt'].'">';
    echo $d['icon']['compare'];
    echo $d['icon']['wishlist'];
    echo $d['icon']['quickview'];
    echo $d['icon']['addtocart'];
    echo '</div>';
    echo '</div>';
}

echo '</div>';// end category_action_box_buttons



echo '</div>';// end category_row_item_box_wrap_content
echo '</div>';// end category_row_item_box_wrap
echo '</div>';// end category_row_item_box
echo '</div>';// end category_row_item_grid

echo "\n";

?>


layouts/items_gridlist.php000064400000014316151167552070012015
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$layoutI	= new JLayoutFile('product_image', null,
array('component' => 'com_phocacart'));
$layoutP	= new JLayoutFile('product_price', null,
array('component' => 'com_phocacart'));
$layoutAB	= new JLayoutFile('attribute_options_box', null,
array('component' => 'com_phocacart'));
$layoutV	= new JLayoutFile('button_product_view', null,
array('component' => 'com_phocacart'));
$layoutPFS	= new JLayoutFile('form_part_start_add_to_cart_list',
null, array('component' => 'com_phocacart'));
$layoutPFE	= new JLayoutFile('form_part_end', null,
array('component' => 'com_phocacart'));
$layoutA	= new JLayoutFile('button_add_to_cart_list', null,
array('component' => 'com_phocacart'));
$layoutA2	= new JLayoutFile('button_buy_now_paddle', null,
array('component' => 'com_phocacart'));
$layoutA3	= new JLayoutFile('button_external_link', null,
array('component' => 'com_phocacart'));
$layoutA4 	= new JLayoutFile('button_quickview', null,
array('component' => 'com_phocacart'));
$layoutBSH	= new JLayoutFile('button_submit_hidden', null,
array('component' => 'com_phocacart'));
$layoutQ	= new JLayoutFile('button_ask_question', null,
array('component' => 'com_phocacart'));

$d 		= $displayData;
$t		= $d['t'];
$s      = $d['s'];

echo '<div
class="'.$s['c']['row-item'].'
'.$s['c']["col.xs12.sm12.md12"].'
'.$d['lt'].'">';
echo '<div class="ph-item-box
'.$d['lt'].'">';

if (!empty($d['labels'])) { echo '<div
class="ph-label-box">' . $d['labels'] .
'</div>';}

//echo '<div
class="'.PhocacartRenderFront::completeClass(array($s['c']['thumbnail'],
'ph-thumbnail', 'ph-thumbnail-c', 'ph-item',
$t['class_fade_in_action_icons'],
$d['lt'])).'">';
echo '<div
class="'.$t['class_fade_in_action_icons'].'
ph-thumbnail ph-thumbnail-c ph-item
'.$d['lt'].'">';
echo '<div class="ph-item-content
'.$d['lt'].'">';



echo '<div
class="'.$s['c']['row'].'
ph-item-content-row '.$d['lt'].'">';

// 1/2
echo '<div
class="'.$s['c']['row-item'].'
'.$s['c']['col.xs12.sm6.md6'].'
'.$d['lt'].'">';
// :L: IMAGE
echo '<a
href="'.$d['link'].'">';
if (!empty($d['layout']['dI'])) { echo
$layoutI->render($d['layout']['dI']);}
echo '</a>';
echo '</div>';// end category_row_item_gridlist_inner_c1
1/2



// 2/2
echo '<div
class="'.$s['c']['row-item'].'
'.$s['c']['col.xs12.sm6.md6'].'
'.$d['lt'].'">';

// CAPTION, DESCRIPTION BOX
echo '<div class="ph-item-action-box ph-caption
'.$d['lt'].'">';

echo $d['product_header'];

// :L: PRICE
if (!empty($d['layout']['dP'])) { echo
$layoutP->render($d['layout']['dP']);}



if ($t['fade_in_action_icons'] == 0  &&
$t['display_action_icons'] == 1) {
    echo '<div
class="'.$s['c']['cat_item_grid'].'
ph-category-action-box-icons
'.$d['lt'].'">';
    echo '<div
class="'.$s['c']['cat_item_btns'].'
ph-category-action-icons '.$d['lt'].'">';
    echo $d['icon']['compare']; // if set in options,
it will be displayed on other place, so this is why it is printed this way
    echo $d['icon']['wishlist'];
    echo $d['icon']['quickview'];
    echo $d['icon']['addtocart'];
    echo '</div>';// end category_action_box_icons
    echo '</div>';// end category_action_icons
}

// REVIEW - STAR RATING
if (!empty($d['review'])) { echo $d['review'];}

// DESCRIPTION
if (!empty($d['description'])) { echo 
$d['description'];}

// TAGS
if (!empty($d['tags'])) { echo '<div
class="ph-tag-box">'  . '<span
class="ph-tag-box-header">'.JText::_('COM_PHOCACART_TAGS').
'</span>: ' .  $d['tags'] .
'</div>';}
// MANUFACTURER
if (!empty($d['manufacturer'])) { echo '<div
class="ph-manufacturer-box">'  . '<span
class="ph-manufacturer-box-header">'.JText::_('COM_PHOCACART_MANUFACTURER').
'</span>: ' .  $d['manufacturer'] .
'</div>';}

// VIEW PRODUCT BUTTON
echo '<div class="ph-item-action-box ph-caption
ph-category-action-box-buttons
'.$d['lt'].'">';
echo '<div class="ph-category-action-buttons
'.$d['lt'].'">';

// :L: Stock status
if (!empty($d['layout']['dSO'])) { echo
$d['layout']['dSO'];}

// Start Form
if (!empty($d['layout']['dF'])) { echo
$layoutPFS->render($d['layout']['dF']);}

// :L: ATTRIBUTES AND OPTIONS
if (!empty($d['layout']['dAb'])) { echo
$layoutAB->render($d['layout']['dAb']);}

// :L: LINK TO PRODUCT VIEW
if (!empty($d['layout']['dV'])) { echo
$layoutV->render($d['layout']['dV']);}

// :L: ADD TO CART
if (!empty($d['layout']['dA'])) { echo
$layoutA->render($d['layout']['dA']);} else if
($d['icon']['addtocart'] != '') { echo
$layoutBSH->render();}

// :L: ASK A QUESTION
if (!empty($d['layout']['dQ'])) { echo
$layoutQ->render($d['layout']['dQ']);}

// End Form
if (!empty($d['layout']['dF'])) { echo
$layoutPFE->render();}

if (!empty($d['layout']['dA2'])) { echo
$layoutA2->render($d['layout']['dA2']);}
if (!empty($d['layout']['dA3'])) { echo
$layoutA3->render($d['layout']['dA3']);}
if (!empty($d['layout']['dA4'])) { echo
$layoutA4->render($d['layout']['dA4']);}

echo '</div>';// end category_action_buttons

echo $d['event']['onCategoryItemsItemAfterAddToCart'];

echo '<div class="ph-cb"></div>';

if ($t['fade_in_action_icons'] == 1 &&
$t['display_action_icons'] == 1) {
    echo '<div class="ph-category-action-box-fade-icons
'.$d['lt'].'">';
    echo '<div class="ph-item-action-fade
ph-category-action-fade-icons
'.$d['lt'].'">';
    echo $d['icon']['compare'];
    echo $d['icon']['wishlist'];
    echo $d['icon']['quickview'];
    echo $d['icon']['addtocart'];
    echo '</div>';
    echo '</div>';
}

echo '</div>';// end category_action_box_buttons
echo '</div>';// end
category_row_item_box_wrap_content_caption

echo '<div class="ph-cb"></div>';

echo '</div>';// end category_row_item_gridlist_inner_c2
2/2

echo '</div>';// end category_row_gridlist_inner



echo '<div class="ph-cb"></div>';


echo '</div>';// end category_row_item_box_wrap_content
echo '</div>';// end category_row_item_box_wrap
echo '</div>';// end category_row_item_box
echo '</div>';// end category_row_item_gridlist

echo "\n";

?>
layouts/items_list.php000064400000014314151167552070011145
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$layoutI	= new JLayoutFile('product_image', null,
array('component' => 'com_phocacart'));
$layoutP	= new JLayoutFile('product_price', null,
array('component' => 'com_phocacart'));
$layoutAB	= new JLayoutFile('attribute_options_box', null,
array('component' => 'com_phocacart'));
$layoutV	= new JLayoutFile('button_product_view', null,
array('component' => 'com_phocacart'));
$layoutPFS	= new JLayoutFile('form_part_start_add_to_cart_list',
null, array('component' => 'com_phocacart'));
$layoutPFE	= new JLayoutFile('form_part_end', null,
array('component' => 'com_phocacart'));
$layoutA	= new JLayoutFile('button_add_to_cart_list', null,
array('component' => 'com_phocacart'));
$layoutA2	= new JLayoutFile('button_buy_now_paddle', null,
array('component' => 'com_phocacart'));
$layoutA3	= new JLayoutFile('button_external_link', null,
array('component' => 'com_phocacart'));
$layoutA4 	= new JLayoutFile('button_quickview', null,
array('component' => 'com_phocacart'));
$layoutBSH	= new JLayoutFile('button_submit_hidden', null,
array('component' => 'com_phocacart'));
$layoutQ	= new JLayoutFile('button_ask_question', null,
array('component' => 'com_phocacart'));

$d 		= $displayData;
$t		= $d['t'];
$s      = $d['s'];


echo '<div
class="'.$s['c']['row-item'].'
'.$s['c']["col.xs12.sm12.md12"].'
'.$d['lt'].'">';
echo '<div class="ph-item-box
'.$d['lt'].'">';

if (!empty($d['labels'])) { echo '<div
class="ph-label-box">' . $d['labels'] .
'</div>';}

echo '<div
class="'.PhocacartRenderFront::completeClass(array($s['c']['thumbnail'],
'ph-thumbnail', 'ph-thumbnail-c', 'ph-item',
$t['class_fade_in_action_icons'],
$d['lt'])).'">';
echo '<div class="ph-item-content
'.$d['lt'].'">';



echo '<div
class="'.$s['c']['row'].'
'.$s['c']['cat_list'].' ph-item-content-row
'.$d['lt'].'">';

// 1/3
echo '<div
class="'.$s['c']['row-item'].'
'.$s['c']['col.xs12.sm2.md2'].'
'.$d['lt'].'">';
// :L: IMAGE
echo '<a
href="'.$d['link'].'">';
if (!empty($d['layout']['dI'])) { echo
$layoutI->render($d['layout']['dI']);}
echo '</a>';
echo '</div>';// end category_row_item_list_inner_c1 1/3

// 2/3
echo '<div
class="'.$s['c']['row-item'].'
'.$s['c']['col.xs12.sm5.md5'].'
'.$d['lt'].'">';

// CAPTION, DESCRIPTION BOX
echo '<div class="ph-item-action-box ph-caption
'.$d['lt'].'">';

echo $d['product_header'];

// DESCRIPTION
if (!empty($d['description'])) { echo
$d['description'];}

// TAGS
if (!empty($d['tags'])) { echo '<div
class="ph-tag-box">'  . '<span
class="ph-tag-box-header">'.JText::_('COM_PHOCACART_TAGS').
'</span>: ' .  $d['tags'] .
'</div>';}
// MANUFACTURER
if (!empty($d['manufacturer'])) { echo '<div
class="ph-manufacturer-box">'  . '<span
class="ph-manufacturer-box-header">'.JText::_('COM_PHOCACART_MANUFACTURER').
'</span>: ' .  $d['manufacturer'] .
'</div>';}

echo '</div>';// end
category_row_item_box_wrap_content_caption
echo '</div>';// end category_row_item_list_inner_c2 2/3

// 3/3
echo '<div
class="'.$s['c']['col.xs12.sm5.md5'].'
'.$d['lt'].'">';

// :L: PRICE
if (!empty($d['layout']['dP'])) { echo
$layoutP->render($d['layout']['dP']);}

if ($t['fade_in_action_icons'] == 0  &&
$t['display_action_icons'] == 1) {
    echo '<div
class="'.$s['c']['cat_item_grid'].'
ph-category-action-box-icons
'.$d['lt'].'">';
    echo '<div
class="'.$s['c']['cat_item_btns'].'
ph-category-action-icons '.$d['lt'].'">';
    echo $d['icon']['compare']; // if set in options,
it will be displayed on other place, so this is why it is printed this way
    echo $d['icon']['wishlist'];
    echo $d['icon']['quickview'];
    echo $d['icon']['addtocart'];
    echo '</div>';// end category_action_box_icons
    echo '</div>';// end category_action_icons
}

// REVIEW - STAR RATING
if (!empty($d['review'])) { echo $d['review'];}

// VIEW PRODUCT BUTTON
echo '<div class="ph-item-action-box ph-caption
ph-category-action-box-buttons
'.$d['lt'].'">';
echo '<div class="ph-category-action-buttons
'.$d['lt'].'">';

// :L: Stock status
if (!empty($d['layout']['dSO'])) { echo
$d['layout']['dSO'];}

// Start Form
if (!empty($d['layout']['dF'])) { echo
$layoutPFS->render($d['layout']['dF']);}

// :L: ATTRIBUTES AND OPTIONS
if (!empty($d['layout']['dAb'])) { echo
$layoutAB->render($d['layout']['dAb']);}

// :L: LINK TO PRODUCT VIEW
if (!empty($d['layout']['dV'])) { echo
$layoutV->render($d['layout']['dV']);}

// :L: ADD TO CART
if (!empty($d['layout']['dA'])) { echo
$layoutA->render($d['layout']['dA']);} else if
($d['icon']['addtocart'] != '') { echo
$layoutBSH->render();}

// :L: ASK A QUESTION
if (!empty($d['layout']['dQ'])) { echo
$layoutQ->render($d['layout']['dQ']);}

// End Form
if (!empty($d['layout']['dF'])) { echo
$layoutPFE->render();}

if (!empty($d['layout']['dA2'])) { echo
$layoutA2->render($d['layout']['dA2']);}
if (!empty($d['layout']['dA3'])) { echo
$layoutA3->render($d['layout']['dA3']);}
if (!empty($d['layout']['dA4'])) { echo
$layoutA4->render($d['layout']['dA4']);}

echo '</div>';// end category_action_buttons

echo $d['event']['onCategoryItemsItemAfterAddToCart'];


echo '<div class="ph-cb"></div>';


if ($t['fade_in_action_icons'] == 1  &&
$t['display_action_icons'] == 1) {
    echo '<div class="ph-category-action-box-fade-icons
'.$d['lt'].'">';
    echo '<div class="ph-item-action-fade
ph-category-action-fade-icons
'.$d['lt'].'">';
    echo $d['icon']['compare'];
    echo $d['icon']['wishlist'];
    echo $d['icon']['quickview'];
    echo $d['icon']['addtocart'];
    echo '</div>';
    echo '</div>';
}

echo '</div>';// end category_action_box_buttons

echo '<div class="ph-cb"></div>';

echo '</div>';// end category_row_item_gridlist_inner_c3
3/3

echo '</div>';// end category_row_gridlist_inner


echo '</div>';// end category_row_item_box_wrap_content
echo '</div>';// end category_row_item_box_wrap
echo '</div>';// end category_row_item_box
echo '</div>';// end category_row_item_list

echo "\n";
?>
layouts/link_external_link.php000064400000001233151167552070012641
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;
?>
<div class="ph-pull-right">
	<div class="ph-external-link"><?php
	if ($d['title'] != '') {
		echo '<a
href="'.$d['linkexternal'].'"
target="_blank">'.$d['title'].'</a>';
	} else {
		echo '<a
href="'.$d['linkexternal'].'"
target="_blank">'.$d['linkexternal'].'</a>';
	}
	?></div>
</div>layouts/list_compare.php000064400000005155151167552070011455
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;

if (!empty($d['compare'])) {
	foreach ($d['compare'] as $k => $v) {
		// Try to find the best menu link

		if (isset($v->catid2) && (int)$v->catid2 > 0 &&
isset($v->catalias2) && $v->catalias2 != '') {
			$linkProduct 	= JRoute::_(PhocacartRoute::getItemRoute($v->id,
$v->catid2, $v->alias, $v->catalias2));
		} else {
			$linkProduct 	= JRoute::_(PhocacartRoute::getItemRoute($v->id,
$v->catid, $v->alias, $v->catalias));
		}

?>
<div class="<?php echo
$d['s']['c']['row'] ?>">
	<div class="<?php echo
$d['s']['c']['col.xs12.sm8.md8']
?>"><a href="<?php echo $linkProduct;
?>"><?php echo $v->title; ?></a></div>
	<div class="<?php echo
$d['s']['c']['col.xs12.sm4.md4']
?>">
		<form action="<?php echo $d['linkcomparison'];
?>" method="post" id="phCompareRemove<?php echo
(int)$v->id; ?>">
			<input type="hidden" name="id"
value="<?php echo (int)$v->id; ?>">
			<input type="hidden" name="task"
value="comparison.remove">
			<input type="hidden" name="tmpl"
value="component" />
			<input type="hidden" name="option"
value="com_phocacart" />
			<input type="hidden" name="return"
value="<?php echo $d['actionbase64']; ?>" />
			<div class="<?php echo
$d['s']['c']['pull-right'] ?>">
			<?php if (isset($d['method']) &&
(int)$d['method'] > 0) { ?>
				<div class="ph-category-item-compare"><a
href="javascript:void(0)"
onclick="phItemRemoveCompareFormAjax('phCompareRemove<?php
echo (int)$v->id; ?>');" title="<?php echo
JText::_('COM_PHOCACART_REMOVE_FROM_COMPARISON_LIST');
?>"><span class="<?php echo
$d['s']['i']['remove']
?>"></span></a></div>
			<?php } else { ?>
				<div class="ph-category-item-compare"><a
href="javascript:void(0)"
onclick="document.getElementById('phCompareRemove<?php echo
(int)$v->id; ?>').submit();" title="<?php echo
JText::_('COM_PHOCACART_REMOVE_FROM_COMPARISON_LIST');
?>"><span class="<?php echo
$d['s']['i']['remove']
?>"></span></a></div>
			<?php } ?>
			</div>
		<?php echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
?>
		</form>
	</div>
</div>
<?php
	}
} else {
	echo
'<div>'.JText::_('COM_PHOCACART_COMPARISON_LIST_IS_EMPTY').'</div>';
}
?>
<div class="ph-small ph-right ph-u
ph-cart-link-compare"><a href="<?php echo
$d['linkcomparison']; ?>"><?php echo
JText::_('COM_PHOCACART_VIEW_COMPARISON_LIST');
?></a></div>
layouts/list_wishlist.php000064400000005073151167552070011674
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;

if (!empty($d['wishlist'])) {
	foreach ($d['wishlist'] as $k => $v) {
		// Try to find the best menu link
		if (isset($v->catid2) && (int)$v->catid2 > 0 &&
isset($v->catalias2) && $v->catalias2 != '') {
			$linkProduct 	= JRoute::_(PhocacartRoute::getItemRoute($v->id,
$v->catid2, $v->alias, $v->catalias2));
		} else {
			$linkProduct 	= JRoute::_(PhocacartRoute::getItemRoute($v->id,
$v->catid, $v->alias, $v->catalias));
		}

?>
<div class="<?php echo
$d['s']['c']['row'] ?>">
	<div class="<?php echo
$d['s']['c']['col.xs12.sm8.md8']
?>"><a href="<?php echo $linkProduct;
?>"><?php echo $v->title; ?></a></div>
	<div class="<?php echo
$d['s']['c']['col.xs12.sm4.md4']
?>">
		<form action="<?php echo $d['linkwishlist'];
?>" method="post" id="phWishListRemove<?php echo
(int)$v->id; ?>">
			<input type="hidden" name="id"
value="<?php echo (int)$v->id; ?>">
			<input type="hidden" name="task"
value="wishlist.remove">
			<input type="hidden" name="tmpl"
value="component" />
			<input type="hidden" name="option"
value="com_phocacart" />
			<input type="hidden" name="return"
value="<?php echo $d['actionbase64']; ?>" />
			<div class="ph-pull-right">
			<?php if (isset($d['method']) &&
(int)$d['method'] > 0) { ?>
				<div class="ph-category-item-wishlist"><a
href="javascript:void(0)"
onclick="phItemRemoveWishListFormAjax('phWishListRemove<?php
echo (int)$v->id; ?>');" title="<?php echo
JText::_('COM_PHOCACART_REMOVE_FROM_WISH_LIST');
?>"><span class="<?php echo
$d['s']['i']['remove']
?>"></span></a></div>
			<?php } else { ?>
				<div class="ph-category-item-wishlist"><a
href="javascript:void(0)"
onclick="document.getElementById('phWishListRemove<?php echo
(int)$v->id; ?>').submit();" title="<?php echo
JText::_('COM_PHOCACART_REMOVE_FROM_WISH_LIST');
?>"><span class="<?php echo
$d['s']['i']['remove']
?>"></span></a></div>
			<?php } ?>
			</div>
		<?php echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
?>
		</form>
	</div>
</div>
<?php
	}
} else {
	echo
'<div>'.JText::_('COM_PHOCACART_WISH_LIST_IS_EMPTY').'</div>';
}
?>
<div class="ph-small ph-right ph-u
ph-cart-link-wishlist"><a href="<?php echo
$d['linkwishlist']; ?>"><?php echo
JText::_('COM_PHOCACART_VIEW_WISH_LIST');
?></a></div>
layouts/order.php000064400000140252151167552070010105 0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */


/*
 * +-------------------------------------------+
 * |        TYPE      |      FORMAT            |
 * +------------------+------------------------+
 * | 1. ORDER/RECEIPT |  html - HTML/SITE      |
 * | 2. INVOICE       |  pdf - PDF             |
 * | 3. DELIVERY NOTE |  mail - Mail           |
 * | 4. RECEIPT (POS) |  rss - RSS             |
 * |                  |  raw - RAW (POS PRINT) |
 * +------------------+------------------------+
 */

defined('_JEXEC') or die();
$d = $displayData;

/*
 * Parameters
 */
$store_title						= $d['params']->get(
'store_title', '' );
$store_logo							= $d['params']->get( 'store_logo',
'' );
$store_info							= $d['params']->get( 'store_info',
'' );
$store_info							= PhocacartRenderFront::renderArticle($store_info,
$d['format']);
//$invoice_prefix					= $d['params']->get(
'invoice_prefix', '');
//$invoice_number_format			= $d['params']->get(
'invoice_number_format', '');
//$invoice_number_chars				= $d['params']->get(
'invoice_number_chars', 12);
$invoice_tp							= $d['params']->get(
'invoice_terms_payment', '');
$display_discount_price_product		= $d['params']->get(
'display_discount_price_product', 1);

$tax_calculation                    = $d['params']->get(
'tax_calculation', 0 );

$store_title_pos						= $d['params']->get(
'store_title_pos', '' );
$store_logo_pos							= $d['params']->get(
'store_logo_pos', '' );
$store_info_pos							= $d['params']->get(
'store_info_pos', '' );
$store_info_footer_pos					= $d['params']->get(
'store_info_footer_pos', '' );

// Used in Phoca PDF Phocacart plugin because of converting the TCPDF QR
code into html
//$pdf_invoice_qr_code					= $d['params']->get(
'pdf_invoice_qr_code', '' );
$pdf_invoice_signature_image			= $d['params']->get(
'pdf_invoice_signature_image', '' );
$pdf_invoice_qr_information				= $d['params']->get(
'pdf_invoice_qr_information', '' );
$invoice_global_top_desc				= $d['params']->get(
'invoice_global_top_desc', 0 );// Article ID
$invoice_global_middle_desc				= $d['params']->get(
'invoice_global_middle_desc', 0 );
$invoice_global_bottom_desc				= $d['params']->get(
'invoice_global_bottom_desc', 0 );

$order_global_top_desc					= $d['params']->get(
'order_global_top_desc', 0 );// Article ID
$order_global_middle_desc				= $d['params']->get(
'order_global_middle_desc', 0 );
$order_global_bottom_desc				= $d['params']->get(
'order_global_bottom_desc', 0 );

$dn_global_top_desc					= $d['params']->get(
'dn_global_top_desc', 0 );// Article ID
$dn_global_middle_desc				= $d['params']->get(
'dn_global_middle_desc', 0 );
$dn_global_bottom_desc				= $d['params']->get(
'dn_global_bottom_desc', 0 );

$oidn_global_billing_desc			    = $d['params']->get(
'oidn_global_billing_desc', 0 );
$oidn_global_shipping_desc			    = $d['params']->get(
'oidn_global_shipping_desc', 0 );

$display_tax_recapitulation_invoice		= $d['params']->get(
'display_tax_recapitulation_invoice', 0 );
$display_tax_recapitulation_pos			= $d['params']->get(
'display_tax_recapitulation_pos', 0 );

$display_reward_points_invoice			= $d['params']->get(
'display_reward_points_invoice', 0 );
$display_reward_points_pos				= $d['params']->get(
'display_reward_points_pos', 0 );

$display_time_of_supply_invoice			= $d['params']->get(
'display_time_of_supply_invoice', 0 );



if($d['type'] == 1 &&
$d['common']->order_number == '') {
	echo '<div class="alert alert-error
alert-danger">'.JText::_('COM_PHOCACART_ORDER_DOES_NOT_EXIST').'</div>';
	return;
}
if($d['type'] == 3 &&
$d['common']->order_number == '') {
	echo '<div class="alert alert-error
alert-danger">'.JText::_('COM_PHOCACART_DELIVERY_NOTE_NOT_YET_ISSUED').'</div>';
	return;
}
if($d['type'] == 1 &&
$d['common']->receipt_number == '') {
	echo '<div class="alert alert-error
alert-danger">'.JText::_('COM_PHOCACART_RECEIPT_NOT_YET_ISSUED').'</div>';
	return;
}
if($d['type'] == 2 &&
$d['common']->invoice_number == '') {
	echo '<div class="alert alert-error
alert-danger">'.JText::_('COM_PHOCACART_INVOICE_NOT_YET_ISSUED').'</div>';
	return;
}

if(!isset($d['bas']['b'])) {
	$d['bas']['b'] = array();
}
if(!isset($d['bas']['s'])) {
	$d['bas']['s'] = array();
}

/*
 * FORMAT
 */
// FORMAT - HTML
$box		= 'class="ph-idnr-box"';
$table 		= 'class="ph-idnr-box-in"';
$pho1 		= $pho12	= 'class="pho1"';
$pho2 		= $pho22	= 'class="pho2"';
$pho3 		= $pho32	= 'class="pho3"';
$pho4 		= $pho42	= 'class="pho4"';
$pho5 		= $pho52	= 'class="pho5"';
$pho6 		= $pho62	= 'class="pho6"';
$pho7 		= $pho72	= 'class="pho7"';
$pho6Sep 	= $pho6Sep2	= 'class="pho6 ph-idnr-sep"';
$pho7Sep 	= $pho7Sep2	= 'class="pho7 ph-idnr-sep"';
$pho8 		= $pho82	= 'class="pho8"';
$pho9 		= $pho92	= 'class="pho9"';
$pho10 		= $pho102	= 'class="pho10"';
$pho11 		= $pho112	= 'class="pho11"';
$pho12 		= $pho122	= 'class="pho12"';
$sep		= $sep2		= 'class="ph-idnr-sep"';
$bBox		= 'class="ph-idnr-billing-box"';
$bBoxIn		= 'class="ph-idnr-billing-box-in"';
$sBox		= 'class="ph-idnr-shipping-box"';
$sBoxIn		= 'class="ph-idnr-shipping-box-in"';
$boxIn 		= 'class="ph-idnr-box-in"';
$hProduct 	= 'class="ph-idnr-header-product"';
$bProduct	= 'class="ph-idnr-body-product"';
$sepH		= 'class="ph-idnr-sep-horizontal"';
$totalF		= 'class="ph-idnr-total"';
$toPayS		= 'class="ph-idnr-to-pay"';
$toPaySV	= 'class="ph-idnr-to-pay-value"';
$bDesc		= 'class="ph-idnr-body-desc"';
$hrSmall	= 'class="ph-idnr-hr-small"';
$taxRecTable= 'class="ph-idnr-tax-rec"';
$taxRecTd	= 'class="ph-idnr-tax-rec-td"';
$taxRecTdRight= 'class="ph-idnr-tax-rec-td ph-right"';
$bQrInfo	= '';
$firstRow	= '';


// POS RECEIPT
$pR 	= false;

if ($d['format'] == 'raw' &&
$d['type'] == 4) {
	$pR 	= true;
	$oPr	= array();
	$pP 	= new PhocacartPosPrint(0);


}

if ($d['format'] == 'pdf') {
	// FORMAT PDF


	// Products
	if ($tax_calculation > 0) {
		$colW = 8.3333;// 12 cols x 8.3333 = 100%
	} else {
		$colW = 11.11;// 9 cols x 11.11 = 100%
	}
	$box		= '';
	$table 		= 'style="width: 100%; font-size:
80%;padding:3px;margin-top:-200px"';
	$pho1 		= 'style="width: '.$colW.'%;"';
	$pho2 		= 'style="width: '.$colW.'%;"';
	$pho3 		= 'style="width: '.$colW.'%;"';
	$pho4 		= 'style="width: '.$colW.'%;"';
	$pho5 		= 'style="width: '.$colW.'%;"';
	$pho6 		= 'style="width: '.$colW.'%;"';
	$pho7 		= 'style="width: '.$colW.'%;"';
	$pho6Sep 	= 'style="width: 3%;"';
	$pho7Sep 	= 'style="width: 3%;"';
	$pho8 		= 'style="width: '.$colW.'%;"';
	$pho9 		= 'style="width: '.$colW.'%;"';
	$pho10 		= 'style="width: '.$colW.'%;"';
	$pho11 		= 'style="width: '.$colW.'%;"';
	$pho12 		= 'style="width: '.$colW.'%;"';
	$sep		= 'style="width: 3%;"';



	$pho12 		= 'style="width: 9%;"';
	$pho22 		= 'style="width: 9%;"';
	$pho32 		= 'style="width: 9%;"';
	$pho42 		= 'style="width: 9%;"';
	$pho52 		= 'style="width: 9%;"';
	$pho62 		= 'style="width: 9%;"';
	$pho72 		= 'style="width: 9%;"';
	$pho6Sep2 	= 'style="width: 5%;"';
	$pho7Sep2 	= 'style="width: 5%;"';
	$pho82 		= 'style="width: 9%;"';
	$pho92 		= 'style="width: 9%;"';
	$pho102 	= 'style="width: 9%;"';
	$pho112 	= 'style="width: 9%;"';
	$pho122 	= 'style="width: 9%;"';
	$seps2		= 'style="width: 10%;"';


	$bBox		= 'style="border: 1pt solid #dddddd;"';
	$bBoxIn		= 'style=""';
	$sBox		= 'style="border: 1pt solid #dddddd;"';
	$sBoxIn		= 'style=""';
	//$boxIn 		= 'style="width: 100%; font-family: sans-serif,
arial; font-size: 60%;padding:3px 1px;"';
	$boxIn 		= 'style="width: 100%; font-size: 60%;padding:1px
1px;"';
	$hProduct 	= 'style="white-space:nowrap;font-weight:
bold;background-color: #dddddd;"';
	$bProduct	= 'style="white-space:nowrap;"';
	$sepH		= 'style="border-top: 1pt solid #dddddd;"';
	$totalF		= 'style=""';
	$toPayS		= 'style="background-color: #eeeeee;padding:
20px;"';
	$toPaySV	= 'style="background-color: #eeeeee;padding:
20px;text-align:right;"';
	$firstRow	= 'style="font-size:0pt;"';

	$bDesc		= 'style="padding: 2px 0px 0px
0px;margin:0;font-size:60%;"';
	$hrSmall	= 'style="font-size:30%;"';
	$taxRecTable= 'style="border: 1pt solid #dddddd; width:
70%;font-size: 60%;"';
	$taxRecTd	= 'style="border: 1pt solid #dddddd;"';
	$taxRecTdRight= 'style="border: 1pt solid
#dddddd;text-align:right;"';
	$bQrInfo	= 'style="font-size: 70%"';

} else if ($d['format'] == 'mail') {

	// FORMAT EMAIL
	$box		= '';
	//$table 		= 'style="width: 100%; font-family: sans-serif,
arial; font-size: 90%;"';
	$table 		= 'style="width: 100%; font-size: 90%;"';
	$pho1 		= 'style="width: 8.3333%;"';
	$pho2 		= 'style="width: 8.3333%;"';
	$pho3 		= 'style="width: 8.3333%;"';
	$pho4 		= 'style="width: 8.3333%;"';
	$pho5 		= 'style="width: 8.3333%;"';
	$pho6 		= 'style="width: 8.3333%;"';
	$pho7 		= 'style="width: 8.3333%;"';
	$pho6Sep 	= 'style="width: 3%;"';
	$pho7Sep 	= 'style="width: 3%;"';
	$pho8 		= 'style="width: 8.3333%;"';
	$pho9 		= 'style="width: 8.3333%;"';
	$pho10 		= 'style="width: 8.3333%;"';
	$pho11 		= 'style="width: 8.3333%;"';
	$pho12 		= 'style="width: 8.3333%;"';
	$sep		= 'style="width: 3%;"';

	$pho12 		= 'style="width: 9%;"';
	$pho22 		= 'style="width: 9%;"';
	$pho32 		= 'style="width: 9%;"';
	$pho42 		= 'style="width: 9%;"';
	$pho52 		= 'style="width: 9%;"';
	$pho62 		= 'style="width: 9%;"';
	$pho72 		= 'style="width: 9%;"';
	$pho6Sep2 	= 'style="width: 5%;"';
	$pho7Sep2 	= 'style="width: 5%;"';
	$pho82 		= 'style="width: 9%;"';
	$pho92 		= 'style="width: 9%;"';
	$pho102 	= 'style="width: 9%;"';
	$pho112 	= 'style="width: 9%;"';
	$pho122 	= 'style="width: 9%;"';
	$seps2		= 'style="width: 10%;"';

	$bBox		= 'style="border: 1px solid #ddd;padding:
10px;"';
	$bBoxIn		= 'style=""';
	$sBox		= 'style="border: 1px solid #ddd;padding:
10px;"';
	$sBoxIn		= 'style=""';
	//$boxIn 		= 'style="width: 100%; font-family: sans-serif,
arial; font-size: 90%;"';
	$boxIn 		= 'style="width: 100%; font-size: 90%;"';
	$hProduct 	= 'style="white-space:nowrap;padding:
5px;font-weight: bold;background: #ddd;"';
	$bProduct	= 'style="white-space:nowrap;padding:
5px;"';
	$sepH		= 'style="border-top: 1px solid #ddd;"';
	$totalF		= 'style=""';
	$toPayS		= 'style="background-color: #eeeeee;padding:
20px;"';
	$toPaySV	= 'style="background-color: #eeeeee;padding:
20px;text-align:right;"';
	$firstRow	= '';
	$taxRecTable= 'style="border: 1pt solid #dddddd; width:
50%;"';
	$taxRecTd	= 'style="border: 1pt solid #dddddd;"';

}

// -----------
// R E N D E R
// -----------
$o = array();
$o[] = '<div '.$box.'>';


// -----------
// 1. PART
// -----------
$o[] = '<table '.$table.'>';

$o[] = '<tr '.$firstRow.'>';
$o[] = '<td '.$pho12.'>&nbsp;</td><td
'.$pho22.'>&nbsp;</td><td
'.$pho32.'>&nbsp;</td><td
'.$pho42.'>&nbsp;</td>';
$o[] = '<td '.$pho52.'>&nbsp;</td><td
'.$pho6Sep2.'>&nbsp;</td><td
'.$pho7Sep2.'>&nbsp;</td><td
'.$pho82.'>&nbsp;</td>';
$o[] = '<td '.$pho92.'>&nbsp;</td><td
'.$pho102.'>&nbsp;</td><td
'.$pho112.'>&nbsp;</td><td
'.$pho122.'>&nbsp;</td>';
$o[] = '</tr>';


// -----------
// HEADER LEFT
// -----------
$o[] = '<tr><td colspan="5">';
if ($store_title != '') {
	$o[] =
'<div><h1>'.$store_title.'</h1></div>';
}
if ($store_logo != '') {
	$o[] = '<div><img class="ph-idnr-header-img"
src="'.JURI::root(false). ''.$store_logo.'"
/></div>';
}
if ($store_info != '') {
	$o[] = '<div>'.$store_info.'</div>';
}
$o[] = '</td>';

$o[] = '<td colspan="2"
'.$sep2.'></td>';


// -----------
// HEADER RIGHT
// -----------
$o[] = '<td colspan="5">';
if ($d['type'] == 1) {
	$o[] =
'<div><h1>'.JText::_('COM_PHOCACART_ORDER').'</h1></div>';
	$o[] =
'<div><b>'.JText::_('COM_PHOCACART_ORDER_NR').'</b>:
'.PhocacartOrder::getOrderNumber($d['common']->id,
$d['common']->date,
$d['common']->order_number).'</div>';
	$o[] =
'<div><b>'.JText::_('COM_PHOCACART_ORDER_DATE').'</b>:
'.JHtml::date($d['common']->date,
'DATE_FORMAT_LC4').'</div>';
} else if ($d['type'] == 2) {

	$o[] =
'<div><h1>'.JText::_('COM_PHOCACART_INVOICE').'</h1></div>';
	$o[] =
'<div><b>'.JText::_('COM_PHOCACART_INVOICE_NR').'</b>:
'.PhocacartOrder::getInvoiceNumber($d['common']->id,
$d['common']->date,
$d['common']->invoice_number).'</div>';
	$o[] =
'<div><b>'.JText::_('COM_PHOCACART_INVOICE_DATE').'</b>:
'.JHtml::date($d['common']->invoice_date,
'DATE_FORMAT_LC4').'</div>';

	if ($display_time_of_supply_invoice	== 1 &&
$d['common']->invoice_time_of_supply != ''
&& $d['common']->invoice_time_of_supply !=
'0000-00-00 00:00:00') {
        $o[] = '<div><b>' .
JText::_('COM_PHOCACART_DATE_OF_TAXABLE_SUPPLY') .
'</b>: ' .
JHtml::date($d['common']->invoice_time_of_supply,
'DATE_FORMAT_LC4') . '</div>';
    }

    $o[] =
'<div><b>'.JText::_('COM_PHOCACART_INVOICE_DUE_DATE').'</b>:
'.PhocacartOrder::getInvoiceDueDate($d['common']->id,
$d['common']->date,
$d['common']->invoice_due_date,
'DATE_FORMAT_LC4').'</div>';
	$o[] =
'<div><b>'.JText::_('COM_PHOCACART_PAYMENT_REFERENCE_NUMBER').'</b>:
'.PhocacartOrder::getPaymentReferenceNumber($d['common']->id,
$d['common']->date,
$d['common']->invoice_prn).'</div>';
	// Display order number in invoice because order number can be different
to invoice number
	$o[] =
'<div><b>'.JText::_('COM_PHOCACART_ORDER_NR').'</b>:
'.PhocacartOrder::getOrderNumber($d['common']->id,
$d['common']->date,
$d['common']->order_number).'</div>';
	
} else if ($d['type'] == 3) {
	$o[] =
'<div><h1>'.JText::_('COM_PHOCACART_DELIVERY_NOTE').'</h1></div>';
	$o[] = '<div
style="margin:0;"><b>'.JText::_('COM_PHOCACART_ORDER_NR').'</b>:
'.PhocacartOrder::getOrderNumber($d['common']->id,
$d['common']->date,
$d['common']->order_number).'</div>';
	$o[] = '<div
style="margin:0"><b>'.JText::_('COM_PHOCACART_ORDER_DATE').'</b>:
'.JHtml::date($d['common']->date,
'DATE_FORMAT_LC4').'</div>';

}

$o[] = '<div>&nbsp;</div>';
if (isset($d['common']->paymenttitle) &&
$d['common']->paymenttitle != '') {
	$o[] =
'<div><b>'.JText::_('COM_PHOCACART_PAYMENT').'</b>:
'.$d['common']->paymenttitle.'</div>';
}

if ($d['type'] == 2 && $invoice_tp	!= '') {
	$o[] =
'<div><b>'.JText::_('COM_PHOCACART_TERMS_OF_PAYMENT').'</b>:
'.$invoice_tp.'</div>';
}

if (isset($d['common']->shippingtitle) &&
$d['common']->shippingtitle != '') {
	$o[] =
'<div><b>'.JText::_('COM_PHOCACART_SHIPPING').'</b>:
'.$d['common']->shippingtitle.'</div>';
}

$o[] = '</td></tr>';

$o[] = '<tr><td
colspan="12">&nbsp;</td></tr>';


// POS HEADER
if ($pR) {
	$oPr[] = $pP->printImage($store_logo_pos);
}
if ($pR) {
	$storeTitlePos = array();
	if ($store_title_pos != '') {
		$storeTitlePos = explode("\n", $store_title_pos);
	}
	$oPr[] = $pP->printFeed(1);
	$oPr[] = $pP->printLine($storeTitlePos, 'pDoubleSizeCenter');
	$oPr[] = $pP->printFeed(1);
}
if ($pR) {

	$storeInfoPos = array();
	if ($store_info_pos != '') {
		$store_info_pos 	= PhocacartText::completeText($store_info_pos,
$d['preparereplace'], 1);
		$storeInfoPos = explode("\n", strip_tags($store_info_pos));
	}

	$oPr[] = $pP->printLine($storeInfoPos, 'pCenter');
}




// -----------
// BILLING AND SHIPPING HEADER
// -----------
$o[] = '<tr><td
colspan="5"><b>'.JText::_('COM_PHOCACART_BILLING_ADDRESS').'</b></td>';
$o[] = '<td colspan="2"></td>';
$o[] = '<td
colspan="5"><b>'.JText::_('COM_PHOCACART_SHIPPING_ADDRESS').'</b></td></tr>';


// -----------
// BILLING
// -----------
$ob = array();
$ob2 = array();// specific case for $oidn_global_billing_desc
if (!empty($d['bas']['b'])) {

	$v = $d['bas']['b'];


	if ($v['company'] != '') { $ob[] =
'<b>'.$v['company'].'</b><br
/>';}
	$name = array();
	if ($v['name_degree'] != '') { $name[] =
$v['name_degree'];}
	if ($v['name_first'] != '') { $name[] =
$v['name_first'];}
	if ($v['name_middle'] != '') { $name[] =
$v['name_middle'];}
	if ($v['name_last'] != '') { $name[] =
$v['name_last'];}
	if (!empty($name)) {$ob[] = '<b>' .
implode("\n", $name).'</b><br />';}
	if ($v['address_1'] != '') { $ob[] =
$v['address_1'].'<br />';}
	if ($v['address_2'] != '') { $ob[] =
$v['address_2'].'<br />';}
	$city = array();
	if ($v['zip'] != '') { $city[] = $v['zip'];}
	if ($v['city'] != '') { $city[] =
$v['city'];}
	if (!empty($city)) {$ob[] = implode("\n", $city).'<br
/>';}
	//echo '<br />';
	if (!empty($v['regiontitle'])) {$ob[] =
$v['regiontitle'].'<br />';}
	if (!empty($v['countrytitle'])) {$ob[] =
$v['countrytitle'].'<br />';}
	//echo '<br />';
	if ($v['vat_1'] != '') { $ob[] = '<br
/>'.JText::_('COM_PHOCACART_VAT_1_LABEL').': '.
$v['vat_1'].'<br />';}
	if ($v['vat_2'] != '') { $ob[] =
JText::_('COM_PHOCACART_VAT_2_LABEL').':
'.$v['vat_2'].'<br />';}

	// -----------------------
	// ORDER | INVOICE | DELIVERY NOTE BILLING ADDRESS DESCRIPTION
	// -----------------------
	if ($d['type'] == 1 || $d['type'] == 2 ||
$d['type'] == 3) {

		$oidnBillingDescArticle = '';
		if ($d['common']->oidn_spec_billing_desc != '') {
			$oidnBillingDescArticle =
$d['common']->oidn_spec_billing_desc;
		} else if ((int)$oidn_global_billing_desc > 0) {
			$oidnBillingDescArticle =
PhocacartRenderFront::renderArticle((int)$oidn_global_billing_desc);
		}

		if ($oidnBillingDescArticle != '') {
			//$o[] = '<div
'.$hrSmall.'>&nbsp;</div>';
			$oidnBillingDescArticle 	=
PhocacartPdf::skipStartAndLastTag($oidnBillingDescArticle, 'p');
			$oidnBillingDescArticle 	=
PhocacartText::completeText($oidnBillingDescArticle,
$d['preparereplace'], 1);
			//$oidnBillingDescArticle 	=
PhocacartText::completeTextFormFields($oidnBillingDescArticle,
$d['bas']['b'], 1);
			//$oidnBillingDescArticle 	=
PhocacartText::completeTextFormFields($oidnBillingDescArticle,
$d['bas']['s'], 2);
			$oidnBillingDescArticle 	=
PhocacartText::completeTextFormFields($oidnBillingDescArticle,
$d['bas']['b'], $d['bas']['s']);
			$ob2[] = $oidnBillingDescArticle;
		}
	}

}


// -----------
// SHIPPING
// -----------
$os = array();
$os2 = array();// specific case for $oidn_global_shipping_desc
if (!empty($d['bas']['s'])) {
	$v = $d['bas']['s'];
	if ($v['company'] != '') { $os[] =
'<b>'.$v['company'].'</b><br
/>';}
	$name = array();
	if ($v['name_degree'] != '') { $name[] =
$v['name_degree'];}
	if ($v['name_first'] != '') { $name[] =
$v['name_first'];}
	if ($v['name_middle'] != '') { $name[] =
$v['name_middle'];}
	if ($v['name_last'] != '') { $name[] =
$v['name_last'];}
	if (!empty($name)) {$os[] = '<b>' .
implode("\n", $name).'</b><br />';}
	if ($v['address_1'] != '') { $os[] =
$v['address_1'].'<br />';}
	if ($v['address_2'] != '') { $os[] =
$v['address_2'].'<br />';}
	$city = array();
	if ($v['zip'] != '') { $city[] = $v['zip'];}
	if ($v['city'] != '') { $city[] =
$v['city'];}
	if (!empty($city)) {$os[] = implode("\n", $city).'<br
/>';}
	//echo '<br />';
	if (!empty($v['regiontitle'])) {$os[] =
$v['regiontitle'].'<br />';}
	if (!empty($v['countrytitle'])) {$os[] =
$v['countrytitle'].'<br />';}
	//echo '<br />';
	if ($v['vat_1'] != '') { $os[] = '<br
/>'.JText::_('COM_PHOCACART_VAT1').': '.
$v['vat_1'].'<br />';}
	if ($v['vat_2'] != '') { $os[] =
JText::_('COM_PHOCACART_VAT2').':
'.$v['vat_2'].'<br />';}


	// -----------------------
    // ORDER | INVOICE | DELIVERY NOTE SHIPPING ADDRESS DESCRIPTION
    // -----------------------
    if ($d['type'] == 1 || $d['type'] == 2 ||
$d['type'] == 3) {

		$oidnShippingDescArticle = '';
		if ($d['common']->oidn_spec_shipping_desc != '') {
			$oidnShippingDescArticle =
$d['common']->oidn_spec_shipping_desc;
		} else if ((int)$oidn_global_shipping_desc > 0) {
			$oidnShippingDescArticle =
PhocacartRenderFront::renderArticle((int)$oidn_global_shipping_desc);
		}


		if ($oidnShippingDescArticle != '') {
			//$o[] = '<div
'.$hrSmall.'>&nbsp;</div>';
			$oidnShippingDescArticle 	=
PhocacartPdf::skipStartAndLastTag($oidnShippingDescArticle, 'p');
			$oidnShippingDescArticle 	=
PhocacartText::completeText($oidnShippingDescArticle,
$d['preparereplace'], 1);
			//$oidnShippingDescArticle 	=
PhocacartText::completeTextFormFields($oidnShippingDescArticle,
$d['bas']['b'], 1);
			//$oidnShippingDescArticle 	=
PhocacartText::completeTextFormFields($oidnShippingDescArticle,
$d['bas']['s'], 2);
			$oidnShippingDescArticle 	=
PhocacartText::completeTextFormFields($oidnShippingDescArticle,
$d['bas']['b'], $d['bas']['s']);
			$os2[] = $oidnShippingDescArticle;
		}
	}
}


// BILLING OUTPUT
$o[] = '<tr><td colspan="5" '.$bBox.'
><div '.$bBoxIn.'>';
$o[] = implode("\n", $ob);
$o[] = implode("\n", $ob2);
$o[] = '</div></td>';
$o[] = '<td colspan="2">&nbsp;</td>';


// SHIPPING OUTPUT
$o[] = '<td colspan="5" '.$sBox.'><div
'.$sBoxIn.'>';
if ((isset($d['bas']['b']['ba_sa'])
&& $d['bas']['b']['ba_sa'] == 1) ||
(isset($d['bas']['s']['ba_sa']) &&
$d['bas']['s']['ba_sa'] == 1)) {
	$o[] = implode("\n", $ob);
	//$o[] = implode("\n", $ob2); Don't display shipping
description in billing
	// Possible TO DO - parameter if display shipping description in case
there is no shipping address but in fact the billing one
	$o[] = implode("\n", $os2);
} else {
	$o[] = implode("\n", $os);
	$o[] = implode("\n", $os2);
}
$o[] = '</div></td></tr>';
//$o[] = '<tr><td
colspan="12">&nbsp;</td></tr>';
$o[] = '</table>';


// -----------------------
// INVOICE TOP DESCRIPTION
// -----------------------
if ($d['type'] == 2) {

	$invoiceTopDescArticle = '';
	if ($d['common']->invoice_spec_top_desc != '') {
		$invoiceTopDescArticle =
$d['common']->invoice_spec_top_desc;
	} else if ((int)$invoice_global_top_desc > 0) {
		$invoiceTopDescArticle =
PhocacartRenderFront::renderArticle((int)$invoice_global_top_desc);
	}

	if ($invoiceTopDescArticle != '') {
		$o[] = '<div
'.$hrSmall.'>&nbsp;</div>';
		$invoiceTopDescArticle 	=
PhocacartPdf::skipStartAndLastTag($invoiceTopDescArticle, 'p');
		$invoiceTopDescArticle 	=
PhocacartText::completeText($invoiceTopDescArticle,
$d['preparereplace'], 1);
		//$invoiceTopDescArticle 	=
PhocacartText::completeTextFormFields($invoiceTopDescArticle,
$d['bas']['b'], 1);
		//$invoiceTopDescArticle 	=
PhocacartText::completeTextFormFields($invoiceTopDescArticle,
$d['bas']['s'], 2);
		$invoiceTopDescArticle 	=
PhocacartText::completeTextFormFields($invoiceTopDescArticle,
$d['bas']['b'], $d['bas']['s']);
		$o[] = '<table
'.$bDesc.'><tr><td>'.$invoiceTopDescArticle.'</td></tr></table>';
	}
} else if ($d['type'] == 1) {
	$orderTopDescArticle =
PhocacartRenderFront::renderArticle((int)$order_global_top_desc);

	if ($orderTopDescArticle != '') {
		$o[] = '<div
'.$hrSmall.'>&nbsp;</div>';
		$orderTopDescArticle 	=
PhocacartPdf::skipStartAndLastTag($orderTopDescArticle, 'p');
		$orderTopDescArticle 	= PhocacartText::completeText($orderTopDescArticle,
$d['preparereplace'], 1);
		//$orderTopDescArticle 	=
PhocacartText::completeTextFormFields($orderTopDescArticle,
$d['bas']['b'], 1);
		//$orderTopDescArticle 	=
PhocacartText::completeTextFormFields($orderTopDescArticle,
$d['bas']['s'], 2);
		$orderTopDescArticle 	=
PhocacartText::completeTextFormFields($orderTopDescArticle,
$d['bas']['b'], $d['bas']['s']);
		$o[] = '<table
'.$bDesc.'><tr><td>'.$orderTopDescArticle.'</td></tr></table>';
	}
} else if ($d['type'] == 3) {
	$dnTopDescArticle =
PhocacartRenderFront::renderArticle((int)$dn_global_top_desc);

	if ($dnTopDescArticle != '') {
		$o[] = '<div
'.$hrSmall.'>&nbsp;</div>';
		$dnTopDescArticle 	= PhocacartPdf::skipStartAndLastTag($dnTopDescArticle,
'p');
		$dnTopDescArticle 	= PhocacartText::completeText($dnTopDescArticle,
$d['preparereplace'], 1);
		$dnTopDescArticle 	=
PhocacartText::completeTextFormFields($dnTopDescArticle,
$d['bas']['b'], $d['bas']['s']);
		$o[] = '<table
'.$bDesc.'><tr><td>'.$dnTopDescArticle.'</td></tr></table>';
	}
}


// -----------
// 2. PART
// -----------
$o[] = '<table '.$boxIn.'>';
$o[] = '<tr>';
$o[] = '<td '.$pho1.'>&nbsp;</td><td
'.$pho2.'>&nbsp;</td><td
'.$pho3.'>&nbsp;</td><td
'.$pho4.'>&nbsp;</td>';
$o[] = '<td '.$pho5.'>&nbsp;</td><td
'.$pho6.'>&nbsp;</td><td
'.$pho7.'>&nbsp;</td><td
'.$pho8.'>&nbsp;</td>';
$o[] = '<td '.$pho9.'>&nbsp;</td>';
if ($tax_calculation > 0) {
	$o[] = '<td '.$pho10.'>&nbsp;</td><td
'.$pho11.'>&nbsp;</td><td
'.$pho12.'>&nbsp;</td>';
}
$o[] = '</tr>';


$dDiscount 	= 0; // Display Discount (Coupon, cnetto)
$cTitle		= 3; // Colspan Title


$p = array();
if (!empty($d['products'])) {

	// Prepare header and body
	foreach ($d['products'] as $k => $v) {
		if ($v->damount > 0) {
			$dDiscount 	= 1;
			$cTitle 	= 2;
		}
	}

	if ($d['type'] == 3) {
		$cTitle	= 10;
	}

	$p[] = '<tr '.$hProduct.'>';
	$p[] =
'<td>'.JText::_('COM_PHOCACART_SKU').'</td>';
	$p[] = '<td
colspan="'.$cTitle.'">'.JText::_('COM_PHOCACART_ITEM').'</td>';
	$p[] = '<td
style="text-align:center">'.JText::_('COM_PHOCACART_QTY').'</td>';

	if ($d['type'] != 3) {
		$p[] = '<td style="text-align:right"
colspan="2">'.JText::_('COM_PHOCACART_PRICE_UNIT').'</td>';
		if ($dDiscount == 1) {
			$p[] = '<td
style="text-align:center"">'.JText::_('COM_PHOCACART_DISCOUNT').'</td>';
		}
		if ($tax_calculation > 0) {
			$p[] = '<td style="text-align:right"
colspan="2">'.JText::_('COM_PHOCACART_PRICE_EXCL_TAX').'</td>';
			$p[] = '<td
style="text-align:right">'.JText::_('COM_PHOCACART_TAX').'</td>';
			$p[] = '<td style="text-align:right"
colspan="2">'.JText::_('COM_PHOCACART_PRICE_INCL_TAX').'</td>';
		} else {
			$p[] = '<td style="text-align:right"
colspan="2">'.JText::_('COM_PHOCACART_PRICE').'</td>';
		}

	}
	$p[] = '</tr>';

	if ($pR) { $oPr[] = $pP->printSeparator(); }

	foreach($d['products'] as $k => $v) {

		// $codes = PhocacartProduct::getProductCodes((int)$v->product_id);
		// echo $codes['isbn']; getting codes like isbn, ean, jpn,
serial_number from product
		// codes are the latest stored in database not codes which were valid in
date of order

		/*
		$productImage 		=
PhocacartProduct::getImageByProductId($v->product_id);
		$path				= PhocacartPath::getPath('productimage');// add before
foreach
		if ($productImage != '') {
			$productThumbnail 	= PhocacartImage::getThumbnailName($path,
$productImage, 'small');
			$productImageOutput = '<img
src="'.JURI::root().''.$productThumbnail->rel.'"
alt="" />';
		}
		*/

		$p[] = '<tr '.$bProduct.'>';
		$p[] = '<td>'.$v->sku.'</td>';
		$p[] = '<td
colspan="'.$cTitle.'">'.$v->title.'</td>';

		if ($pR) { $oPr[] = $pP->printLineColumns(array($v->sku,
$v->title), 1); }

		$p[] = '<td
style="text-align:center">'.$v->quantity.'</td>';


		$netto 		= (int)$v->quantity * $v->netto;
		$nettoUnit	= $v->netto;
		$tax 		= (int)$v->quantity * $v->tax;
		$brutto 	= (int)$v->quantity * $v->brutto;
		if ($d['type'] != 3) {
			if ($tax_calculation > 0) {
				$p[] = '<td style="text-align:right"
colspan="2">'.$d['price']->getPriceFormat($v->netto).'</td>';
				$p[] = '<td style="text-align:right"
colspan="2">'.$d['price']->getPriceFormat($netto).'</td>';
				$p[] = '<td style="text-align:right"
colspan="1">'.$d['price']->getPriceFormat($tax).'</td>';
				$p[] = '<td style="text-align:right"
colspan="2">'.$d['price']->getPriceFormat($brutto).'</td>';
			} else {
				$p[] = '<td style="text-align:right"
colspan="2">'.$d['price']->getPriceFormat($v->netto).'</td>';
				$p[] = '<td style="text-align:right"
colspan="2">'.$d['price']->getPriceFormat($brutto).'</td>';
			}

		}
		$p[] = '</tr>';

		if (!empty($v->attributes)) {
			$p[] = '<tr>';
			$p[] = '<td></td>';
			$p[] = '<td colspan="3"
align="left"><ul class="ph-idnr-ul">';
			foreach ($v->attributes as $k2 => $v2) {
				$p[] = '<li><span class="ph-small
ph-cart-small-attribute ph-idnr-li">'.$v2->attribute_title
.' '.$v2->option_title.'</span></li>';

				/* Should we display the values of attributes added by users in
order/delivery note/receipt/invoice?

				$p[] = '<li><span class="ph-small
ph-cart-small-attribute ph-idnr-li">'.$v2->attribute_title
.' '.$v2->option_title.'</span>';
				 if (isset($v2->option_value) &&
urldecode($v2->option_value) != '') {
                    $p[] =  ': <span class="ph-small
ph-cart-small-attribute">' .
htmlspecialchars(urldecode($v2->option_value), ENT_QUOTES,
'UTF-8') . '</span>';
                }
				$p[] = '</li>';
				*/

				if ($pR) { $oPr[] = $pP->printLineColumns(array(' - '
.$v2->attribute_title .' '.$v2->option_title)); }

			}
			$p[] = '</ul></td>';
			$p[] = '<td colspan="8"></td>';
			$p[] = '</tr>';
		}

		if ($pR) {
			$brutto = (int)$v->quantity * $v->brutto;
			$oPr[] = $pP->printLineColumns(array((int)$v->quantity . ' x
' . $d['price']->getPriceFormat($v->brutto),
$d['price']->getPriceFormat($brutto)));
		}

		$lastSaleNettoUnit 	= array();
		$lastSaleNetto 		= array();
		$lastSaleTax 		= array();
		$lastSaleBrutto 	= array();
		if (!empty($d['discounts'][$v->product_id_key]) &&
$d['type'] != 3) {

			$lastSaleNettoUnit[$v->product_id_key] 	= $nettoUnit;
			$lastSaleNetto[$v->product_id_key] 		= $netto;
			$lastSaleTax[$v->product_id_key] 		= $tax;
			$lastSaleBrutto[$v->product_id_key] 	= $brutto;


			foreach($d['discounts'][$v->product_id_key] as $k3 =>
$v3) {

				$nettoUnit3 							= $v3->netto;
				$netto3									= (int)$v->quantity * $v3->netto;
				$tax3 									= (int)$v->quantity * $v3->tax;
				$brutto3 								= (int)$v->quantity * $v3->brutto;

				$saleNettoUnit							= $lastSaleNettoUnit[$v->product_id_key] 	-
$nettoUnit3;
				$saleNetto								= $lastSaleNetto[$v->product_id_key] 		- $netto3;
				$saleTax								= $lastSaleTax[$v->product_id_key] 			- $tax3;
				$saleBrutto								= $lastSaleBrutto[$v->product_id_key] 		-
$brutto3;

				$lastSaleNettoUnit[$v->product_id_key] 	= $nettoUnit3;
				$lastSaleNetto[$v->product_id_key] 		= $netto3;
				$lastSaleTax[$v->product_id_key] 		= $tax3;
				$lastSaleBrutto[$v->product_id_key] 	= $brutto3;

				if ($display_discount_price_product == 2) {

					$p[] = '<tr '.$bProduct.'>';
					$p[] = '<td></td>';
					$p[] = '<td
colspan="'.$cTitle.'">'.$v3->title.'</td>';
					$p[] = '<td
style="text-align:center"></td>';
					if ($tax_calculation > 0) {
						$p[] = '<td style="text-align:right"
colspan="2">'.$d['price']->getPriceFormat($saleNettoUnit,
1).'</td>';
						$p[] = '<td style="text-align:right"
colspan="2">'.$d['price']->getPriceFormat($saleNetto,
1).'</td>';
						$p[] = '<td style="text-align:right"
colspan="1">'.$d['price']->getPriceFormat($saleTax,
1).'</td>';
						$p[] = '<td style="text-align:right"
colspan="2">'.$d['price']->getPriceFormat($saleBrutto,
1).'</td>';
					} else {
						$p[] = '<td style="text-align:right"
colspan="2">'.$d['price']->getPriceFormat($saleNettoUnit,
1).'</td>';
						$p[] = '<td style="text-align:right"
colspan="2">'.$d['price']->getPriceFormat($saleBrutto,
1).'</td>';
					}

					$p[] = '</tr>';

					if ($pR) {
						$oPr[] = $pP->printLineColumns(array($v3->title,
$d['price']->getPriceFormat($saleBrutto, 1)));
					}
				} else if ($display_discount_price_product == 1) {

					$p[] = '<tr '.$bProduct.'>';
					$p[] = '<td></td>';
					$p[] = '<td
colspan="'.$cTitle.'">'.$v3->title.'</td>';
					$p[] = '<td
style="text-align:center"></td>';
					/*$p[] = '<td style="text-align:right"
colspan="2">'.$d['price']->getPriceFormat($nettoUnit3).'</td>';
					$p[] = '<td style="text-align:right"
colspan="2">'.$d['price']->getPriceFormat($netto3).'</td>';
					$p[] = '<td style="text-align:right"
colspan="1">'.$d['price']->getPriceFormat($tax3).'</td>';
					$p[] = '<td style="text-align:right"
colspan="2">'.$d['price']->getPriceFormat($brutto3).'</td>';*/

					if ($tax_calculation > 0) {
						$p[] = '<td style="text-align:right"
colspan="2">'.$d['price']->getPriceFormat($nettoUnit3).'</td>';
						$p[] = '<td style="text-align:right"
colspan="2">'.$d['price']->getPriceFormat($netto3).'</td>';
						$p[] = '<td style="text-align:right"
colspan="1">'.$d['price']->getPriceFormat($tax3).'</td>';
						$p[] = '<td style="text-align:right"
colspan="2">'.$d['price']->getPriceFormat($brutto3).'</td>';
					} else {
						$p[] = '<td style="text-align:right"
colspan="2">'.$d['price']->getPriceFormat($nettoUnit3).'</td>';
						$p[] = '<td style="text-align:right"
colspan="2">'.$d['price']->getPriceFormat($brutto3).'</td>';
					}

					$p[] = '</tr>';

					if ($pR) {
						$oPr[] = $pP->printLineColumns(array($v3->title,
$d['price']->getPriceFormat($brutto3)));
					}
				}

			}
		}

	}

	if ($pR) { $oPr[] = $pP->printSeparator(); }

}

$o[] = implode("\n", $p);


if ($tax_calculation > 0 || $d['type'] == 3) {
	$o[] = '<tr><td colspan="12"
'.$sepH.'>&nbsp;</td></tr>';
} else {
	$o[] = '<tr><td colspan="9"
'.$sepH.'>&nbsp;</td></tr>';
}



// -----------
// TOTAL
// -----------
$t = array();
$toPay = '';

$tColspanLeft = 5;
$tColspanMid = 2;
$tColspanRight = 2;

if ($tax_calculation > 0) {
	$tColspanLeft = 7;
	$tColspanMid = 3;
	$tColspanRight = 2;
}

if (!empty($d['total'])) {
	foreach($d['total'] as $k => $v) {

		if($v->amount == 0 && $v->amount_currency == 0 &&
$v->type != 'brutto') {
			// Don't display coupon if null

		} else if ($v->type == 'netto') {
			$t[] = '<tr '.$totalF.'>';
			$t[] = '<td
colspan="'.$tColspanLeft.'"></td>';
			$t[] = '<td
colspan="'.$tColspanMid.'"><b>'.
PhocacartLanguage::renderTitle($v->title, $v->title_lang, array(0
=> array($v->title_lang_suffix, ' '), 1 =>
array($v->title_lang_suffix2, '
'))).'</b></td>';
			$t[] = '<td style="text-align:right"
colspan="'.$tColspanRight.'"><b>'.$d['price']->getPriceFormat($v->amount).'</b></td>';
			$t[] = '</tr>';

			if ($pR) { $oPr[] =
$pP->printLineColumns(array(PhocacartLanguage::renderTitle($v->title,
$v->title_lang, array(0 => array($v->title_lang_suffix, '
'), 1 => array($v->title_lang_suffix2, ' '))),
$d['price']->getPriceFormat($v->amount))); }

		} else if ($v->type == 'brutto') {

			// Brutto or Brutto currency
			$amount = (isset($v->amount_currency) &&
$v->amount_currency > 0) ?
$d['price']->getPriceFormat($v->amount_currency, 0, 1) :
$d['price']->getPriceFormat($v->amount);

			$t[] = '<tr '.$totalF.'>';
			$t[] = '<td
colspan="'.$tColspanLeft.'"></td>';
			$t[] = '<td
colspan="'.$tColspanMid.'"><b>'.PhocacartLanguage::renderTitle($v->title,
$v->title_lang, array(0 => array($v->title_lang_suffix, '
'), 1 => array($v->title_lang_suffix2, '
'))).'</b></td>';
			$t[] = '<td style="text-align:right"
colspan="'.$tColspanRight.'"><b>'.$amount.'</b></td>';
			$t[] = '</tr>';


			if ($pR) {
				$oPr[] = $pP->printSeparator();
				$oPr[] =
$pP->printLineColumns(array(PhocacartLanguage::renderTitle($v->title,
$v->title_lang, array(0 => array($v->title_lang_suffix, '
'), 1 => array($v->title_lang_suffix2, ' '))),
$amount), 0, 'pDoubleSize');
				$oPr[] = $pP->printFeed(2);
			}

			if ($d['type'] == 2) {
				$toPay = $amount;
			}

		} else if ($v->type == 'rounding') {

			// Rounding or rounding currency
			$amount = (isset($v->amount_currency) &&
$v->amount_currency > 0) ?
$d['price']->getPriceFormat($v->amount_currency, 0, 1) :
$d['price']->getPriceFormat($v->amount);

			$t[] = '<tr '.$totalF.'>';
			$t[] = '<td
colspan="'.$tColspanLeft.'"></td>';
			$t[] = '<td
colspan="'.$tColspanMid.'">'.PhocacartLanguage::renderTitle($v->title,
$v->title_lang, array(0 => array($v->title_lang_suffix, '
'), 1 => array($v->title_lang_suffix2, '
'))).'</td>';
			$t[] = '<td style="text-align:right"
colspan="'.$tColspanRight.'">'.$amount.'</td>';
			$t[] = '</tr>';

			if ($pR) { $oPr[] =
$pP->printLineColumns(array(PhocacartLanguage::renderTitle($v->title,
$v->title_lang, array(0 => array($v->title_lang_suffix, '
'), 1 => array($v->title_lang_suffix2, ' '))),
$amount)); }

		} else {
			$t[] = '<tr '.$totalF.'>';
			$t[] = '<td
colspan="'.$tColspanLeft.'"></td>';
			$t[] = '<td
colspan="'.$tColspanMid.'">'.PhocacartLanguage::renderTitle($v->title,
$v->title_lang, array(0 => array($v->title_lang_suffix, ' -
'), 1 => array($v->title_lang_suffix2, '
'))).'</td>';
			$t[] = '<td style="text-align:right"
colspan="'.$tColspanRight.'">'.$d['price']->getPriceFormat($v->amount).'</td>';
			$t[] = '</tr>';

			if ($pR) { $oPr[] =
$pP->printLineColumns(array(PhocacartLanguage::renderTitle($v->title,
$v->title_lang, array(0 => array($v->title_lang_suffix, ' -
'), 1 => array($v->title_lang_suffix2, ' '))),
$d['price']->getPriceFormat($v->amount))); }

		}


	}
}

if ($d['type'] != 3) {
	$o[] = implode("\n", $t);
}


if ($tax_calculation > 0 || $d['type'] == 3) {
	$o[] = '<tr><td
colspan="12">&nbsp;</td></tr>';
} else {
	$o[] = '<tr><td
colspan="9">&nbsp;</td></tr>';
}


// -----------
// TO PAY
// -----------
if ($toPay != '') {

	$o[] = '<tr class="ph-idnr-to-pay-box">';
	$o[] = '<td
colspan="'.$tColspanLeft.'">&nbsp;</td>';
	$o[] = '<td colspan="'.$tColspanMid.'"
'.$toPayS.'><b>'.JText::_('COM_PHOCACART_TO_PAY').'</b></td>';
	$o[] = '<td colspan="'.$tColspanRight.'"
'.$toPaySV.'><b>'.$toPay.'</b></td>';
	$o[] = '</tr>';
}


$o[] = '</table>';// End box in


// -----------------------
// INVOICE MIDDLE DESCRIPTION
// -----------------------
if ($d['type'] == 2) {

	$invoiceMiddleDescArticle = '';
	if ($d['common']->invoice_spec_middle_desc != '') {
		$invoiceMiddleDescArticle =
$d['common']->invoice_spec_middle_desc;
	} else if ((int)$invoice_global_middle_desc > 0) {
		$invoiceMiddleDescArticle =
PhocacartRenderFront::renderArticle((int)$invoice_global_middle_desc);
	}

	if ($invoiceMiddleDescArticle != '') {
		$o[] = '<div
'.$hrSmall.'>&nbsp;</div>';
		$invoiceMiddleDescArticle 	=
PhocacartPdf::skipStartAndLastTag($invoiceMiddleDescArticle,
'p');
		$invoiceMiddleDescArticle 	=
PhocacartText::completeText($invoiceMiddleDescArticle,
$d['preparereplace'], 1);
		//$invoiceMiddleDescArticle 	=
PhocacartText::completeTextFormFields($invoiceMiddleDescArticle,
$d['bas']['b'], 1);
		//$invoiceMiddleDescArticle 	=
PhocacartText::completeTextFormFields($invoiceMiddleDescArticle,
$d['bas']['s'], 2);
		$invoiceMiddleDescArticle 	=
PhocacartText::completeTextFormFields($invoiceMiddleDescArticle,
$d['bas']['b'], $d['bas']['s']);
		$o[] = '<table
'.$bDesc.'><tr><td>'.$invoiceMiddleDescArticle.'</td></tr></table>';
	}
} else if ($d['type'] == 1) {
	$orderMiddleDescArticle =
PhocacartRenderFront::renderArticle((int)$order_global_middle_desc);

	if ($orderMiddleDescArticle != '') {
		$o[] = '<div
'.$hrSmall.'>&nbsp;</div>';
		$orderMiddleDescArticle 	=
PhocacartPdf::skipStartAndLastTag($orderMiddleDescArticle, 'p');
		$orderMiddleDescArticle 	=
PhocacartText::completeText($orderMiddleDescArticle,
$d['preparereplace'], 1);
		//$orderMiddleDescArticle 	=
PhocacartText::completeTextFormFields($orderMiddleDescArticle,
$d['bas']['b'], 1);
		//$orderMiddleDescArticle 	=
PhocacartText::completeTextFormFields($orderMiddleDescArticle,
$d['bas']['s'], 2);
		$orderMiddleDescArticle 	=
PhocacartText::completeTextFormFields($orderMiddleDescArticle,
$d['bas']['b'], $d['bas']['s']);
		$o[] = '<table
'.$bDesc.'><tr><td>'.$orderMiddleDescArticle.'</td></tr></table>';
	}
} else if ($d['type'] == 3) {
	$dnMiddleDescArticle =
PhocacartRenderFront::renderArticle((int)$dn_global_middle_desc);

	if ($dnMiddleDescArticle != '') {
		$o[] = '<div
'.$hrSmall.'>&nbsp;</div>';
		$dnMiddleDescArticle 	=
PhocacartPdf::skipStartAndLastTag($dnMiddleDescArticle, 'p');
		$dnMiddleDescArticle 	= PhocacartText::completeText($dnMiddleDescArticle,
$d['preparereplace'], 1);
		$dnMiddleDescArticle 	=
PhocacartText::completeTextFormFields($dnMiddleDescArticle,
$d['bas']['b'], $d['bas']['s']);
		$o[] = '<table
'.$bDesc.'><tr><td>'.$dnMiddleDescArticle.'</td></tr></table>';
	}
}


// -----------------------
// INVOICE QR CODE, STAMP IMAGE
// -----------------------
if ($d['format'] == 'pdf' &&
$d['type'] == 2 && ($d['qrcode'] !=
'' || $pdf_invoice_signature_image != '')) {
	$o[] =
'<div>&nbsp;</div><div>&nbsp;</div>';
	$o[] = '<table>';// End box in
	$o[] = '<tr><td>';

	if ($pdf_invoice_qr_information != '') {
		$o[] = '<span
'.$bQrInfo.'>'.$pdf_invoice_qr_information .
'</span><br />';
	}



	if ($d['qrcode'] != '') {
		$o[] =
'{phocapdfqrcode|'.urlencode($d['qrcode']).'}';
	}
	$o[] = '</td><td>';
	if ($pdf_invoice_signature_image != '') {
		$o[] = '<img
src="'.JURI::root().''.$pdf_invoice_signature_image.'"
style="width:80"/>';
	}
	$o[] = '</td></tr>';
	$o[] = '</table>';
}

// -----------------------
// TAX RECAPITULATION
// -----------------------
if (($display_tax_recapitulation_invoice == 1 &&
$d['type'] == 2 ) ||  ($display_tax_recapitulation_pos == 1
&& $d['type'] == 4 )) {



	if (!empty($d['taxrecapitulation'])) {


		$o[] =
'<h3>'.JText::_('COM_PHOCACART_TAX_RECAPITULATION').'</h3>';
		if ($pR) {
			$oPr[] =
$pP->printLine(array(JText::_('COM_PHOCACART_TAX_RECAPITULATION')),
'pLeft');
		}


		$o[] = '<table '.$taxRecTable.'>';
		$o[] = '<tr>';
		$o[] = '<th
'.$taxRecTd.'>'.JText::_('COM_PHOCACART_TITLE').'</th>';
		$o[] = '<th
'.$taxRecTd.'>'.JText::_('COM_PHOCACART_TAX_BASIS').'</th>';
		$o[] = '<th
'.$taxRecTd.'>'.JText::_('COM_PHOCACART_TAX').'</th>';
		$o[] = '<th
'.$taxRecTd.'>'.JText::_('COM_PHOCACART_TOTAL').'</th>';
		//$o[] =
'<th>'.JText::_('COM_PHOCACART_TOTAL').'
'.JText::_('COM_PHOCACART_CURRENCY').'</td>';
		$o[] = '</tr>';


		foreach($d['taxrecapitulation'] as $k => $v) {


			if (isset($v->amount_brutto_currency) &&
$v->amount_brutto_currency > 0) {
				$amountBrutto		= $v->amount_brutto_currency;
				$amountBruttoFormat =
$d['price']->getPriceFormat($v->amount_brutto_currency, 0,
1);
			} else {
				$amountBrutto		= $v->amount_brutto;
				$amountBruttoFormat =
$d['price']->getPriceFormat($v->amount_brutto);
			}

			$amountNettoFormat 	= $v->amount_netto > 0 ?
$d['price']->getPriceFormat($v->amount_netto) :
'';
			$amountTaxFormat 	= $v->amount_tax > 0 ?
$d['price']->getPriceFormat($v->amount_tax) : '';
			$title				= $v->title;

		/*	if ($v->type == 'trcrounding') {
				// In administration edit: Rounding (Incl. Tax Recapitulation Rounding)
				// In documents (invoice): Rouning
				// Skip "(Incl. Tax Recapitulation Rounding)" in documents
				$title = JText::_('COM_PHOCACART_ROUNDING');
			}*/

			if ($v->type == 'brutto') {
				$amountBruttoFormat = '<span
class="ph-b">'.$amountBruttoFormat.'</span>';
				$amountNettoFormat = '';
				$amountTaxFormat = '';
			}


			if ($v->type == 'rounding') {
				// Don't display rounding here, only trcrounding (calculation
rounding + tax recapitulation rounding)
			} else if ($amountBrutto > 0 || $amountBrutto < 0) {

				$o[] = '<tr>';
				$o[] = '<td
'.$taxRecTd.'>'.$title.'</td>';
				$o[] = '<td
'.$taxRecTdRight.'>'.$amountNettoFormat.'</td>';
				$o[] = '<td
'.$taxRecTdRight.'>'.$amountTaxFormat.'</td>';
				$o[] = '<td
'.$taxRecTdRight.'>'.$amountBruttoFormat.'</td>';
				$o[] = '</tr>';

			}

			// POS Receipt - only tax information
			if ($pR && $v->type == 'tax') {
				$oPr[] = $pP->printLineColumns(array($title,
$d['price']->getPriceFormat($v->amount_tax)));
			}

		}

		$o[] = '</table>';
		if ($pR) {
			$oPr[] = $pP->printFeed(1);
		}
	}
	/*$orderCalc 		= new PhocacartOrderCalculation();
	$calcItems		= array();
	$calcItems[0]	= $d['common'];
	$orderCalc->calculateOrderItems($calcItems);
	$calcTotal		= $orderCalc->getTotal();
	$taxes 			= PhocacartTax::getAllTaxes();
	if (!empty($calcTotal)) {
		foreach ($calcTotal as $k => $v) {


			if (!empty($v)) {
				$d['price']->setCurrency($k);


				if ($pR) {
					$oPr[] =
$pP->printLine(array(JText::_('COM_PHOCACART_TAX_RECAPITULATION')),
'pLeft');
				}

				if (!empty($v['tax'])) {

					$o[] = '<table '.$taxRecTable.'>';
					$o[] = '<tr><th
colspan="2">'.JText::_('COM_PHOCACART_TAX_RECAPITULATION').'</th></tr>';

					foreach($v['tax'] as $kT => $vT) {

						$calcTitle = isset($taxes[$kT]['title']) ?
$taxes[$kT]['title'] : '';

						$o[] = '<tr><td
'.$taxRecTd.'>'.$calcTitle.'</td>';
						$o[] = '<td
'.$taxRecTd.'>'.$d['price']->getPriceFormat($vT,0,1)
. '</td></tr>';

						if ($pR) {
							$oPr[] = $pP->printLineColumns(array($calcTitle,
$d['price']->getPriceFormat($vT,0,1)));
						}
					}

					$o[] = '</table>';
					if ($pR) {
						$oPr[] = $pP->printFeed(1);
					}
				}
			}
		}
	}*/
}


// -----------------------
// POINTS RECEIVED
// -----------------------

if (($display_reward_points_invoice == 1 && $d['type'] ==
2 ) ||  ($display_reward_points_pos == 1 && $d['type'] ==
4 )) {
	if ((int)$d['common']->user_id > 0 &&
(int)$d['common']->id > 0) {
		$pointsUser 	=
PhocacartReward::getTotalPointsByUserIdExceptCurrentOrder($d['common']->user_id,
$d['common']->id);
		$pointsOrder 	=
PhocacartReward::getTotalPointsByOrderId($d['common']->id);


		$o[] =
'<div>'.JText::_('COM_PHOCACART_YOUR_CURRENT_REWARD_POINTS_BALANCE').':
'.$pointsUser.'</div>';
		$o[] =
'<div>'.JText::_('COM_PHOCACART_POINTS_RECEIVED_FOR_THIS_PURCHASE').':
'.$pointsOrder.'</div>';

		if ($pR) {
			$oPr[] =
$pP->printLineColumns(array(JText::_('COM_PHOCACART_YOUR_CURRENT_REWARD_POINTS_BALANCE').':
', $pointsUser));
			$oPr[] =
$pP->printLineColumns(array(JText::_('COM_PHOCACART_POINTS_RECEIVED_FOR_THIS_PURCHASE').
': ', $pointsOrder));
			$oPr[] = $pP->printFeed(1);
		}
	}
}

// -----------------------
// INVOICE BOTTOM DESCRIPTION
// -----------------------
if ($d['type'] == 2) {

	$invoiceBottomDescArticle = '';
	if ($d['common']->invoice_spec_bottom_desc != '') {
		$invoiceBottomDescArticle =
$d['common']->invoice_spec_bottom_desc;
	} else if ((int)$invoice_global_bottom_desc > 0) {
		$invoiceBottomDescArticle =
PhocacartRenderFront::renderArticle((int)$invoice_global_bottom_desc);
	}

	if ($invoiceBottomDescArticle != '') {
		$o[] = '<div
'.$hrSmall.'>&nbsp;</div>';
		$invoiceBottomDescArticle 	=
PhocacartPdf::skipStartAndLastTag($invoiceBottomDescArticle,
'p');
		$invoiceBottomDescArticle 	=
PhocacartText::completeText($invoiceBottomDescArticle,
$d['preparereplace'], 1);
		//$invoiceBottomDescArticle 	=
PhocacartText::completeTextFormFields($invoiceBottomDescArticle,
$d['bas']['b'], 1);
		//$invoiceBottomDescArticle 	=
PhocacartText::completeTextFormFields($invoiceBottomDescArticle,
$d['bas']['s'], 2);
		$invoiceBottomDescArticle 	=
PhocacartText::completeTextFormFields($invoiceBottomDescArticle,
$d['bas']['b'], $d['bas']['s']);
		$o[] = '<table
'.$bDesc.'><tr><td>'.$invoiceBottomDescArticle.'</td></tr></table>';
	}
} else if ($d['type'] == 1) {
	$orderBottomDescArticle =
PhocacartRenderFront::renderArticle((int)$order_global_bottom_desc);

	if ($orderBottomDescArticle != '') {
		$o[] = '<div
'.$hrSmall.'>&nbsp;</div>';
		$orderBottomDescArticle 	=
PhocacartPdf::skipStartAndLastTag($orderBottomDescArticle, 'p');
		$orderBottomDescArticle 	=
PhocacartText::completeText($orderBottomDescArticle,
$d['preparereplace'], 1);
		//$orderBottomDescArticle 	=
PhocacartText::completeTextFormFields($orderBottomDescArticle,
$d['bas']['b'], 1);
		//$orderBottomDescArticle 	=
PhocacartText::completeTextFormFields($orderBottomDescArticle,
$d['bas']['s'], 2);
		$orderBottomDescArticle 	=
PhocacartText::completeTextFormFields($orderBottomDescArticle,
$d['bas']['b'], $d['bas']['s']);
		$o[] = '<table
'.$bDesc.'><tr><td>'.$orderBottomDescArticle.'</td></tr></table>';
	}
} else if ($d['type'] == 3) {
	$dnBottomDescArticle =
PhocacartRenderFront::renderArticle((int)$dn_global_bottom_desc);

	if ($dnBottomDescArticle != '') {
		$o[] = '<div
'.$hrSmall.'>&nbsp;</div>';
		$dnBottomDescArticle 	=
PhocacartPdf::skipStartAndLastTag($dnBottomDescArticle, 'p');
		$dnBottomDescArticle 	= PhocacartText::completeText($dnBottomDescArticle,
$d['preparereplace'], 1);
		$dnBottomDescArticle 	=
PhocacartText::completeTextFormFields($dnBottomDescArticle,
$d['bas']['b'], $d['bas']['s']);
		$o[] = '<table
'.$bDesc.'><tr><td>'.$dnBottomDescArticle.'</td></tr></table>';
	}
}



$o[] = '</div>';// End box


// POS FOOTER
if ($pR) {



	if (isset($d['common']->amount_tendered) &&
$d['common']->amount_tendered > 0 &&
isset($d['common']->amount_change) &&
($d['common']->amount_change > 0 ||
$d['common']->amount_change == 0)) {
		//$oPr[] =
$pP->printLine(array(JText::_('COM_PHOCACART_RECEIPT_AMOUNT_TENDERED').':
'.$d['price']->getPriceFormat($d['common']->amount_tendered)),
'pLeft');
		//$oPr[] =
$pP->printLine(array(JText::_('COM_PHOCACART_RECEIPT_AMOUNT_CHANGED').':
'.$d['price']->getPriceFormat($d['common']->amount_change)),
'pLeft');
		$oPr[] =
$pP->printLineColumns(array(JText::_('COM_PHOCACART_RECEIPT_AMOUNT_TENDERED').':
',
$d['price']->getPriceFormat($d['common']->amount_tendered)));
		$oPr[] =
$pP->printLineColumns(array(JText::_('COM_PHOCACART_RECEIPT_AMOUNT_CHANGED').':
',
$d['price']->getPriceFormat($d['common']->amount_change)));
		$oPr[] = $pP->printFeed(1);
	}


	$oPr[] =
$pP->printLine(array(JText::_('COM_PHOCACART_RECEIPT_NR').':
'.PhocacartOrder::getReceiptNumber($d['common']->id,
$d['common']->date,
$d['common']->receipt_number)), 'pLeft');
	$oPr[] =
$pP->printLine(array(JText::_('COM_PHOCACART_PURCHASE_DATE').':
'.JHtml::date($d['common']->date,
'DATE_FORMAT_LC6')), 'pLeft');
	$oPr[] = $pP->printFeed(1);

	$storeInfoFooterPos = array();
	if ($store_info_footer_pos != '') {
		$store_info_footer_pos 	=
PhocacartText::completeText($store_info_footer_pos,
$d['preparereplace'], 1);
		$storeInfoFooterPos = explode("\n",
strip_tags($store_info_footer_pos));
	}

	$oPr[] = $pP->printLine($storeInfoFooterPos, 'pCenter');

}

JPluginHelper::importPlugin( 'system' );
JPluginHelper::importPlugin('plgSystemMultilanguagesck');

if ($pR) {
	//$oPr2 = implode("\n", $oPr);
	$oPr2 = implode("", $oPr);// new rows set in print library


	\JFactory::getApplication()->triggerEvent('onChangeText',
array(&$oPr2));

	echo $oPr2;
} else {

	$o2 = implode("\n", $o);

	\JFactory::getApplication()->triggerEvent('onChangeText',
array(&$o2));
	echo $o2;
}

?>
layouts/popup_add_to_cart.php000064400000005743151167552070012465
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;
$d['checkout_view_href']    =
'data-dismiss="modal"';
$d['close']                 = '<button
type="button" class="close"
aria-label="'.JText::_('COM_PHOCACART_CLOSE').'"
'. $d['checkout_view_href'].' ><span
aria-hidden="true">&times;</span></button>';
if (isset($d['checkout_view']) &&
$d['checkout_view'] == 1) {
	$d['checkout_view_href'] =
'href="'.$d['link_checkout'].'"';
	$d['close']             = '<a role="button"
class="close"
aria-label="'.JText::_('COM_PHOCACART_CLOSE').'"
'. $d['checkout_view_href'].' ><span
aria-hidden="true">&times;</span></a>';
}
?>
<div id="phAddToCartPopup" class="<?php echo
$d['s']['c']['modal.zoom'] ?>"
tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="<?php echo
$d['s']['c']['modal-dialog'] ?>">
      <div class="<?php echo
$d['s']['c']['modal-content']
?>">
        <div class="<?php echo
$d['s']['c']['modal-header'] ?>">
            <?php echo
$d['s']['c']['class-type'] != 'bs4'
? $d['close'] : '' ?>
		    <h4><span class="<?php echo
$d['s']['i']['info-sign']
?>"></span> <?php echo $d['info_msg']
?></h4>
            <?php echo
$d['s']['c']['class-type'] == 'bs4'
? $d['close'] : '' ?>
        </div>
        <div class="<?php echo
$d['s']['c']['modal-body'] ?>">


            <div class="<?php echo
$d['s']['c']['row'] ?>">
                <div class="<?php echo
$d['s']['c']['col.xs12.sm12.md12'] ?>
ph-center">
                    <?php

                    JPluginHelper::importPlugin('pcv');
                    $results =
\JFactory::getApplication()->triggerEvent('PCVonPopupAddToCartAfterHeader',
array('com_phocacart.popupaddtocart', $d['product'],
$d['products'], $d['total']));
                    echo trim(implode("\n", $results));

                    ?>
                </div>
            </div>

		<div class="<?php echo
$d['s']['c']['row'] ?>">
<div class="<?php echo
$d['s']['c']['col.xs12.sm6.md6'] ?>
ph-center">
<a class="<?php echo
$d['s']['c']['btn.btn-primary'] ?>
ph-btn" role="button" <?php echo
$d['checkout_view_href']; ?> ><span class="<?php
echo $d['s']['i']['shopping-cart']
?>"></span> <?php echo
JText::_('COM_PHOCACART_CONTINUE_SHOPPING'); ?></a>
</div>

<div class="<?php echo
$d['s']['c']['col.xs12.sm6.md6'] ?>
ph-center">
<a class="<?php echo
$d['s']['c']['btn.btn-success'] ?>
ph-btn" role="button" href="<?php echo
$d['link_checkout']; ?>" ><span
class="<?php echo
$d['s']['i']['int-link']
?>"></span> <?php echo
JText::_('COM_PHOCACART_PROCEED_TO_CHECKOUT'); ?></a>
</div>
		</div>
        </div>
		<div class="<?php echo
$d['s']['c']['modal-footer']
?>"></div>
	   </div>
    </div>
</div>


layouts/popup_add_to_compare.php000064400000005166151167552070013161
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;
$d['comparison_view_href']    =
'data-dismiss="modal"';
$d['close']                 = '<button
type="button" class="close"
aria-label="'.JText::_('COM_PHOCACART_CLOSE').'"
'. $d['comparison_view_href'].' ><span
aria-hidden="true">&times;</span></button>';
if (isset($d['comparison_view']) &&
$d['comparison_view'] == 1) {
	$d['comparison_view_href'] =
'href="'.$d['link_comparison'].'"';
	$d['close']             = '<a role="button"
class="close"
aria-label="'.JText::_('COM_PHOCACART_CLOSE').'"
'. $d['comparison_view_href'].' ><span
aria-hidden="true">&times;</span></a>';
}
?>
<div id="phAddToComparePopup" class="<?php echo
$d['s']['c']['modal.zoom'] ?>"
tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="<?php echo
$d['s']['c']['modal-dialog'] ?>">
      <div class="<?php echo
$d['s']['c']['modal-content']
?>">
        <div class="<?php echo
$d['s']['c']['modal-header'] ?>">
          <?php echo
$d['s']['c']['class-type'] != 'bs4'
? $d['close'] : '' ?>
		  <h4><span class="<?php echo
$d['s']['i']['info-sign']
?>"></span> <?php echo $d['info_msg']
?></h4>
            <?php echo
$d['s']['c']['class-type'] == 'bs4'
? $d['close'] : '' ?>
        </div>
        <div class="<?php echo
$d['s']['c']['modal-body'] ?>">

            <?php if (isset($d['info_msg_additional'])
&& $d['info_msg_additional'] != '') { ?>
			<div><?php echo $d['info_msg_additional'];
?></div>
		  <?php } ?>

		<div class="<?php echo
$d['s']['c']['row'] ?>">
<div class="<?php echo
$d['s']['c']['col.xs12.sm6.md6'] ?>
ph-center">
<a class="<?php echo
$d['s']['c']['btn.btn-primary'] ?>
ph-btn" role="button" <?php echo
$d['comparison_view_href']; ?> ><span
class="<?php echo
$d['s']['i']['shopping-cart']
?>"></span> <?php echo
JText::_('COM_PHOCACART_CONTINUE_SHOPPING'); ?></a>
</div>

<div class="<?php echo
$d['s']['c']['col.xs12.sm6.md6'] ?>
ph-center">
<a class="<?php echo
$d['s']['c']['btn.btn-success'] ?>
ph-btn" role="button" href="<?php echo
$d['link_comparison']; ?>" ><span
class="<?php echo
$d['s']['i']['int-link']
?>"></span> <?php echo
JText::_('COM_PHOCACART_PROCEED_TO_COMPARISON_LIST');
?></a>
</div>
		</div>
        </div>
		<div class="<?php echo
$d['s']['c']['modal-footer']
?>"></div>
	   </div>
    </div>
</div>


layouts/popup_add_to_wishlist.php000064400000005134151167552070013374
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;
$d['wishlist_view_href'] =
'data-dismiss="modal"';
$d['close']                 = '<button
type="button" class="close"
aria-label="'.JText::_('COM_PHOCACART_CLOSE').'"
'. $d['wishlist_view_href'].' ><span
aria-hidden="true">&times;</span></button>';
if (isset($d['wishlist_view']) &&
$d['wishlist_view'] == 1) {
	$d['wishlist_view_href'] =
'href="'.$d['link_wishlist'].'"';
	$d['close']             = '<a role="button"
class="close"
aria-label="'.JText::_('COM_PHOCACART_CLOSE').'"
'. $d['wishlist_view_href'].' ><span
aria-hidden="true">&times;</span></a>';
}
?>
<div id="phAddToWishListPopup" class="<?php echo
$d['s']['c']['modal.zoom'] ?>"
tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="<?php echo
$d['s']['c']['modal-dialog'] ?>">
      <div class="<?php echo
$d['s']['c']['modal-content']
?>">
        <div class="<?php echo
$d['s']['c']['modal-header'] ?>">
          <?php echo
$d['s']['c']['class-type'] != 'bs4'
? $d['close'] : '' ?>
		  <h4><span class="<?php echo
$d['s']['i']['info-sign']
?>"></span> <?php echo $d['info_msg']
?></h4>
            <?php echo
$d['s']['c']['class-type'] == 'bs4'
? $d['close'] : '' ?>
        </div>
        <div class="<?php echo
$d['s']['c']['modal-body'] ?>">

            <?php if (isset($d['info_msg_additional'])
&& $d['info_msg_additional'] != '') { ?>
			<div><?php echo $d['info_msg_additional'];
?></div>
		  <?php } ?>

		<div class="<?php echo
$d['s']['c']['row'] ?>">
<div class="<?php echo
$d['s']['c']['col.xs12.sm6.md6'] ?>
ph-center">
<a class="<?php echo
$d['s']['c']['btn.btn-primary'] ?>
ph-btn" role="button" <?php echo
$d['wishlist_view_href']; ?> ><span class="<?php
echo $d['s']['i']['shopping-cart']
?>"></span> <?php echo
JText::_('COM_PHOCACART_CONTINUE_SHOPPING'); ?></a>
</div>

<div class="<?php echo
$d['s']['c']['col.xs12.sm6.md6'] ?>
ph-center">
<a class="<?php echo
$d['s']['c']['btn.btn-success'] ?>
ph-btn" role="button" href="<?php echo
$d['link_wishlist']; ?>" ><span
class="<?php echo
$d['s']['i']['int-link']
?>"></span> <?php echo
JText::_('COM_PHOCACART_PROCEED_TO_WISH_LIST'); ?></a>
</div>
		</div>
        </div>
		<div class="<?php echo
$d['s']['c']['modal-footer']
?>"></div>
	   </div>
    </div>
</div>


layouts/popup_container_iframe.php000064400000003370151167552070013521
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

$d          = $displayData;
$s          = $d['s'];
$d['close'] = '<button type="button"
class="close"
aria-label="'.JText::_('COM_PHOCACART_CLOSE').'"
data-dismiss="modal" ><span
aria-hidden="true">&times;</span></button>';

?>
<div id="<?php echo $d['id'] ?>"
class="<?php echo $s['c']['modal.zoom']
?>" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true"
style="display:none">
    <div class="<?php echo
$s['c']['modal-dialog'] ?> <?php echo
$s['c']['modal-lg'] ?>">
      <div class="<?php echo
$s['c']['modal-content'] ?>">
        <div class="<?php echo
$s['c']['modal-header'] ?>">
          <?php echo
$d['s']['c']['class-type'] != 'bs4'
? $d['close'] : '' ?>
		  <h4><span class="<?php echo $d['icon']
?>"></span> <?php echo $d['title'];
?></h4>
            <?php echo
$d['s']['c']['class-type'] == 'bs4'
? $d['close'] : '' ?>
        </div>
        <div class="<?php echo
$s['c']['modal-body'] ?>">
			<?php
            /* We paste the iframe dynamically per Javascript so it does
not include previous instance at start
                <iframe frameborder="0"></iframe>
               
administrator/components/com_phocacart/libraries/phocacart/render/js.php
                public static function renderAjaxAskAQuestion($options =
array()) {
             */
			?>
        </div>
		<div class="<?php echo
$s['c']['modal-footer'] ?>"></div>
	   </div>
    </div>
</div>

layouts/popup_error.php000064400000002610151167552070011341
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;
$d['close'] = '<button type="button"
class="close"
aria-label="'.JText::_('COM_PHOCACART_CLOSE').'"
data-dismiss="modal" ><span
aria-hidden="true">&times;</span></button>';

?>
<div id="phAddToCartPopup" class="<?php echo
$d['s']['c']['modal.zoom'] ?>"
tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="<?php echo
$d['s']['c']['modal-dialog'] ?>">
      <div class="<?php echo
$d['s']['c']['modal-content']
?>">
        <div class="<?php echo
$d['s']['c']['modal-header'] ?>">
          <?php echo
$d['s']['c']['class-type'] != 'bs4'
? $d['close'] : '' ?>
		  <h4><span class="<?php echo
$d['s']['i']['info-sign']
?>"></span> <?php echo
JText::_('COM_PHOCACART_ERROR'); ?></h4>
            <?php echo
$d['s']['c']['class-type'] == 'bs4'
? $d['close'] : '' ?>
        </div>
        <div class="<?php echo
$d['s']['c']['modal-body'] ?>">
			<?php echo $d['info_msg']; ?>
        </div>
		<div class="<?php echo
$d['s']['c']['modal-footer']
?>"></div>
	   </div>
    </div>
</div>


layouts/popup_quickview.php000064400000003011151167552070012213
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

/*
 * SET IN DEFAULT_QUICKVIEW.PHP of ITEM View
components/com_phocacart/views/item/tmpl/default_quickview.php
 *
 */
$d = $displayData;
$d['close'] = '<button type="button"
class="close"
aria-label="'.JText::_('COM_PHOCACART_CLOSE').'"
data-dismiss="modal" ><span
aria-hidden="true">&times;</span></button>';

?>
<div id="phQuickViewPopup" class="<?php echo
$s['c']['modal.zoom'] ?>"
tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="<?php echo
$s['c']['modal-dialog'] ?> <?php echo
$s['c']['modal-lg'] ?>">
      <div class="<?php echo
$s['c']['modal-content'] ?>">
        <div class="<?php echo
$s['c']['modal-header'] ?>">
          <?php echo
$d['s']['c']['class-type'] != 'bs4'
? $d['close'] : '' ?>
		  <h4><span class="<?php echo
$d['s']['i']['quick-view']
?>"></span> <?php echo
JText::_('COM_PHOCACART_QUICK_VIEW'); ?></h4>
            <?php echo
$d['s']['c']['class-type'] == 'bs4'
? $d['close'] : '' ?>
        </div>
        <div class="<?php echo
$s['c']['modal-body'] ?>">
			<?php echo $d['content']; ?>
        </div>
		<div class="<?php echo
$s['c']['modal-footer'] ?>"></div>
	   </div>
    </div>
</div>
layouts/popup_remove_from_compare.php000064400000005520151167552070014241
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;
$d['comparison_view_href'] =
'data-dismiss="modal"';
if (isset($d['comparison_view']) &&
$d['comparison_view'] == 1) {
	$d['comparison_view_href'] =
'href="'.$d['link_comparison'].'"';
}
$d['comparison_view_href']    =
'data-dismiss="modal"';
$d['close']                 = '<button
type="button" class="close"
aria-label="'.JText::_('COM_PHOCACART_CLOSE').'"
'. $d['comparison_view_href'].' ><span
aria-hidden="true">&times;</span></button>';
if (isset($d['comparison_view']) &&
$d['comparison_view'] == 1) {
	$d['comparison_view_href'] =
'href="'.$d['link_comparison'].'"';
	$d['close']             = '<a role="button"
class="close"
aria-label="'.JText::_('COM_PHOCACART_CLOSE').'"
'. $d['comparison_view_href'].' ><span
aria-hidden="true">&times;</span></a>';
}

?>
<div id="phRemoveFromComparePopup" class="<?php echo
$d['s']['c']['modal.zoom'] ?>"
tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="<?php echo
$d['s']['c']['modal-dialog'] ?>">
      <div class="<?php echo
$d['s']['c']['modal-content']
?>">
        <div class="<?php echo
$d['s']['c']['modal-header'] ?>">
          <?php echo
$d['s']['c']['class-type'] != 'bs4'
? $d['close'] : '' ?>
		  <h4><span class="<?php echo
$d['s']['i']['info-sign']
?>"></span> <?php echo $d['info_msg']
?></h4>
            <?php echo
$d['s']['c']['class-type'] == 'bs4'
? $d['close'] : '' ?>

        </div>
        <div class="<?php echo
$d['s']['c']['modal-body'] ?>">

            <?php if (isset($d['info_msg_additional'])
&& $d['info_msg_additional'] != '') { ?>
			<div><?php echo $d['info_msg_additional'];
?></div>
		  <?php } ?>

		<div class="<?php echo
$d['s']['c']['row'] ?>">
			<div class="<?php echo
$d['s']['c']['col.xs12.sm6.md6'] ?>
ph-center">
			<a class="<?php echo
$d['s']['c']['btn.btn-primary'] ?>
ph-btn" role="button" <?php echo
$d['comparison_view_href']; ?> ><span
class="<?php echo
$d['s']['i']['shopping-cart']
?>"></span> <?php echo
JText::_('COM_PHOCACART_CONTINUE_SHOPPING'); ?></a>
			</div>

			<div class="<?php echo
$d['s']['c']['col.xs12.sm6.md6'] ?>
ph-center">
			<a class="<?php echo
$d['s']['c']['btn.btn-success'] ?>
ph-btn" role="button" href="<?php echo
$d['link_comparison']; ?>" ><span
class="<?php echo
$d['s']['i']['int-link']
?>"></span> <?php echo
JText::_('COM_PHOCACART_PROCEED_TO_COMPARISON_LIST');
?></a>
			</div>
		</div>
        </div>
		<div class="<?php echo
$d['s']['c']['modal-footer']
?>"></div>
	   </div>
    </div>
</div>


layouts/popup_remove_from_wishlist.php000064400000005164151167552070014465
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;
$d['wishlist_view_href'] =
'data-dismiss="modal"';
$d['close']                 = '<button
type="button" class="close"
aria-label="'.JText::_('COM_PHOCACART_CLOSE').'"
'. $d['wishlist_view_href'].' ><span
aria-hidden="true">&times;</span></button>';
if (isset($d['wishlist_view']) &&
$d['wishlist_view'] == 1) {
	$d['wishlist_view_href'] =
'href="'.$d['link_wishlist'].'"';
	$d['close']             = '<a role="button"
class="close"
aria-label="'.JText::_('COM_PHOCACART_CLOSE').'"
'. $d['wishlist_view_href'].' ><span
aria-hidden="true">&times;</span></a>';
}

?>
<div id="phRemoveFromWishListPopup" class="<?php echo
$d['s']['c']['modal.zoom'] ?>"
tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="<?php echo
$d['s']['c']['modal-dialog'] ?>">
      <div class="<?php echo
$d['s']['c']['modal-content']
?>">
        <div class="<?php echo
$d['s']['c']['modal-header'] ?>">
         <?php echo
$d['s']['c']['class-type'] != 'bs4'
? $d['close'] : '' ?>
		  <h4><span class="<?php echo
$d['s']['i']['info-sign']
?>"></span> <?php echo $d['info_msg']
?></h4>
            <?php echo
$d['s']['c']['class-type'] == 'bs4'
? $d['close'] : '' ?>
        </div>
        <div class="<?php echo
$d['s']['c']['modal-body'] ?>">

            <?php if (isset($d['info_msg_additional'])
&& $d['info_msg_additional'] != '') { ?>
			<div><?php echo $d['info_msg_additional'];
?></div>
		  <?php } ?>

		<div class="<?php echo
$d['s']['c']['row'] ?>">
			<div class="<?php echo
$d['s']['c']['col.xs12.sm6.md6'] ?>
ph-center">
			<a class="<?php echo
$d['s']['c']['btn.btn-primary'] ?>
ph-btn" role="button" <?php echo
$d['wishlist_view_href']; ?> ><span class="<?php
echo $d['s']['i']['shopping-cart']
?>"></span> <?php echo
JText::_('COM_PHOCACART_CONTINUE_SHOPPING'); ?></a>
			</div>

			<div class="<?php echo
$d['s']['c']['col.xs12.sm6.md6'] ?>
ph-center">
			<a class="<?php echo
$d['s']['c']['btn.btn-success'] ?>
ph-btn" role="button" href="<?php echo
$d['link_wishlist']; ?>" ><span
class="<?php echo
$d['s']['i']['int-link']
?>"></span> <?php echo
JText::_('COM_PHOCACART_PROCEED_TO_WISH_LIST'); ?></a>
			</div>
		</div>
        </div>
		<div class="<?php echo
$d['s']['c']['modal-footer']
?>"></div>
	   </div>
    </div>
</div>


layouts/product_id.php000064400000004601151167552070011123
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d  = $displayData;
$x	= $d['x'];

echo '<div id="phItemIdBox'. $d['typeview'] .
(int)$d['product_id'] .'">';
echo '<div class="'.
$d['class'].'">';
	
if (isset($x->sku) && $x->sku != '') {
	echo '<div class="ph-item-sku-box">';
	echo '<div
class="ph-sku-txt">'.JText::_('COM_PHOCACART_SKU').':</div>';
	echo '<div
class="ph-sku">'.$x->sku.'</div>';
	echo '</div>';
	echo '<div class="ph-cb"></div>';
}
if (isset($x->ean) && $x->ean != '') {
	echo '<div class="ph-item-ean-box">';
	echo '<div
class="ph-ean-txt">'.JText::_('COM_PHOCACART_EAN').':</div>';
	echo '<div
class="ph-ean">'.$x->ean.'</div>';
	echo '</div>';
	echo '<div class="ph-cb"></div>';
}
if (isset($x->upc) && $x->upc != '') {
	echo '<div class="ph-item-upc-box">';
	echo '<div
class="ph-upc-txt">'.JText::_('COM_PHOCACART_UPC').':</div>';
	echo '<div
class="ph-upc">'.$x->upc.'</div>';
	echo '</div>';
	echo '<div class="ph-cb"></div>';
}
if (isset($x->jan) && $x->jan != '') {
	echo '<div class="ph-item-jan-box">';
	echo '<div
class="ph-jan-txt">'.JText::_('COM_PHOCACART_JAN').':</div>';
	echo '<div
class="ph-jan">'.$x->jan.'</div>';
	echo '</div>';
	echo '<div class="ph-cb"></div>';
}
if (isset($x->isbn) && $x->isbn != '') {
	echo '<div class="ph-item-isbn-box">';
	echo '<div
class="ph-isbn-txt">'.JText::_('COM_PHOCACART_ISBN').':</div>';
	echo '<div
class="ph-isbn">'.$x->isbn.'</div>';
	echo '</div>';
	echo '<div class="ph-cb"></div>';
}
if (isset($x->mpn) && $x->mpn != '') {
	echo '<div class="ph-item-mpn-box">';
	echo '<div
class="ph-mpn-txt">'.JText::_('COM_PHOCACART_MPN').':</div>';
	echo '<div
class="ph-mpn">'.$x->mpn.'</div>';
	echo '</div>';
	echo '<div class="ph-cb"></div>';
}
if (isset($x->serial_number) && $x->serial_number !=
'') {
	echo '<div class="ph-item-serial-number-box">';
	echo '<div
class="ph-serial-number-txt">'.JText::_('COM_PHOCACART_SERIAL_NUMBER').':</div>';
	echo '<div
class="ph-serial-number">'.$x->serial_number.'</div>';
	echo '</div>';
	echo '<div class="ph-cb"></div>';
}

echo '</div>';
echo '</div>';
?>layouts/product_image.php000064400000015140151167552070011611
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d                      = $displayData;
$productIdName			=
'V'.$d['typeview'].'P'.(int)$d['product_id'];
$altValue               =
PhocaCartImage::getAltTitle($d['title'],
$d['image']['image']->original);

if ($d['typeview'] == 'Pos') {
    $d['t']['lazy_load_category_items'] = 0;
}


$class          =
$d['s']['c']['img-responsive'].'
ph-image '. $d['image']['phil'].'
phjProductImage'.$productIdName;
$classSwitch    =
$d['s']['c']['img-responsive'].'
ph-image phIR phjProductImageNoChange'.$productIdName;
$classSource    = 'phjProductSource'.$productIdName;
$classLazyLoad  = '';
if ($d['t']['lazy_load_category_items'] == 1) {
    $classLazyLoad = 'ph-lazyload';
    $class = $classLazyLoad . '
'.$d['s']['c']['img-responsive'].'
ph-image phjProductImage'.$productIdName;// Remove
$d['image']['phil'] for lazy loads (switch image
disabled)
}


$src            =
JURI::base(true).'/'.$d['image']['image']->rel;
$srcImg         =
JURI::base(true).'/'.$d['image']['image']->rel;
// fallback
$dataImg        =
JURI::base(true).'/'.$d['image']['default']->rel;
// switch - back to default

$srcPlaceHolder = 'data:image/svg+xml,%3Csvg
xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0
'.(int)$d['t']['medium_image_width'] .'
'.(int)$d['t']['medium_image_height']
.'\'%3E%3C/svg%3E';



echo '<div class="phIBoxOH '. $d['layouttype']
. '">';
echo '<div class="phIBox
'.$classLazyLoad.'">';

if ($d['t']['display_webp_images'] == 1) {

    $srcWebP        =
JURI::base(true).'/'.$d['image']['image']->rel_webp;
    $srcSetWebP     =
JURI::base(true).'/'.$d['image']['image']->rel_webp;
    $dataImgWebP    =
JURI::base(true).'/'.$d['image']['default']->rel_webp;

    if ($d['t']['lazy_load_category_items'] == 1) {

        echo '<picture>';
        //echo '<source type="image/webp"
data-src="'. $srcWebP.'" alt="' . $altValue .
'" class="' . $class . '" ' .
$d['image']['style'] . ' data-srcset="'
. $srcSetWebP . '" data-image="' . $dataImgWebP .
'" />';
       // echo '<source type="image/webp"
data-src="'. $srcWebP.'" alt="' . $altValue .
'"  data-srcset="' . $srcSetWebP . '"
data-image="' . $dataImgWebP . '" />';// TEST

        // TEST 2 (removed data-src because it is transformed to src in
picture tag which is obsolete)
        // class needed because of chaning attributes - changing attributes
changes images
        echo '<source type="image/webp" alt="'
. $altValue . '"  data-srcset="' . $srcSetWebP .
'" data-image="' . $dataImgWebP . '"
class="'.$classSource.'" />';


        echo '<img src="'.$srcPlaceHolder.'"
data-src="'. $src.'"
alt="'.$altValue.'"
class="'.$class.'"
'.$d['image']['style'].'
data-image="'. $dataImg.'" />';
        echo '</picture>';

    } else {

        echo '<picture>';
        //echo '<source type="image/webp"
alt="' . $altValue . '" class="' . $class .
'" ' . $d['image']['style'] . '
srcset="' . $srcSetWebP . '" data-image="' .
$dataImg . '" />';
        // class needed because of chaning attributes - changing attributes
changes images
        echo '<source type="image/webp" alt="'
. $altValue . '"  srcset="' . $srcSetWebP .
'" data-image="' . $dataImg . '"
class="'.$classSource.'" />';// TEST
        echo '<img src="' . $srcImg . '"
alt="' . $altValue . '" class="' . $class .
'" ' . $d['image']['style'] . '
data-image="' . $dataImg . '" />';
        echo '</picture>';

        // Switch
        if (isset($d['image']['second']->rel_webp)
&& $d['image']['second']->rel_webp !=
'') {
            $switchImg      =
JURI::base(true).'/'.$d['image']['second']->rel_webp;
// switch
            echo '<span class="phIRBox"><img
src="'. $switchImg.'"
alt="'.$altValue.'"
class="'.$classSwitch.'" '.
$d['image']['style'].' /></span>';
        }

    }

} else {

    if ($d['t']['lazy_load_category_items'] == 1) {

        echo '<img src="'.$srcPlaceHolder.'"
data-src="'. $src.'"
alt="'.$altValue.'"
class="'.$class.'"
'.$d['image']['style'].'
data-image="'. $dataImg.'" />';

    } else {

        echo '<img src="'. $src.'"
alt="'.$altValue.'"
class="'.$class.'"
'.$d['image']['style'].'
data-image="'. $dataImg.'" />';

        // Switch
        if (isset($d['image']['second']->rel)
&& $d['image']['second']->rel !=
'') {
            $switchImg      =
JURI::base(true).'/'.$d['image']['second']->rel;
// switch
            echo '<span class="phIRBox"><img
src="'. $switchImg.'"
alt="'.$altValue.'"
class="'.$classSwitch.'" '.
$d['image']['style'].' /></span>';
        }

    }
}


echo '</div>';// end phIBox
echo '</div>';// end phIBoxOH

/*
 *
 *
 *     //$class  = 'ph-lazy img-responsive ph-image '.
$d['image']['phil'].'
phjProductImage'.$productIdName;
data-src="'. $src.'" - is in webp source for
    //echo '<img src="data:image/svg+xml,%3Csvg
xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 640
428\'%3E%3C/svg%3E" data-src="'.
JURI::base(true).'/'.$d['image']->rel.'"
alt="'.$altValue.'" class="ph-lazy img-responsive
ph-image '. $d['image']['phil'].'
phjProductImage'.$productIdName.'"
'.$d['image']['style'].'
data-image="'.
JURI::base(true).'/'.$d['default_image']->rel.'"
/>';

		//echo '<img src="data:image/svg+xml,%3Csvg
xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 640
428\'%3E%3C/svg%3E"  data-src="'.
JURI::base(true).'/'.$d['image']->rel.'"
alt="'.$altValue.'" class="ph-lazy img-responsive
ph-image '. $d['image']['phil'].'
phjProductImage'.$productIdName.'"
'.$d['image']['style'].'
data-image="'.
JURI::base(true).'/'.$d['default_image']->rel.'"
/>';

echo '<picture>';



echo '<source type="image/webp"
alt="'.$altValue.'"  data-src="'.
JURI::base(true).'/'.$d['image']->rel_webp.'"
alt="'.$altValue.'"  data-srcset="'.
JURI::base(true).'/'.$d['image']->rel_webp.'"
alt="'.$altValue.'"  class="ph-lazy img-responsive
ph-image '. $d['image']['phil'].'
phjProductImage'.$productIdName.'"
'.$d['image']['style'].'
data-image="'.
JURI::base(true).'/'.$d['default_image']->rel.'"
/>';

echo '<img src="data:image/svg+xml,%3Csvg
xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 640
428\'%3E%3C/svg%3E" data-src="'.
JURI::base(true).'/'.$d['image']->rel.'"
alt="'.$altValue.'" class="ph-lazy img-responsive
ph-image '. $d['image']['phil'].'
phjProductImage'.$productIdName.'"
'.$d['image']['style'].'
data-image="'.
JURI::base(true).'/'.$d['default_image']->rel.'"
/>';

echo '</picture>';
*/

?>
layouts/product_order_quantity.php000064400000001066151167552070013602
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;
?>
<div class="ph-item-min-qty-box">
	<div class="ph-min-qty-txt"><?php echo
$d['text']; ?></div>
	<div class="ph-min-qty"><?php echo
$d['status']; ?></div>
</div>
<div class="ph-cb"></div>
layouts/product_play.php000064400000003044151167552070011474
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;

if (isset($d['publicplayfile']) &&
$d['publicplayfile'] != '') {

    $ext =
\Joomla\CMS\Filesystem\File::getExt($d['publicplayfile']);

    echo '<div class="ph-item-play-file">';
    if (isset($d['title']) && $d['title'] !=
'') {
        echo '<div
class="ph-item-play-title">'.$d['title'].'</div>';
    }
    switch($ext) {

        case 'mp3':
        case 'm4a':
            echo '<audio controls><source
src="'.$d['pathpublicfile']['orig_rel_path_ds'].$d['publicplayfile'].'"
type="audio/mpeg"></audio>';
        break;

        case 'ogg':
        case 'oga':
            echo '<audio controls><source
src="'.$d['pathpublicfile']['orig_rel_path_ds'].$d['publicplayfile'].'"
type="audio/ogg"></audio>';
        break;

        case 'mp4':
        case 'm4v':
            echo '<video controls><source
src="'.$d['pathpublicfile']['orig_rel_path_ds'].$d['publicplayfile'].'"
type="video/mp4"></video>';
        break;

        case 'ogv':
            echo '<video controls><source
src="'.$d['pathpublicfile']['orig_rel_path_ds'].$d['publicplayfile'].'"
type="video/ogg"></video>';
        break;

        default:


        break;

    }
    echo '</div>';
}
layouts/product_price.php000064400000020457151167552070011640
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$paramsC 					= PhocacartUtils::getComponentParameters();
$zero_price_text			= $paramsC->get( 'zero_price_text',
'' );
$zero_price_label			= $paramsC->get( 'zero_price_label',
'' );
$price_on_demand_text       = $paramsC->get(
'price_on_demand_text', '' );
$price_on_demand_label      = $paramsC->get(
'price_on_demand_label', '' );
if ($zero_price_label == '0') {

}

$d 			= $displayData;
$classPS	= 'ph-standard';// class price suffix
if (isset($d['discount']) && $d['discount']) {
	$classPS	= 'ph-line-through';
}

?>
<div id="phItemPriceBox<?php echo $d['typeview'] .
(int)$d['product_id']; ?>">
	<div class="<?php echo $d['class']; ?>">
	<?php if
(isset($d['priceitemsorig']['bruttoformat']) &&
$d['priceitemsorig']['bruttoformat']) { ?>
		<div class="ph-price-txt ph-price-original-txt"><?php
echo JText::_('COM_PHOCACART_ORIGINAL_PRICE') ?></div>
		<div class="ph-price-original"><?php echo
$d['priceitemsorig']['bruttoformat'] ?></div>
	<?php } ?>

	<?php /*
	if ($d['priceitemsorig']['brutto'] >
$d['priceitems']['brutto']) {
		if (isset($d['priceitemsorig']['bruttoformat'])
&& $d['priceitemsorig']['bruttoformat']) {
?>
			<div class="ph-price-txt"><?php echo
JText::_('COM_PHOCACART_ORIGINAL_PRICE') ?></div>
			<div class="ph-price-original"><?php echo
$d['priceitemsorig']['bruttoformat'] ?></div>
	<?php }
	} */ ?>
	<?php


    // Display Price - there are a lot of variants
    // a) when e.g. price is zero, different text can be displayed
    // b) when product type (PRODUCTTYPE) is "Price On Demand" -
different text can be displayed (it can overwrite zero_price but if not
set, zero_price text and label are active
    $labelNetto     = '';
    $labelTax       = '';
    $labelBrutto    = '';

    $priceNetto     = '';
    $priceTax       = '';
    $priceBrutto    = '';

    $displayPrice   = 1;// At start display price = yes. If there will be
some condition which will hide the price then use the information e.g. for
discount prices (even disable them)

    if ($d['priceitems']['netto'] &&
$d['priceitems']['taxcalc'] > 0 &&
($d['priceitems']['netto'] !=
$d['priceitems']['brutto'])) {
		$labelNetto = '<div class="ph-price-txt ph-price-netto-txt
'.$classPS.'-txt">'.
$d['priceitems']['nettotxt'].'</div>';
		$priceNetto = '<div class="ph-price-netto
'.$classPS.'">'.$d['priceitems']['nettoformat'].'</div>';
	}

	if ($d['priceitems']['tax'] &&
$d['priceitems']['taxcalc'] > 0) {
		$labelTax = '<div class="ph-tax-txt
'.$classPS.'-txt">'.$d['priceitems']['taxtxt'].'</div>';
		$priceTax = '<div class="ph-tax
'.$classPS.'">'.$d['priceitems']['taxformat'].'</div>';
	}

	if (isset($d['priceitems']['brutto'])) {
		$labelBrutto = '<div class="ph-price-txt ph-price-brutto-txt
'.$classPS.'-txt">'.$d['priceitems']['bruttotxt'].'</div>';
		$priceBrutto = '<div class="ph-price-brutto
'.$classPS.'">'.$d['priceitems']['bruttoformat'].'</div>';
	}


    if (isset($d['priceitems']['brutto']) &&
$d['priceitems']['brutto'] == 0 &&
isset($d['zero_price']) && $d['zero_price'] ==
1) {
        $labelNetto     = '';
        $labelTax       = '';
        $priceNetto     = '';
        $priceTax       = '';

		// Text and Label instead of zero price
		// Label - Nothing | Custom Text | Standard "Price" String
(ONLY IN CASE THE PRICE IS ZERO)
        if ($zero_price_label == '0') {
			$labelBrutto = '<div class="ph-price-txt
'.$classPS.'-txt"></div>';
		} else if ($zero_price_label != '') {
			$labelBrutto = '<div class="ph-price-txt
'.$classPS.'-txt">'.JText::_($zero_price_label).'</div>';
		} else {
			$labelBrutto = '<div class="ph-price-txt
'.$classPS.'-txt">'.$d['priceitems']['bruttotxt'].'</div>';
		}

        // Price - Custom Text | Standard Price (ONLY IN CASE THE PRICE IS
ZERO)
		if ($zero_price_text == '0') {
			$priceBrutto = '<div class="ph-price-brutto
'.$classPS.'>-txt"></div>';
			$displayPrice   = 0;
		} else if ($zero_price_text != '') {
			$priceBrutto = '<div class="ph-price-brutto
'.$classPS.'">'.JText::_($zero_price_text).'</div>';
			$displayPrice   = 0;
		} else {
			$priceBrutto = '<div class="ph-price-brutto
'.$classPS.'">'.$d['priceitems']['bruttoformat'].'</div>';
		}

    }

    if (isset($d['type']) && $d['type'] == 3)
{

        $labelNetto     = '';
        $labelTax       = '';
        $priceNetto     = '';
        $priceTax       = '';

        if ($price_on_demand_label == '0') {
            $labelBrutto    = '<div class="ph-price-txt
'.$classPS.'-txt"></div>';
            $displayPrice   = 0;
        } else if ($price_on_demand_label != '') {
            $labelBrutto    = '<div class="ph-price-txt
'.$classPS.'-txt">'.JText::_($price_on_demand_label).'</div>';
            $displayPrice   = 0;
        }

        if ($price_on_demand_text == '0') {
            $priceBrutto    = '<div class="ph-price-brutto
'.$classPS.'-txt"></div>';
            $displayPrice   = 0;
        } else if ($price_on_demand_text != '') {
            $priceBrutto    = '<div class="ph-price-brutto
'.$classPS.'-txt">'.JText::_($price_on_demand_text).'</div>';
            $displayPrice   = 0;
        }
    }



    echo $labelNetto . $priceNetto;
    echo $labelTax . $priceTax;
    echo $labelBrutto . $priceBrutto;

	?>




	<?php

	// PRODUCT DISCOUNT
	if (isset ($d['discount']) && $d['discount']
&& $displayPrice == 1) { ?>
		<?php if ($d['priceitemsdiscount']['netto']
&& $d['priceitemsdiscount']['taxcalc'] > 0
                    &&
($d['priceitemsdiscount']['brutto'] !=
$d['priceitemsdiscount']['netto'])) { ?>
			<div class="ph-price-txt ph-price-netto-txt
ph-price-discount"><?php echo
$d['priceitemsdiscount']['nettotxt'] ?></div>
			<div class="ph-price-netto ph-price-discount"><?php
echo $d['priceitemsdiscount']['nettoformat']
?></div>
		<?php } ?>

		<?php if ($d['priceitemsdiscount']['tax']
&& $d['priceitemsdiscount']['taxcalc'] > 0)
{ ?>
			<div class="ph-tax-txt ph-price-discount"><?php echo
$d['priceitemsdiscount']['taxtxt'] ?></div>
			<div class="ph-tax ph-price-discount"><?php echo
$d['priceitemsdiscount']['taxformat']
?></div>
		<?php } ?>

		<?php if ($d['priceitemsdiscount']['brutto']) {
?>
			<div class="ph-price-txt ph-price-brutto-txt
ph-price-discount"><?php echo
$d['priceitemsdiscount']['bruttotxt']
?></div>
			<div class="ph-price-brutto ph-price-discount
ph-price-discount-product"><?php echo
$d['priceitemsdiscount']['bruttoformat']
?></div>
		<?php } ?>
	<?php }?>

	<?php
	// CART DISCOUNT DISPLAYED IN PRODUCT VIEWS (under specific conditions
only)
	if (isset ($d['discountcart']) &&
$d['discountcart'] && $displayPrice == 1) { ?>
		<?php if ($d['priceitemsdiscountcart']['netto']
&& $d['priceitemsdiscountcart']['taxcalc'] >
0
                &&
($d['priceitemsdiscountcart']['brutto'] !=
$d['priceitemsdiscountcart']['netto'])) { ?>
			<div class="ph-price-txt ph-price-netto-txt
ph-price-discount"><?php echo
$d['priceitemsdiscountcart']['nettotxt']
?></div>
			<div class="ph-price-netto ph-price-discount"><?php
echo $d['priceitemsdiscountcart']['nettoformat']
?></div>
		<?php } ?>

		<?php if ($d['priceitemsdiscountcart']['tax']
&& $d['priceitemsdiscountcart']['taxcalc'] >
0) { ?>
			<div class="ph-tax-txt ph-price-discount"><?php echo
$d['priceitemsdiscountcart']['taxtxt']
?></div>
			<div class="ph-tax ph-price-discount"><?php echo
$d['priceitemsdiscountcart']['taxformat']
?></div>
		<?php } ?>

		<?php if ($d['priceitemsdiscountcart']['brutto'])
{ ?>
			<div class="ph-price-txt ph-price-brutto-txt
ph-price-discount"><?php echo
$d['priceitemsdiscountcart']['bruttotxt']
?></div>
			<div class="ph-price-brutto ph-price-discount
ph-price-discount-cart"><?php echo
$d['priceitemsdiscountcart']['bruttoformat']
?></div>
		<?php } ?>
	<?php }?>




	<?php if ($d['priceitems']['baseformat']) { ?>
		<div class="ph-price-txt"><?php echo
JText::_('COM_PHOCACART_UNIT_PRICE') ?></div>
		<div class="ph-price-base"><?php echo
$d['priceitems']['baseformat'] ?></div>
	<?php } ?>

		<div class="ph-cb"></div>
	</div>
</div>
<div class="ph-cb"></div>
layouts/product_rating.php000064400000001347151167552070012017
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;
if ((int)$d['display_star_rating'] > 0 &&
$d['rating'] > 0) {
	?><div class="ph-stars-box"><span
class="ph-stars"><span style="width:<?php echo
((int)$d['rating'] * (int)$d['size'])
?>px;"></span></span></div><?php
} else if ($d['display_star_rating'] == 2) {
	?><div class="ph-stars-box"><span
class="ph-stars"><span style="width:
0px;"></span></span></div><?php
}
?>layouts/product_size.php000064400000004274151167552070011507
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d  = $displayData;
$size = new PhocacartSize();


// Size
$length     = $size->getSizeFormat($d['length']);
$width      = $size->getSizeFormat($d['width']);
$height     = $size->getSizeFormat($d['height']);

echo '<div class="ph-cb"></div>';

if ($length || $width || $height ) {
   // echo '<h4 class="ph-header-size">' .
JText::_('COM_PHOCACART_HEADER_SIZE') . '</h4>';

    echo '<div class="ph-item-size-box">';
    if ($length) {
        echo '<div class="ph-item-length-txt">' .
JText::_('COM_PHOCACART_LENGTH') . ':</div>';
        echo '<div class="ph-item-length">' .
$length . '</div>';
    }
    if ($width) {
        echo '<div class="ph-item-width-txt">' .
JText::_('COM_PHOCACART_WIDTH') . ':</div>';
        echo '<div class="ph-item-width">' .
$width . '</div>';
    }
    if ($height) {
        echo '<div class="ph-item-height-txt">' .
JText::_('COM_PHOCACART_HEIGHT') . ':</div>';
        echo '<div class="ph-item-height">' .
$height . '</div>';
    }
    echo '</div>';
}

// Weight
$weight     = $size->getSizeFormat($d['weight'],
'weight');
if ($weight) {
 //   echo '<h4 class="ph-header-size">' .
JText::_('COM_PHOCACART_HEADER_WEIGHT') .
'</h4>';

    echo '<div class="ph-item-size-box">';
    echo '<div class="ph-item-weight-txt">' .
JText::_('COM_PHOCACART_WEIGHT') . ':</div>';
    echo '<div class="ph-item-weight">' . $weight
. '</div>';
    echo '</div>';
}

// Volume
$volume     = $size->getSizeFormat($d['volume'],
'volume');
if ($volume) {
  //  echo '<h4 class="ph-header-size">' .
JText::_('COM_PHOCACART_HEADER_VOLUME') .
'</h4>';

    echo '<div class="ph-item-size-box">';
    echo '<div class="ph-item-volume-txt">' .
JText::_('COM_PHOCACART_VOLUME') . ':</div>';
    echo '<div class="ph-item-volume">' . $volume
. '</div>';
    echo '</div>';
}

echo '<div class="ph-cb"></div>';

?>
layouts/product_stock.php000064400000001313151167552070011647
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$d = $displayData;

?>
<div id="phItemStockBox<?php echo $d['typeview'] .
(int)$d['product_id']; ?>">
	<div class="<?php echo $d['class']; ?>">
		<div class="ph-stock-txt"><?php echo
JText::_('COM_PHOCACART_AVAILABILITY'); ?>:</div>
		<div class="ph-stock"><?php echo
JText::_($d['stock_status_output']); ?></div>
	</div>
</div>
<div class="ph-cb"></div>
layouts/user_login.php000064400000006004151167552070011134
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
Joomla\CMS\HTML\HTMLHelper::_('behavior.keepalive');
Joomla\CMS\HTML\HTMLHelper::_('bootstrap.tooltip');

require_once
JPATH_SITE.'/components/com_users/helpers/route.php';
jimport( 'joomla.application.module.helper' );
$module = JModuleHelper::getModule('mod_login');
$mP 	= new JRegistry();
$mP->loadString($module->params);

$lang = JFactory::getLanguage();
$lang->load('mod_login');

$d  = $displayData;

echo '<div
class="ph-box-header">'.JText::_('COM_PHOCACART_LOGIN').'</div>'.
"\n";

echo '<form action="'.JRoute::_('index.php',
true, $mP->get('usesecure')).'"
method="post" id="ph-login-form"
class="form-inline" role="form">';

echo '<div id="ph-form-login-username"
class="'.$d['s']['c']['control-group.form_inline'].'">'.
"\n";
echo '<div
class="'.$d['s']['c']['form-group'].'">'.
"\n";
echo '<label class="sr-only"
for="modlgn-username">'.JText::_('MOD_LOGIN_VALUE_USERNAME')
.'</label>'. "\n";
echo '<input id="ph-modlgn-username"
type="text" name="username"
class="form-control" tabindex="0"
placeholder="'.JText::_('MOD_LOGIN_VALUE_USERNAME')
.'" />'. "\n";
echo ' </div>'. "\n";
echo ' <div
class="'.$d['s']['c']['form-group'].'">'.
"\n";
echo '<label class="sr-only"
for="modlgn-passwd">'.JText::_('JGLOBAL_PASSWORD')
.'</label>'. "\n";
echo '<input id="ph-modlgn-passwd"
type="password" name="password"
class="form-control" tabindex="0" size="18"
placeholder="'.JText::_('JGLOBAL_PASSWORD')
.'" />'. "\n";
echo ' </div>'. "\n";

if (JPluginHelper::isEnabled('system', 'remember')) {
    echo '<div id="ph-form-login-remember"
class="checkbox">'. "\n";
    echo '<label for="modlgn-remember"
class="control-label">'.
JText::_('MOD_LOGIN_REMEMBER_ME') .'</label> <input
id="modlgn-remember" type="checkbox"
name="remember" class="inputbox"
value="yes"/>'. "\n";
    echo '</div>'. "\n";
}
echo '<button type="submit" tabindex="0"
name="Submit"
class="'.$d['s']['c']['btn.btn-primary'].'
ph-btn">'. JText::_('JLOGIN')
.'</button>'. "\n";
echo '</div>'. "\n";// end form inline


echo '<ul class="unstyled ph-li-inline">'.
"\n";
echo '<li><a
href="'.JRoute::_('index.php?option=com_users&view=remind').'">'.JText::_('MOD_LOGIN_FORGOT_YOUR_USERNAME').'</a></li>'.
"\n";
echo '<li><a
href="'.JRoute::_('index.php?option=com_users&view=reset').'">'.JText::_('MOD_LOGIN_FORGOT_YOUR_PASSWORD').'</a></li>'.
"\n";
echo '</ul>'. "\n";

echo '<div class="ph-cb"></div>';

echo '<input type="hidden" name="option"
value="com_users" />'. "\n";
echo '<input type="hidden" name="task"
value="user.login" />'. "\n";
echo '<input type="hidden" name="return"
value="'.$d['t']['actionbase64'].'"
/>'. "\n";
echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
echo '</form>';
?>
layouts/user_register.php000064400000002721151167552070011652
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
Joomla\CMS\HTML\HTMLHelper::_('behavior.keepalive');
Joomla\CMS\HTML\HTMLHelper::_('bootstrap.tooltip');

require_once
JPATH_SITE.'/components/com_users/helpers/route.php';
jimport( 'joomla.application.module.helper' );
$module = JModuleHelper::getModule('mod_login');
$mP 	= new JRegistry();
$mP->loadString($module->params);

$lang = JFactory::getLanguage();
$lang->load('mod_login');

$d  = $displayData;


$usersConfig = JComponentHelper::getParams('com_users');
	//echo '<ul class="unstyled">'. "\n";
	if ($usersConfig->get('allowUserRegistration')) {
		echo '<div
class="ph-box-header">'.JText::_('COM_PHOCACART_REGISTER').'</div>'.
"\n";
		//echo '<li><a href="'.
JRoute::_('index.php?option=com_users&view=registration').'">'.JText::_('MOD_LOGIN_REGISTER').'<span
class="icon-arrow-right"></span></a></li>'.
"\n";

		echo '<a
class="'.$d['s']['c']['btn.btn-primary.btn-sm'].'
ph-btn ph-checkout-btn-login" href="'.
JRoute::_('index.php?option=com_users&view=registration').'"><span
class="'.$d['s']['i']['user'].'"></span>
 '.JText::_('MOD_LOGIN_REGISTER').'</a>'.
"\n";

	}
	//echo '</ul>'. "\n";


?>
models/account.php000064400000001015151167552070010202 0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport('joomla.application.component.model');

class PhocaCartModelAccount extends JModelLegacy
{
	public function __construct() {	
		parent::__construct();		
	}
}
?>models/categories.php000064400000014440151167552070010701
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */

use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;

defined('_JEXEC') or die();
jimport('joomla.application.component.model');

class PhocaCartModelCategories extends JModelLegacy
{
	protected $categories 			= null;
	protected $categories_ordering	= null;
	protected $category_ordering		= null;

	public function __construct() {
		parent::__construct();
		$app	= JFactory::getApplication();
		$this->setState('filter.language',$app->getLanguageFilter());
	}

	public function getCategoriesList($displaySubcategories = 0) {
		if (empty($this->categories)) {
			$categoriesOrdering = $this->getCategoryOrdering();

			if ((int)$displaySubcategories > 0) {
				$id = -1; // display subcategories - -1 means to load all items
			} else {
				$id = 0;// display only parent categories
			}

			$query			= $this->getCategoriesListQuery($id, $categoriesOrdering);
			$categories 	= $this->_getList($query);

			if (!empty($categories)) {

				// Parent Only
				foreach ($categories as $k => $v) {
					if ($v->parent_id == 0) {
						$this->categories[$v->id] = $categories[$k];
					}
				}

				// Subcategories
				foreach ($categories as $k => $v) {
					if (isset($this->categories[$v->parent_id])) {
						$this->categories[$v->parent_id]->subcategories[] =
$categories[$k];
						$this->categories[$v->parent_id]->numsubcat++;
					}
				}
			}
			/*
			$this->categories 	= $this->_getList( $query );
			if (!empty($this->categories)) {
				foreach ($this->categories as $key => $value) {
					$query	= $this->getCategoriesListQuery( $value->id,
$categoriesOrdering );
					$this->categories[$key]->subcategories = $this->_getList(
$query );
				}
			}*/

		}
		return $this->categories;
	}

	public function getCategoriesListQuery($id, $categoriesOrdering) {

		$wheres				= array();
		$user 				= PhocacartUser::getUser();
		$userLevels			= implode (',',
$user->getAuthorisedViewLevels());
		$userGroups 		= implode (',',
PhocacartGroup::getGroupsById($user->id, 1, 1));
		$app				= JFactory::getApplication();
		$params 			= $app->getParams();


		$display_categories = $params->get('display_categories',
'');
		$hide_categories 	= $params->get('hide_categories',
'');

		if (!empty($display_categories)) {
			$display_categories = implode(',', $display_categories);
		}
		if (!empty($hide_categories)) {
			$hide_categories = implode(',', $hide_categories);
		}

		if ( $display_categories != '' ) {
			$wheres[] = " c.id IN (".$display_categories.")";
		}

		if ( $hide_categories != '' ) {
			$wheres[] = " c.id NOT IN (".$hide_categories.")";
		}

		$wheres[] = " c.type IN (0,1)";// type: common, onlineshop,
pos

		if ($id == -1) {
			// No limit for parent_id - load all categories include subcategories
		} else {
			$wheres[] = " c.parent_id = " . (int)$id;
		}

		$wheres[] = " c.published = 1";

		if ($this->getState('filter.language')) {
			$wheres[] =  ' c.language IN
('.$this->_db->Quote(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
		}

		$wheres[] = " c.access IN (".$userLevels.")";
		$wheres[] = " (gc.group_id IN (".$userGroups.") OR
gc.group_id IS NULL)";

		/*$query =  " SELECT c.id, c.title, c.alias, c.image, c.description,
c.image as image, c.parent_id as parentid, COUNT(c.id) AS numdoc"
		. " FROM #__phocacart_categories AS c"
		. " LEFT JOIN #__phocacart_products AS a ON a.catid = c.id AND
a.published = 1"
		. " WHERE " . implode( " AND ", $wheres )
		. " GROUP BY c.id"
		. " ORDER BY c.".$categoriesOrdering;*/


		// Views Plugin can load additional columns
		$additionalColumns = array();
		$pluginLayout 	= PluginHelper::importPlugin('pcv');
		if ($pluginLayout) {
			$pluginOptions 				= array();
			$eventData 					= array();
			Factory::getApplication()->triggerEvent('PCVonCategoriesBeforeLoadColumns',
array('com_phocacart.categories', &$pluginOptions,
$eventData));

			if (isset($pluginOptions['columns']) &&
$pluginOptions['columns'] != '') {
				if (!empty($pluginOptions['columns'])) {
					foreach ($pluginOptions['columns'] as $k => $v) {
						$additionalColumns[] = PhocacartText::filterValue($v,
'alphanumeric3');
					}
				}
			}
		}

		$baseColumns = array('c.id', 'c.title',
'c.alias', 'c.image', 'c.description',
'c.icon_class');

		$col = array_merge($baseColumns, $additionalColumns);
		$col = array_unique($col);


		$columns	= implode(',', $col) . ', c.parent_id as
parentid, COUNT(c.id) AS numdoc, c.parent_id, 0 AS numsubcat';
		$groupsFull	= implode(',', $col) . ', c.parent_id';
		$groupsFast	= 'c.id';
		$groups		= PhocacartUtilsSettings::isFullGroupBy() ? $groupsFull :
$groupsFast;


		$query =  'SELECT '.$columns

		. " FROM #__phocacart_categories AS c"
		//. " LEFT JOIN #__phocacart_categories AS s ON s.parent_id = c.id
AND s.published = 1"

		//. " LEFT JOIN #__phocacart_product_categories AS pc ON
pc.category_id = c.id"
		//. " LEFT JOIN #__phocacart_products AS a ON a.id = pc.product_id
AND a.published = 1"
		//. " LEFT JOIN #__phocacart_products AS a ON a.catid = c.id AND
a.published = 1"
		. ' LEFT JOIN #__phocacart_item_groups AS gc ON c.id = gc.item_id
AND gc.type = 2'// type 2 is category
		. " WHERE " . implode( " AND ", $wheres )
		. " GROUP BY ".$groups
		. " ORDER BY ".$categoriesOrdering;
		/*
		$query =  "SELECT c.id, c.title, group_concat(s.title) as subtitle,
group_concat(s.id, ':', s.title, ':', s.alias) as
subalias
					FROM #__phocacart_categories as c LEFT JOIN
						 #__phocacart_categories as s
						 on s.parent_id = c.id
					group by c.id";*/

		//echo nl2br(str_replace('#__', 'jos_',
$query->__toString()));

		return $query;
	}

	public function getCategoryOrdering() {
		if (empty($this->category_ordering)) {
			$app						= JFactory::getApplication();
			$params 					= $app->getParams();
			$ordering					= $params->get( 'category_ordering', 1 );
			$this->category_ordering 	=
PhocacartOrdering::getOrderingText($ordering, 1);
		}
		return $this->category_ordering;
	}
}
?>
models/category.php000064400000044431151167552070010374 0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */

use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
defined('_JEXEC') or die();
jimport('joomla.application.component.model');

class PhocaCartModelCategory extends JModelLegacy
{

	protected $item 				= null;
	protected $item_ordering		= null;
	protected $layout_type			= null;
	protected $category 			= null;
	protected $subcategories 		= null;
	protected $category_ordering	= null;
	protected $pagination			= null;
	protected $total				= null;
	protected $ordering				= null;
	protected $category_layout_plugin	= '';

	public function __construct() {
		parent::__construct();

		$app					= JFactory::getApplication();
		$config 				= JFactory::getConfig();
		$paramsC 				= $app->getParams();
		$item_pagination		= $paramsC->get(
'item_pagination_default', '20' );
		$item_ordering			= $paramsC->get( 'item_ordering', 1 );
		$layout_type			= $paramsC->get( 'layout_type',
'grid' );

		$this->category_layout_plugin	= $paramsC->get(
'category_layout_plugin', '' );

		$manufacturer_alias	= $paramsC->get( 'manufacturer_alias',
'manufacturer');
		$manufacturer_alias	= $manufacturer_alias != '' ?
trim(PhocacartText::filterValue($manufacturer_alias,
'alphanumeric'))  : 'manufacturer';

		$limit					=
PhocacartPagination::getMaximumLimit($app->getUserStateFromRequest('com_phocacart.limit',
'limit', $item_pagination, 'int'));

		$this->setState('limit', $limit);
		$this->setState('limitstart',
$app->input->get('limitstart', 0, 'int'));
		$this->setState('limitstart',
($this->getState('limit') != 0 ?
(floor($this->getState('limitstart') /
$this->getState('limit')) *
$this->getState('limit')) : 0));
		$this->setState('filter.language',$app->getLanguageFilter());
		$this->setState('filter_order',
$app->input->get('filter_order', 'ordering'));
		$this->setState('filter_order_dir',
$app->input->get('filter_order_Dir', 'ASC'));
		$this->setState('itemordering',
$app->getUserStateFromRequest('com_phocacart.itemordering',
'itemordering', $item_ordering, 'int'));
		$this->setState('layouttype',
$app->getUserStateFromRequest('com_phocacart.layouttype',
'layouttype', $layout_type, 'string'));


	}

	public function getLayoutType() {
		$layoutType 	= $this->getState('layouttype');
		$layoutType		= PhocacartRenderFront::getLayoutType($layoutType);
		return $layoutType;
	}

	public function getPagination($categoryId) {
		if (empty($this->pagination)) {
			jimport('joomla.html.pagination');
			$this->pagination = new PhocacartPagination(
$this->getTotal($categoryId),
$this->getState('limitstart'),
$this->getState('limit') );
		}
		return $this->pagination;
	}

	function getOrdering() {
		if(empty($this->ordering)) {
			$this->ordering =
PhocacartOrdering::renderOrderingFront($this->getState('itemordering'),
0);
		}
		return $this->ordering;
	}

	public function getTotal($categoryId) {
		if (empty($this->total)) {
			$query = $this->getItemListQuery($categoryId, 1);
			$this->total = $this->_getListCount($query);
		}
		return $this->total;
	}

	public function getItemList($categoryId) {
		if (empty($this->item)) {
			$query			= $this->getItemListQuery( $categoryId);
			$this->item		= $this->_getList( $query
,$this->getState('limitstart'),
$this->getState('limit'));
		}
		return $this->item;
	}

	public function getCategory($categoryId) {
		if (empty($this->category)) {
			$query					= $this->getCategoriesQuery( $categoryId, FALSE );
			$this->category 		= $this->_getList( $query, 0, 1 );
		}
		return $this->category;
	}

	public function getSubcategories($categoryId) {
		if (empty($this->subcategories)) {
			$query					= $this->getCategoriesQuery( $categoryId, TRUE );
			$this->subcategories 	= $this->_getList( $query );
		}
		return $this->subcategories;
	}

	protected function getItemListQuery($categoryId, $count = 0) {

		$app		= JFactory::getApplication();
		$user 		= PhocacartUser::getUser();
		$userLevels	= implode (',',
$user->getAuthorisedViewLevels());
		$userGroups = implode (',',
PhocacartGroup::getGroupsById($user->id, 1, 1));
		$params 	= $app->getParams();
		$wheres		= array();
		$lefts		= array();


		$skip			        = array();
		$skip['access']	        =
$params->get('sql_products_skip_access', 0);
		$skip['group']	        =
$params->get('sql_products_skip_group', 0);
		$skip['attributes']	    =
$params->get('sql_products_skip_attributes', 0);
		$skip['category_type']  =
$params->get('sql_products_skip_category_type', 0);
		$skip['tax']   			=
$params->get('sql_products_skip_tax', 0);

		$p = array();
		$p['hide_products_out_of_stock']			= $params->get(
'hide_products_out_of_stock', 0);
		$p['switch_image_category_items']			= $params->get(
'switch_image_category_items', 0 );
		$p['display_products_all_subcategories']	= $params->get(
'display_products_all_subcategories', 0 );
		$leftImages = '';
		$selImages = '';
		if ($p['switch_image_category_items'] == 1) {
			$leftImages = ' LEFT JOIN #__phocacart_product_images AS im ON a.id
= im.product_id';
			$selImages	= ' GROUP_CONCAT(im.image) as additional_image,';
		}


		$wheres			= array();
		$subWherePcCat 	= '';

		if ((int)$categoryId > 0) {

			// Standard - only products from one category
			$subWherePcCat 		= ' AND pc.category_id = '.(int)$categoryId;

			// Display products not only from current category but even from all
subcategories
			if ($p['display_products_all_subcategories'] == 1) {
				$categoryChildrenId =
PhocacartCategoryMultiple::getCategoryChildrenString((int)$categoryId,
(string)$categoryId);
				if ($categoryChildrenId !== '') {
					$wheres[]			= " c.id IN
(".$categoryChildrenId.")";
					$subWherePcCat		= " AND pc.category_id IN
(".$categoryChildrenId.")";
				} else {
					$wheres[]			= " c.id = ".(int)$categoryId;
				}
			} else {
				$wheres[]			= " c.id = ".(int)$categoryId;
			}

		}
		$wheres[] = ' a.published = 1';
		$wheres[] = ' c.published = 1';

		if (!$skip['category_type']) {
            $wheres[] = " c.type IN (0,1)";// type: common,
onlineshop, pos
        }

		if ($this->getState('filter.language')) {
			$lang 		= JFactory::getLanguage()->getTag();
			$wheres[] 	=
PhocacartUtilsSettings::getLangQuery('a.language', $lang);
			$wheres[] 	=
PhocacartUtilsSettings::getLangQuery('c.language', $lang);
		}
		$itemOrdering = $this->getItemOrdering();

		// BE AWARE
		// g.item_id is in this case product_id: phocacart_item_groups table is
used for more instances: user, product, category
		// so item_id in case type = 3 is product_id, items_id in case type = 2
is category_id
		// see types:
administrator\components\com_phocacart\libraries\phocacart\group\group.php


		if (!$skip['access']) {
			$wheres[] = " c.access IN (".$userLevels.")";
			$wheres[] = " a.access IN (".$userLevels.")";
		}

		if (!$skip['group']) {
			$wheres[] = " (ga.group_id IN (".$userGroups.") OR
ga.group_id IS NULL)";
			$wheres[] = " (gc.group_id IN (".$userGroups.") OR
gc.group_id IS NULL)";
		}

		if ($p['hide_products_out_of_stock'] == 1) {
			$wheres[] = " a.stock > 0";
		}


		// Category Layout Plugin can change ordering
		// Category Layout Plugin can load additional columns
		$additionalColumns = array();
		if ($this->category_layout_plugin != '') {
			$this->category_layout_plugin =
PhocacartText::filterValue($this->category_layout_plugin,
'alphanumeric2');
			$pluginLayout 	= PluginHelper::importPlugin('pcl',
$this->category_layout_plugin);
			if ($pluginLayout) {
				$pluginOptions 				= array();
				$eventData 					= array();
				$eventData['pluginname'] 	=
$this->category_layout_plugin;
				Factory::getApplication()->triggerEvent('PCLonCategoryGetOptions',
array('com_phocacart.category', &$pluginOptions,
$eventData));

				if (isset($pluginOptions['ordering']) &&
$pluginOptions['ordering'] != '') {
					$pluginOrdering =
PhocacartText::filterValue($pluginOptions['ordering'],
'alphanumeric5');
					if ($pluginOrdering != '') {
						$itemOrdering = $pluginOrdering . ',' . $itemOrdering;
					}
				}

				if (isset($pluginOptions['columns']) &&
$pluginOptions['columns'] != '') {
					if (!empty($pluginOptions['columns'])) {
						foreach ($pluginOptions['columns'] as $k => $v) {
							$additionalColumns[] = PhocacartText::filterValue($v,
'alphanumeric3');
						}
					}
				}
			}
		}

		// Views Plugin can load additional columns
		$pluginLayout 	= PluginHelper::importPlugin('pcv');
		if ($pluginLayout) {
			$pluginOptions 				= array();
			$eventData 					= array();
			Factory::getApplication()->triggerEvent('PCVonCategoryBeforeLoadColumns',
array('com_phocacart.category', &$pluginOptions,
$eventData));

			if (isset($pluginOptions['columns']) &&
$pluginOptions['columns'] != '') {
				if (!empty($pluginOptions['columns'])) {
					foreach ($pluginOptions['columns'] as $k => $v) {
						$additionalColumns[] = PhocacartText::filterValue($v,
'alphanumeric3');
					}
				}
			}
		}

		$baseColumns = array('a.id', 'a.title',
'a.image', 'a.alias', 'a.unit_amount',
'a.unit_unit', 'a.description',
			'a.sku', 'a.ean', 'a.upc',
'a.type', 'a.points_received',
'a.price_original',
			'a.stock', 'a.stock_calculation',
'a.min_quantity', 'a.min_multiple_quantity',
			'a.stockstatus_a_id',
'a.stockstatus_n_id','a.date', 'a.sales',
'a.featured',
			'a.external_id', 'a.unit_amount',
'a.unit_unit', 'a.external_link',
'a.external_text', 'a.price',
'a.gift_types');


		$col = array_merge($baseColumns, $additionalColumns);
		$col = array_unique($col);



		if ($count == 1) {
			//$lefts[] = ' LEFT JOIN #__phocacart_categories AS c ON c.id =
a.catid';
			$lefts[] = ' LEFT JOIN #__phocacart_product_categories AS pc ON
pc.product_id =  a.id'.$subWherePcCat;
			$lefts[] = ' LEFT JOIN #__phocacart_categories AS c ON c.id =
pc.category_id';
			$lefts[] = ' LEFT JOIN #__phocacart_manufacturers AS m ON m.id =
a.manufacturer_id';


			if (!$skip['attributes']) {
				// see below for explanation
				// LEFT JOIN (SELECT id, product_id, MAX(required) AS required FROM
jos_phocacart_attributes GROUP BY product_id) AS at ON a.id = at.product_id
AND at.id > 0
			    $lefts[] = ' LEFT JOIN #__phocacart_attributes AS at ON a.id =
at.product_id AND at.id > 0 AND at.required = 1';
            }

			if (!$skip['group']) {
				$lefts[] = ' LEFT JOIN #__phocacart_item_groups AS ga ON a.id =
ga.item_id AND ga.type = 3';// type 3 is product
				$lefts[] = ' LEFT JOIN #__phocacart_item_groups AS gc ON c.id =
gc.item_id AND gc.type = 2';// type 2 is category
			}


			//$query = ' SELECT COUNT(DISTINCT a.id) AS count'; // 2.85ms
0.12mb
			$q = ' SELECT a.id' // 2.42ms 0.12mb
			. ' FROM #__phocacart_products AS a'
			. implode( ' ', $lefts )
			. ' WHERE ' . implode( ' AND ', $wheres )
			. ' GROUP BY a.id';

		} else {

			//$lefts[] = ' LEFT JOIN #__phocacart_categories AS c ON c.id =
a.catid';
			$lefts[] = ' LEFT JOIN #__phocacart_product_categories AS pc ON
pc.product_id = a.id'.$subWherePcCat;
			$lefts[] = ' LEFT JOIN #__phocacart_categories AS c ON c.id =
pc.category_id';
			$lefts[] = ' LEFT JOIN #__phocacart_reviews AS r ON a.id =
r.product_id AND r.id > 0';
			$lefts[] = ' LEFT JOIN #__phocacart_manufacturers AS m ON m.id =
a.manufacturer_id';

			if (!$skip['tax']) {
				$lefts[] = ' LEFT JOIN #__phocacart_taxes AS t ON t.id =
a.tax_id';
			}

			if (!$skip['attributes']) {

				// We need to get information if at least one of the attributes of
selected product is required

				// 1) Select more rows - one product is displayed e.g. in two rows
				//$lefts[] = ' LEFT JOIN #__phocacart_attributes AS at ON a.id =
at.product_id AND at.id > 0';

				// 2) right solution as it select only the maximal value and if maximal
value is 1 then one of product attribute is required
				// LEFT JOIN (SELECT id, product_id, MAX(required) AS required FROM
jos_phocacart_attributes GROUP BY product_id) AS at ON a.id = at.product_id
AND at.id > 0

				// 3) faster version of 2)
				$lefts[] = ' LEFT JOIN #__phocacart_attributes AS at ON a.id =
at.product_id AND at.id > 0 AND at.required = 1';
            }

			if (!$skip['group']) {
				$lefts[] = ' LEFT JOIN #__phocacart_item_groups AS ga ON a.id =
ga.item_id AND ga.type = 3';// type 3 is product
				$lefts[] = ' LEFT JOIN #__phocacart_item_groups AS gc ON c.id =
gc.item_id AND gc.type = 2';// type 2 is category
				// user is in more groups, select lowest price by best group
				$lefts[] = ' LEFT JOIN #__phocacart_product_price_groups AS ppg ON
a.id = ppg.product_id AND ppg.group_id IN (SELECT group_id FROM
#__phocacart_item_groups WHERE item_id = a.id AND group_id IN (' .
$userGroups . ') AND type = 3)';
				// user is in more groups, select highest points by best group
				$lefts[] = ' LEFT JOIN #__phocacart_product_point_groups AS pptg
ON a.id = pptg.product_id AND pptg.group_id IN (SELECT group_id FROM
#__phocacart_item_groups WHERE item_id = a.id AND group_id IN (' .
$userGroups . ') AND type = 3)';
			}


			$columns	= implode(',', $col) . ','
						.' GROUP_CONCAT(DISTINCT c.id) AS catid, GROUP_CONCAT(DISTINCT
c.title) AS cattitle,'
						.' GROUP_CONCAT(DISTINCT c.alias) AS catalias,';

			if (!$skip['tax']) {
				$columns	.= ' t.id as taxid, t.tax_rate as taxrate,
t.calculation_type as taxcalculationtype, t.title as taxtitle,';
			} else {
				$columns	.= ' NULL as taxid, NULL as taxrate, NULL as
taxcalculationtype, NULL as taxtitle,';
			}

			if (!$skip['attributes']) {
                $columns	.= 'at.required AS attribute_required,
';
            }

			if (!$skip['group']) {
                $columns	.= ' MIN(ppg.price) as group_price,
MAX(pptg.points_received) as group_points_received,';
            } else {
                $columns	.= ' NULL as group_price, NULL as
group_points_received,';
            }


			$columns	.= ' m.id as manufacturerid, m.title as manufacturertitle,
m.alias as manufactureralias,'
						. $selImages
						.' AVG(r.rating) AS rating';


			$groupsFull	= implode(',', $col) ;

			if (!$skip['tax']) {
                $groupsFull	.= ', t.id, t.tax_rate,
t.calculation_type, t.title';
            }
			if (!$skip['attributes']) {
                $groupsFull	.= ', at.required';
            }

			$groupsFast	= 'a.id';
			$groups		= PhocacartUtilsSettings::isFullGroupBy() ? $groupsFull :
$groupsFast;


			$q = ' SELECT '.$columns
			. ' FROM #__phocacart_products AS a'
			. implode( ' ', $lefts )
			. $leftImages
			. ' WHERE ' . implode( ' AND ', $wheres )
			. ' GROUP BY '.$groups
			. ' ORDER BY '.$itemOrdering;
		}

		//echo nl2br(str_replace('#__', 'jos_',
$q->__toString()));

		return $q;
	}

	protected function getCategoriesQuery($categoryId, $subcategories = FALSE)
{

		$wheres		= array();
		$app		= JFactory::getApplication();
		$params 	= $app->getParams();
		$user 		= PhocacartUser::getUser();
		$userLevels	= implode (',',
$user->getAuthorisedViewLevels());

		$userGroups = implode (',',
PhocacartGroup::getGroupsById($user->id, 1, 1));

		// Get the current category or get parent categories of the current
category
		if ($subcategories) {
			$wheres[]			= " c.parent_id = ".(int)$categoryId;
			$categoryOrdering 	= $this->getCategoryOrdering();
		} else {
			$wheres[]			= " c.id= ".(int)$categoryId;
		}

		$wheres[] = " c.published = 1";
		$wheres[] = " c.type IN (0,1)";// type: common, onlineshop,
pos
		$wheres[] = " c.access IN (".$userLevels.")";
		$wheres[] = " (gc.group_id IN (".$userGroups.") OR
gc.group_id IS NULL)";

		if ($this->getState('filter.language')) {
			$lang 		= JFactory::getLanguage()->getTag();
			$wheres[] 	=
PhocacartUtilsSettings::getLangQuery('c.language', $lang);
		}

		if ($subcategories) {

			$columns	= 'c.id, c.parent_id, c.title, c.alias, c.image,
COUNT(c.id) AS numdoc';
			$groupsFull	= 'c.id, c.parent_id, c.title, c.alias, c.image';
			$groupsFast	= 'c.id';
			$groups		= PhocacartUtilsSettings::isFullGroupBy() ? $groupsFull :
$groupsFast;

			$query = " SELECT ".$columns
				. " FROM #__phocacart_categories AS c"
				//. " LEFT JOIN #__phocacart_product_categories AS pc ON
pc.category_id = c.id"
				//. " LEFT JOIN #__phocacart_products AS a ON a.id = pc.product_id
AND a.published = 1 AND a.access IN (".$userLevels.")"
				. ' LEFT JOIN #__phocacart_item_groups AS gc ON c.id = gc.item_id
AND gc.type = 2'// type 2 is category
				. " WHERE " . implode( " AND ", $wheres )
				. " GROUP BY ".$groups
				. " ORDER BY ".$categoryOrdering;
		} else {
			$query = " SELECT c.id, c.parent_id, c.title, c.alias, c.image,
c.description, c.metatitle, c.metakey, c.metadesc, c.metadata, cc.title as
parenttitle, c.parent_id as parentid, cc.alias as parentalias"
				. " FROM #__phocacart_categories AS c"
				. " LEFT JOIN #__phocacart_categories AS cc ON cc.id =
c.parent_id"
				. ' LEFT JOIN #__phocacart_item_groups AS gc ON c.id = gc.item_id
AND gc.type = 2'// type 2 is category
				. " WHERE " . implode( " AND ", $wheres )
				. " ORDER BY c.ordering";
		}
		//echo nl2br(str_replace('#__', 'jos_', $query));
		return $query;
	}


	protected function getItemOrdering() {
		if (empty($this->item_ordering)) {
			$app						= JFactory::getApplication();
			$params						= $app->getParams();
			//$ordering					= $params->get( 'item_ordering', 1 );
			$ordering					= $this->getState('itemordering');
			$this->item_ordering 		=
PhocacartOrdering::getOrderingText($ordering);
		}
		return $this->item_ordering;
	}

	protected function getCategoryOrdering() {
		if (empty($this->category_ordering)) {
			$app						= JFactory::getApplication();
			$params						= $app->getParams();
			$ordering					= $params->get( 'category_ordering', 1 );
			$this->category_ordering 	=
PhocacartOrdering::getOrderingText($ordering, 1);
		}
		return $this->category_ordering;
	}

	public function hit($pk = 0) {
		$input = JFactory::getApplication()->input;
		$hitcount = $input->getInt('hitcount', 1);

		if ($hitcount) {
			$pk = (!empty($pk)) ? $pk : (int)
$this->getState('cateogry.id');

			$table = JTable::getInstance('PhocacartCategory',
'Table');
			$table->load($pk);
			$table->hit($pk);
		}

		return true;
	}
}
?>
models/checkout.php000064400000035373151167552070010371 0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport('joomla.application.component.model');

class PhocaCartModelCheckout extends JModelForm
{
	//protected $data;
	protected $fields;
	protected $fieldsguest;

	public function getFields($billing = 1, $shipping = 1, $account = 0){
		if (empty($this->fields)) {
			$this->fields = PhocacartFormUser::getFormXml('',
'_phs', $billing, $shipping, $account);//Fields in XML Format
		}


		return $this->fields;
	}

	public function getTable($type = 'PhocacartUser', $prefix =
'Table', $config = array()) {
		return JTable::getInstance($type, $prefix, $config);
	}

	public function getForm($data = array(), $loadData = true) {


		if (empty($this->fields['xml'])) {
			$this->fields = $this->getFields();

		}

		$form = $this->loadForm('com_phocacart.checkout',
(string)$this->fields['xml'], array('control' =>
'jform', 'load_data' => $loadData));

		if (empty($form)) {
			return false;
		}

		return $form;
	}

	protected function loadFormData() {
		$formData = (array)
JFactory::getApplication()->getUserState('com_phocacart.checkout.data',
array());

		if (empty($data)) {
			$formData = $this->getItem();
		}

		return $formData;
	}

	public function getItem($pk = null) {
		$app	= JFactory::getApplication();
		$user 	= PhocacartUser::getUser();
		$table 	= $this->getTable('PhocacartUser',
'Table');
		$tableS 	= $this->getTable('PhocacartUser',
'Table');

		// Billing
		if(isset($user->id) && (int)$user->id > 0) {
			$return = $table->load(array('user_id' =>
(int)$user->id, 'type' => 0));
			if ($return === false && $table->getError()) {
				$this->setError($table->getError());
				return false;
			}
		}

		// Shipping
		if(isset($user->id) && (int)$user->id > 0) {
			$returnS = $tableS->load(array('user_id' =>
(int)$user->id, 'type' => 1));
			if ($returnS === false && $tableS->getError()) {
				$this->setError($tableS->getError());
				return false;
			}
		}

		// Convert to the JObject before adding other data.
		$properties = $table->getProperties(1);
		$item = \Joomla\Utilities\ArrayHelper::toObject($properties,
'JObject');

		$propertiesS = $tableS->getProperties(1);
		//$itemS = \Joomla\Utilities\ArrayHelper::toObject($propertiesS,
'JObject');

		//Add shipping data to billing and do both data package
		if(!empty($propertiesS) && is_object($item)) {
			foreach($propertiesS as $k => $v) {
				$newName = $k . '_phs';
				$item->$newName = $v;

			}

		}
		/*

		if (property_exists($item, 'params'))
		{
			$registry = new JRegistry;
			$registry->loadString($item->params);
			$item->params = $registry->toArray();
		}*/

		return $item;
	}

	public function getData() {
		return PhocacartUser::getUserData();
	}

	public function saveAddress($data, $type = 0) {

		$app	= JFactory::getApplication();
		$user 	= PhocacartUser::getUser();


		if ((int)$user->id < 1) {
			$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_USER_NOT_LOGGED_IN'),
'error');
			return false;
		}


		// Email cannot be changed in checkout or in user account (form address),
only in user account profile
        if (isset($data['email'])) {
			if (isset($user->email) && $user->email != '') {
				$data['email'] = $user->email;
			} else {

				//unset($data['email']);
				$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_USER_EMAIL_NOT_EXISTS'),
'error');
				return false;
			}
        }



		$data['user_id']	= (int)$user->id;
		$data['type']		= (int)$type;
		$row = $this->getTable('PhocacartUser', 'Table');

		if(isset($user->id) && $user->id > 0) {
			if (!$row->load(array('user_id' => (int)$user->id,
'type' => $type))) {
				// No data yet
			}
		}
		//$row->bind($data);

		if (!$row->bind($data)) {
			$this->setError($this->_db->getErrorMsg());
			return false;
		}

		$row->date = gmdate('Y-m-d H:i:s');

		if (!$row->check()) {
			$this->setError($this->_db->getErrorMsg());
			return false;
		}

		// Store the table to the database
		if (!$row->store()) {
			$this->setError($this->_db->getErrorMsg());
			return false;
		}
		return $row->id;
	}

	public function saveShipping($shippingId) {

		$app	= JFactory::getApplication();
		$user 	= PhocacartUser::getUser();

		if ((int)$user->id < 1) {
			$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_USER_NOT_LOGGED_IN'),
'error');
			return false;
		}

		$data['shipping']	= (int)$shippingId;
		$data['user_id']	= (int)$user->id;

		$shipping 			= new PhocacartShipping();
		//$shipping->setType();
		$isValidShipping	= $shipping->checkAndGetShippingMethod($shippingId);
		if (!$isValidShipping) {
			$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_SHIPPING_METHOD_NOT_AVAILABLE'),
'error');
			return false;
		}

		$row = $this->getTable('PhocacartCart', 'Table');

		if(isset($user->id) && $user->id > 0) {
			if (!$row->load(array('user_id' => (int)$user->id,
'vendor_id' => 0, 'ticket_id' => 0,
'unit_id' => 0, 'section_id' => 0))) {
				// No data yet
			}
		}

		if (empty($row->cart)) {
			$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_CART_IS_EMPTY_SHIPPING_METHOD_CANNOT_BE_SET'),
'error');
			return false;
		}

		if (!$row->bind($data)) {
			$this->setError($this->_db->getErrorMsg());
			return false;
		}

		$row->date = gmdate('Y-m-d H:i:s');

		if (!$row->check()) {
			$this->setError($this->_db->getErrorMsg());
			return false;
		}

		if (!$row->store()) {
			$this->setError($this->_db->getErrorMsg());
			return false;
		}

		return $row->user_id;

	}

	public function savePaymentAndCouponAndReward($paymentId, $couponId,
$reward) {
		$app	= JFactory::getApplication();
		$user 	= PhocacartUser::getUser();
		if ((int)$user->id < 1) {
			$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_USER_NOT_LOGGED_IN'),
'error');
			return false;
		}

		$data['user_id']	= (int)$user->id;
		$data['payment'] 	= (int)$paymentId;

		if ((int)$couponId === -1) {
			// Coupon was not sent in form, only payment, Don't change the
coupon
		} else {
			$data['coupon'] 	= (int)$couponId;
		}

		if ((int)$reward === -1) {
			// Reward points was not sent in form, only payment, Don't change
the reward points
		} else {
			$data['reward'] 	= (int)$reward;
		}


		$payment 			= new PhocacartPayment();
		//$payment->setType();
		$isValidPayment		= $payment->checkAndGetPaymentMethod($paymentId);
		if (!$isValidPayment) {
			$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_PAYMENT_METHOD_NOT_AVAILABLE'),
'error');
			return false;
		}

		// Coupon has own rules in cart
		// Reward points have own rules in cart


		$row = $this->getTable('PhocacartCart', 'Table');


		if(isset($user->id) && $user->id > 0) {
			if (!$row->load(array('user_id' => (int)$user->id,
'vendor_id' => 0, 'ticket_id' => 0,
'unit_id' => 0, 'section_id' => 0))) {
				// No data yet
			}
		}

		if (empty($row->cart)) {
			$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_CART_IS_EMPTY_PAYMENT_METHOD_CANNOT_BE_SET'),
'error');
			return false;
		}

		if (!$row->bind($data)) {
			$this->setError($this->_db->getErrorMsg());
			return false;
		}

		$row->date = gmdate('Y-m-d H:i:s');

		if (!$row->check()) {
			$this->setError($this->_db->getErrorMsg());
			return false;
		}


		// Store the table to the database
		if (!$row->store()) {
			$this->setError($this->_db->getErrorMsg());
			return false;
		}

		return $row->user_id;

	}

	public function saveCoupon($couponId) {
		$app	= JFactory::getApplication();
		$user 	= PhocacartUser::getUser();
		if ((int)$user->id < 1) {
			// This should not happen as the user is controlled in controller
(because of different return messages for standard checkout or guest
checkout
			$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_USER_NOT_LOGGED_IN'),
'error');
			return false;
		}


		$data['coupon'] 	= (int)$couponId;
		$data['user_id']	= (int)$user->id;

		// Coupon has own rules in cart
		$row = $this->getTable('PhocacartCart', 'Table');

		if(isset($user->id) && $user->id > 0) {
			if (!$row->load(array('user_id' => (int)$user->id,
'vendor_id' => 0, 'ticket_id' => 0,
'unit_id' => 0, 'section_id' => 0))) {
				// No data yet
			}
		}

		// Possible feature request ceck for if cart is empty
		/*if (empty($row->cart)) {
			$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_CART_IS_EMPTY_PAYMENT_METHOD_CANNOT_BE_SET'),
'error');
			return false;
		}*/

		if (!$row->bind($data)) {
			$this->setError($this->_db->getErrorMsg());
			return false;
		}

		$row->date = gmdate('Y-m-d H:i:s');

		if (!$row->check()) {
			$this->setError($this->_db->getErrorMsg());
			return false;
		}


		// Store the table to the database
		if (!$row->store()) {
			$this->setError($this->_db->getErrorMsg());
			return false;
		}

		return $row->user_id;

	}

	public function saveRewardPoints($reward) {
		$app	= JFactory::getApplication();
		$user 	= PhocacartUser::getUser();
		if ((int)$user->id < 1) {
			// This should not happen as the user is controlled in controller
(because of different return messages for standard checkout or guest
checkout
			$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_USER_NOT_LOGGED_IN'),
'error');
			return false;
		}


		$data['user_id']	= (int)$user->id;
		$data['reward'] 	= (int)$reward;

		// Reward points have own rules in cart
		$row = $this->getTable('PhocacartCart', 'Table');

		if(isset($user->id) && $user->id > 0) {
			if (!$row->load(array('user_id' => (int)$user->id,
'vendor_id' => 0, 'ticket_id' => 0,
'unit_id' => 0, 'section_id' => 0))) {
				// No data yet
			}
		}

		// Possible feature request ceck for if cart is empty
		/*if (empty($row->cart)) {
			$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_CART_IS_EMPTY_PAYMENT_METHOD_CANNOT_BE_SET'),
'error');
			return false;
		}*/

		if (!$row->bind($data)) {
			$this->setError($this->_db->getErrorMsg());
			return false;
		}

		$row->date = gmdate('Y-m-d H:i:s');

		if (!$row->check()) {
			$this->setError($this->_db->getErrorMsg());
			return false;
		}


		// Store the table to the database
		if (!$row->store()) {
			$this->setError($this->_db->getErrorMsg());
			return false;
		}

		return $row->user_id;

	}

	/*
	 *
	 * GUEST CHECKOUT
	 *
	 */

	public function getFieldsGuest(){
		if (empty($this->fieldsguest)) {
			$this->fieldsguest = PhocacartFormUser::getFormXml('',
'_phs', 1, 1, 0, 1);//Fields in XML Format
		}
		return $this->fieldsguest;
	}

	public function getFormGuest($data = array(), $loadData = true) {

		if (empty($this->fieldsguest['xml'])) {
			$this->fieldsguest = $this->getFieldsGuest();
		}
		$form = $this->loadFormGuest('com_phocacart.checkout',
(string)$this->fieldsguest['xml'], array('control'
=> 'jform', 'load_data' => $loadData));
		if (empty($form)) {
			return false;
		}

		return $form;
	}

	protected function loadFormGuest($name, $source = null, $options =
array(), $clear = false, $xpath = false)
	{
		// Handle the optional arguments.
		$options['control'] =
\Joomla\Utilities\ArrayHelper::getValue($options, 'control',
false);

		// Create a signature hash.
		$hash = md5($source . serialize($options));

		// Check if we can use a previously loaded form.
		if (isset($this->_forms[$hash]) && !$clear)
		{
			return $this->_forms[$hash];
		}

		// Get the form.
		JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
		JForm::addFieldPath(JPATH_COMPONENT . '/models/fields');
		JForm::addFormPath(JPATH_COMPONENT . '/model/form');
		JForm::addFieldPath(JPATH_COMPONENT . '/model/field');

		try
		{
			$form = JForm::getInstance($name, $source, $options, false, $xpath);

			if (isset($options['load_data']) &&
$options['load_data'])
			{
				// Get the data for the form.
				$data = $this->loadFormDataGuest();
			}
			else
			{
				$data = array();
			}

			// Allow for additional modification of the form, and events to be
triggered.
			// We pass the data because plugins may require it.
			$this->preprocessForm($form, $data);

			// Load the data into the form after the plugins have operated.
			$form->bind($data);

		}
		catch (Exception $e)
		{
			$this->setError($e->getMessage());
			return false;
		}

		// Store the form for later.
		$this->_forms[$hash] = $form;

		return $form;
	}

	protected function loadFormDataGuest() {
		$formData = (array)
JFactory::getApplication()->getUserState('com_phocacart.checkout.data',
array());

		if (empty($data)) {
			$formData = $this->getItemGuest();
		}

		return $formData;
	}

	public function getItemGuest($pk = null) {

		//$guest 	= new PhocacartUserGuestuser();
		//$item	= $guest->getAddress();
		$item = PhocacartUserGuestuser::getAddress();

		return $item;
	}

	public function saveAddressGuest($data) {
		//$guest	= new PhocacartUserGuestuser();
		$data['user_id']	= 0;
		$data['type']		= 0;
		if (PhocacartUserGuestuser::storeAddress($data)) {
			return true;
		} else {
			return false;
		}

	}

	public function getDataGuest() {

		//$guest	= new PhocacartUserGuestuser();
		$data	= PhocacartUserGuestuser::getAddress();
		if (!empty($data)) {


			$dataN = PhocacartUser::convertAddressTwo($data, 0);

			$dataN[0]->countrytitle = null;
			$dataN[0]->regiontitle = null;
			$dataN[1]->countrytitle = null;
			$dataN[1]->regiontitle = null;
			if (isset($dataN[0]->country) && $dataN[0]->country >
0) {
				$dataN[0]->countrytitle =
PhocacartCountry::getCountryById($dataN[0]->country);
			}
			if (isset($dataN[0]->region) && $dataN[0]->region > 0)
{
				$dataN[0]->regiontitle =
PhocacartRegion::getRegionById($dataN[0]->region);
			}
			if (isset($dataN[1]->country) && $dataN[1]->country > 0
) {
				if (isset($dataN[0]->country) && $dataN[0]->country ==
$dataN[1]->country) {
					$dataN[1]->countrytitle = $dataN[0]->countrytitle;//great to
save one sql query

				} else {
					$dataN[1]->countrytitle =
PhocacartCountry::getCountryById($dataN[1]->country);
				}
			}
			if (isset($dataN[1]->region) && $dataN[1]->region > 0 )
{
				if (isset($dataN[0]->region) && $dataN[0]->region ==
$dataN[1]->region) {
					$dataN[1]->regiontitle = $dataN[0]->regiontitle;//great to save
one sql query
				} else {
					$dataN[1]->regiontitle =
PhocacartRegion::getRegionById($dataN[1]->region);
				}
			}

			return $dataN;
		}
		return false;
	}

	public function saveShippingGuest($shippingId) {

		if (PhocacartUserGuestuser::storeShipping((int)$shippingId)) {
			return true;
		}
		return false;
	}

	public function savePaymentAndCouponGuest($paymentId, $couponId) {

		if ($couponId === -1) {
			// we ignore storing the coupon (it is not a part of payment form)
			if (PhocacartUserGuestuser::storePayment((int)$paymentId)) {
				return true;
			}
		} else {
			if (PhocacartUserGuestuser::storePayment((int)$paymentId) && 
PhocacartUserGuestuser::storeCoupon((int)$couponId)) {
				return true;
			}
		}

		return false;
	}

	public function saveCouponGuest($couponId) {

		if (PhocacartUserGuestuser::storeCoupon((int)$couponId)) {
			return true;
		}
		return false;
	}


}
?>
models/comparison.php000064400000001020151167552070010714 0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport('joomla.application.component.model');

class PhocaCartModelComparison extends JModelForm
{

	public function getForm($data = array(), $loadData = true) {
		return false;
	}
}
?>
models/download.php000064400000001016151167552070010356 0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport('joomla.application.component.model');

class PhocaCartModelDownload extends JModelForm
{

	public function getForm($data = array(), $loadData = true) {
		return false;
	}
}
?>
models/fields/index.html000064400000000054151167552070011302
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>models/fields/phocacaptcha.php000064400000001665151167552070012445
0ustar00<?php
/**
 * @package    phocaguestbook
 * @subpackage Models
 * @copyright  Copyright (C) 2012 Jan Pavelka www.phoca.cz
 * @license    http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('JPATH_BASE') or die;

class JFormFieldPhocacaptcha extends JFormField
{
	protected $type 		= 'phocacaptcha';

	protected function getInput() {

		$document	= JFactory::getDocument();
		$session 	= JFactory::getSession();
		$params     = PhocacartUtils::getComponentParameters();
		$string 	= bin2hex(openssl_random_pseudo_bytes(10));
		$namespace	= 'pc'.$params->get('session_suffix',
$string);
		$captchaCnt = $session->get('captcha_cnt',  0, $namespace) +
1;

		// Possible extension of different captcha
		$id = $session->get('captcha_id', '', $namespace);

		switch ($id){
			default:
			case 1:
				$retval = PhocacartCaptchaRecaptcha::render();
				//$session->set('captcha_cnt', $captchaCnt, $namespace);
			break;
		}

		return $retval;
	}


}
?>
models/fields/phocacartcategory.php000064400000010762151167552070013527
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

if (! class_exists('PhocacartCategory')) {
    require_once(
JPATH_ADMINISTRATOR.'/components/com_phocacart/libraries/phocacart/category/category.php');
}
if (! class_exists('PhocacartCategoryMultiple')) {
    require_once(
JPATH_ADMINISTRATOR.'/components/com_phocacart/libraries/phocacart/category/multiple.php');
}

$lang = JFactory::getLanguage();
$lang->load('com_phocacart');

class JFormFieldPhocacartCategory extends JFormField
{
	protected $type 		= 'PhocacartCategory';

	protected function getInput() {

		$db = JFactory::getDBO();

		$javascript		= '';
		//$required		= ((string) $this->element['required'] ==
'true') ? TRUE : FALSE;
		$required		= $this->required;// accept dynamically added required
		$multiple		= ((string) $this->element['multiple'] ==
'true') ? TRUE : FALSE;
		$class			= ((string) $this->element['class'] !=
'') ?
'class="'.$this->element['class'].'"'
: 'class="inputbox"';
		$typeMethod		= $this->element['typemethod'];
		$categoryType	= $this->element['categorytype'];// 0 all, 1
... online shop, 2 ... pos
		$attr		= '';
		$attr		.= $class . ' ';


		if ($multiple) {
			$attr		.= 'size="4" multiple="multiple"
';
		}
		if ($required) {
			$attr		.= 'required aria-required="true" ';
		}
		$attr		.= $javascript . ' ';



		// Multiple load more values
		$activeCats = array();
		$id 		= 0;
		// Active cats can be selected in administration item view
		// but this function is even called in module so ignore this part for
module administration or submit items
		if ($multiple && $this->form->getName() ==
'com_phocacart.phocacartitem') {
			$id = (int) $this->form->getValue('id');// Product ID
			if ((int)$id > 0) {
				$activeCats	= PhocacartCategoryMultiple::getCategories($id, 1);

			}
		}


		// Filter language
        $whereLang = '';
        if (!empty($this->element['language'])) {
            if (strpos($this->element['language'],
',') !== false)
            {
                $language = implode(',',
$db->quote(explode(',',
$this->element['language'])));
            }
            else
            {
                $language =
$db->quote($this->element['language']);
            }

            $whereLang = ' AND
'.$db->quoteName('a.language') . ' IN (' .
$language . ')';
        }


       //build the list of categories
		$query = 'SELECT a.title AS text, a.id AS value, a.parent_id as
parentid'
		. ' FROM #__phocacart_categories AS a';

        // don't lose information about category when it will be
unpublished - you should still be able to edit product with such category
in administration
		//. ' WHERE a.published = 1';
		switch($categoryType) {

			case 1:
				$query .= ' WHERE a.type IN (0,1)';
			break;

			case 2:
				$query .= ' WHERE a.type IN (0,2)';
			break;


			case 0:
			default:

			break;

		}

		$query .= $whereLang;

		$query .= ' ORDER BY a.ordering';
		$db->setQuery( $query );
		$data = $db->loadObjectList();

		// TO DO - check for other views than category edit
		$view 	= JFactory::getApplication()->input->get( 'view'
);
		$catId	= -1;
		if ($view == 'phocacartcategory') {
			$id 	= $this->form->getValue('id'); // id of current
category
			if ((int)$id > 0) {
				$catId = $id;
			}
		}




		$tree = array();
		$text = '';
		$tree = PhocacartCategory::CategoryTreeOption($data, $tree, 0, $text,
$catId);

		if ($multiple) {
			if ($typeMethod == 'allnone') {
				array_unshift($tree,
Joomla\CMS\HTML\HTMLHelper::_('select.option', '0',
JText::_('COM_PHOCACART_NONE'), 'value',
'text'));
				array_unshift($tree,
Joomla\CMS\HTML\HTMLHelper::_('select.option', '-1',
JText::_('COM_PHOCACART_ALL'), 'value',
'text'));
			}
		} else {
			array_unshift($tree,
Joomla\CMS\HTML\HTMLHelper::_('select.option', '',
'- '.JText::_('COM_PHOCACART_SELECT_CATEGORY').'
-', 'value', 'text'));
		}


		if (!empty($activeCats)) {
			return Joomla\CMS\HTML\HTMLHelper::_('select.genericlist', 
$tree,  $this->name, $attr, 'value', 'text',
$activeCats, $this->id );

		} else {
			return Joomla\CMS\HTML\HTMLHelper::_('select.genericlist', 
$tree,  $this->name, $attr, 'value', 'text',
$this->value, $this->id );
		}

	}
}
?>
models/fields/phocacartfile.php000064400000012435151167552070012630
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

use Joomla\CMS\HTML\HTMLHelper;


class JFormFieldPhocacartFile extends JFormField
{
	protected $type 		= 'PhocacartFile';

	protected function getInput()
	{

		$document = JFactory::getDocument();
		$document->addScript(JURI::root(true) .
'/media/com_phocacart/js/tower/tower-file-input.min.js');
		JHtml::stylesheet('media/com_phocacart/js/tower/tower-file-input.min.css');

		$pC = PhocacartUtils::getComponentParameters();
		$s = PhocacartRenderStyle::getStyles();
		$submit_item_upload_image_maxsize =
$pC->get('submit_item_upload_image_maxsize', 512000);
		$submit_item_upload_image_count =
$pC->get('submit_item_upload_image_count', 1);

		$app	= JFactory::getApplication();
		$option = $app->input->get('option');
		$view 	= $app->input->get('view');

		$admin = 0;
		if (!$app->isClient('site') && $option ==
'com_phocacart' && $view ==
'phocacartsubmititem') {
			$admin = 1;
		}

		if ($admin == 1) {

			$o = array();


			if (!empty($this->value)) {

				foreach($this->value as $k => $v) {






					if (isset($v['name'])) {
						$o[] = '<div
class="'.$s['c']['control-group'].'">';
						$o[] = '<div
class="'.$s['c']['control-label'].'">'.$this->form->getLabel($this->name).'</div>';
						$o[] = '<div
class="'.$s['c']['controls'].'">';
						$o[] = '<input type="text"
name="jform[image]['.$k.'][name]"
id="jform_image"
value="'.$v['name'].'"
class="inputbox" size="40">';
						$o[] = '</div>';
						$o[] = '</div>';
					}
					if (isset($v['size'])) {
						$o[] = '<div
class="'.$s['c']['control-group'].'">';
						$o[] = '<div
class="'.$s['c']['control-label'].'">'.$this->form->getLabel($this->name).'</div>';
						$o[] = '<div
class="'.$s['c']['controls'].'">';
						$o[] = '<input type="text"
name="jform[image]['.$k.'][size]"
id="jform_image"
value="'.$v['size'].'"
class="inputbox" size="40">';
						$o[] = '</div>';
						$o[] = '</div>';
					}
					if (isset($v['nametoken'])) {
						$o[] = '<div
class="'.$s['c']['control-group'].'">';
						$o[] = '<div
class="'.$s['c']['control-label'].'">'.$this->form->getLabel($this->name).'</div>';
						$o[] = '<div
class="'.$s['c']['controls'].'">';
						$o[] = '<input type="text"
name="jform[image]['.$k.'][nametoken]"
id="jform_image"
value="'.$v['nametoken'].'"
class="inputbox" size="40">';
						$o[] = '</div>';
						$o[] = '</div>';
					}
					if (isset($v['fullpath'])) {
						$o[] = '<div
class="'.$s['c']['control-group'].'">';
						$o[] = '<div
class="'.$s['c']['control-label'].'">'.$this->form->getLabel($this->name).'</div>';
						$o[] = '<div
class="'.$s['c']['controls'].'">';
						$o[] = '<input type="text"
name="jform[image]['.$k.'][fullpath]"
id="jform_image"
value="'.$v['fullpath'].'"
class="inputbox" size="40">';
						$o[] = '</div>';
						$o[] = '</div>';
					}





				}

			}


		} else {
			$requInput	= $this->required ? ' required
aria-required="true"' : '';


			$typeMethod = $this->element['typemethod'];

			$accepts = '';
			if ($typeMethod == 'image'){
				$accepts = 'accept="image/*"';
				$accepts =
'accept="image/x-png,image/gif,image/jpeg,image/webp"';
			}

			$s  = PhocacartRenderStyle::getStyles();
			$id = PhocacartUtils::getRandomString(12);
			$id = 'phFile'. $id;

			$o = array();
			$o[] = '<div class="tower-file">';
			$o[] = '<input type="file"
id="'.$id.'"
name="'.$this->name.'[]" multiple
'.$accepts.' '. $requInput.' />';
			$o[] = '<label for="'.$id.'"
class="'.$s['c']['btn.btn-primary'].'"><span
class="'.$s['i']['upload'].'"></span>
'.JText::_('COM_PHOCACART_SELECT_FILES').'</label>';
			$o[] = '<button type="button"
class="tower-file-clear
'.$s['c']['btn.btn-secondary'].'
align-top"><span
class="'.$s['i']['clear'].'"></span>
'.JText::_('COM_PHOCACART_CLEAR').'</button>';
			$o[] = '</div>';

			$o[] = '<script type="text/javascript">';
			$o[] =
'jQuery("#'.$id.'").phFileInput({';
			$o[] = '   fileCount:
'.(int)$submit_item_upload_image_count.',';
			$o[] = '   fileSizeLimit:
'.(int)$submit_item_upload_image_maxsize.',';
			$o[] = '   iconClass:
"'.$s['i']['upload'].'",';
			$o[] = '   lang: {';
			$o[] = '     
"COM_PHOCACART_ERROR_TOO_MANY_FILES_SELECTED":
"'.JText::_('COM_PHOCACART_ERROR_TOO_MANY_FILES_SELECTED').
'",';
			$o[] = '     
"COM_PHOCACART_MAXIMUM_NUMBER_FILES_SELECTED_IS":
"'.JText::_('COM_PHOCACART_MAXIMUM_NUMBER_FILES_SELECTED_IS').
'",';
			$o[] = '      "COM_PHOCACART_WARNFILETOOLARGE":
"'.JText::_('COM_PHOCACART_WARNFILETOOLARGE').
'",';
			$o[] = '      "COM_PHOCACART_FILE_SIZE":
"'.JText::_('COM_PHOCACART_FILE_SIZE').
'",';
			$o[] = '      "COM_PHOCACART_FILE_SIZE_LIMIT":
"'.JText::_('COM_PHOCACART_FILE_SIZE_LIMIT').
'",';
			$o[] = '      "COM_PHOCACART_ERROR":
"'.JText::_('COM_PHOCACART_ERROR').
'",';
			$o[] = '      "COM_PHOCACART_FILES_SELECTED":
"'.JText::_('COM_PHOCACART_FILES_SELECTED').
'"';
			$o[] = '   }';
			$o[] = '});';
			$o[] = '</script>';

		}




        return implode("\n", $o);
	}
}
?>
models/fields/phocacartparameter.php000064400000001636151167552070013672
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

if (! class_exists('PhocacartParameter')) {
    require_once(
JPATH_ADMINISTRATOR.'/components/com_phocacart/libraries/phocacart/parameter/parameter.php');
}

$lang = JFactory::getLanguage();
$lang->load('com_phocacart');

class JFormFieldPhocacartParameter extends JFormField
{
	protected $type 		= 'PhocacartParameter';

	protected function getInput() {

		//$activeId = (int) $this->form->getValue('id');



		return PhocacartParameter::getAllParametersSelectBox($this->name,
$this->id, $this->value /*$activeId*/,
'class="inputbox"','id' );
	}
}
?>
models/fields/phocacartparametervalues.php000064400000003130151167552070015101
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

if (! class_exists('PhocacartParameter')) {
    require_once(
JPATH_ADMINISTRATOR.'/components/com_phocacart/libraries/phocacart/parameter/parameter.php');
}

$lang = JFactory::getLanguage();
$lang->load('com_phocacart');

defined('_JEXEC') or die();

class JFormFieldPhocaCartParameterValues extends JFormField
{
	protected $type 		= 'PhocaCartParameterValues';

	protected function getInput() {

		$id = (int) $this->form->getValue('id');
		$parameterId = (int)$this->element['parameterid'];

		$attr 	= $this->element['class'] ? '
class="'.(string)
$this->element['class'].'"' : '
class="inputbox"';
		$attr 	.= $this->element['size'] ? '
size="'.(int)
$this->element['size'].'"' : '';
		//$attr 	.= ((string) $this->element['required'] ==
'true') ? ' required aria-required="true"' :
'';
		$attr 	.= $this->required ? ' required
aria-required="true"' : '';
		$attr 	.= ((string) $this->element['multiple'] ==
'true') ? ' multiple="multiple"' :
'';

		$activeParameters = array();
		if ((int)$id > 0) {
			$activeParameters	= PhocacartParameter::getParameterValues($id,
$parameterId, 1);
		}


		return PhocacartParameter::getAllParameterValuesSelectBox($this->name,
$this->id, $parameterId, $activeParameters, $attr, 'a.id');
	}
}
?>
models/fields/phocacartparametervaluessubmititems.php000064400000003173151167552070017376
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

if (! class_exists('PhocacartParameter')) {
    require_once(
JPATH_ADMINISTRATOR.'/components/com_phocacart/libraries/phocacart/parameter/parameter.php');
}

$lang = JFactory::getLanguage();
$lang->load('com_phocacart');

defined('_JEXEC') or die();

class JFormFieldPhocaCartParameterValuesSubmitItems extends JFormField
{
	protected $type 		= 'PhocaCartParameterValuesSubmitItems';

	protected function getInput() {

		$id = (int) $this->form->getValue('id');

		$parameterId = (int)$this->element['parameterid'];

		$attr 	= $this->element['class'] ? '
class="'.(string)
$this->element['class'].'"' : '
class="inputbox"';
		$attr 	.= $this->element['size'] ? '
size="'.(int)
$this->element['size'].'"' : '';
		//$attr 	.= ((string) $this->element['required'] ==
'true') ? ' required aria-required="true"' :
'';
		$attr 	.= $this->required ? ' required
aria-required="true"' : '';
		$attr 	.= ((string) $this->element['multiple'] ==
'true') ? ' multiple="multiple"' :
'';

		$activeParameters = array();
		if ((int)$id > 0) {
			$activeParameters	=
PhocacartParameter::getParameterValuesSubmitItems($id, $parameterId, 1);
		}

		return PhocacartParameter::getAllParameterValuesSelectBox($this->name,
$this->id, $parameterId, $activeParameters, $attr, 'a.id');
	}

}
?>
models/fields/phocaeditor.php000064400000016126151167552070012326
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

class JFormFieldPhocaEditor extends JFormField
{

	public $type = 'PhocaEditor';
	protected $editor;
	
	protected function getInput(){
	
		
		$class = $this->element['class'] ? ' class="'
. (string) $this->element['class'] . '
mceEditor"' : '';
		
		$disabled = ((string) $this->element['disabled'] ==
'true') ? ' disabled="disabled"' :
'';
		$columns = $this->element['cols'] ? ' cols="'
. (int) $this->element['cols'] . '"' :
'';
		$rows = $this->element['rows'] ? ' rows="' .
(int) $this->element['rows'] . '"' :
'';

		// Initialize JavaScript field attributes.
		$onchange = $this->element['onchange'] ? '
onchange="' . (string) $this->element['onchange'] .
'"' : '';
		
		$height      = ((string) $this->element['height']) ?
(string) $this->element['height'] : '250';
		$width       = ((string) $this->element['width']) ? (string)
$this->element['width'] : '100%';
		$assetField  = $this->element['asset_field'] ? (string)
$this->element['asset_field'] : 'asset_id';
		$authorField = $this->element['created_by_field'] ? (string)
$this->element['created_by_field'] : 'created_by';
		$asset       = $this->form->getValue($assetField) ?
$this->form->getValue($assetField) : (string)
$this->element['asset_id'];

		// Build the buttons array.
		$buttons = (string) $this->element['buttons'];

		if ($buttons == 'true' || $buttons == 'yes' ||
$buttons == '1')
		{
			$buttons = true;
		}
		elseif ($buttons == 'false' || $buttons == 'no' ||
$buttons == '0')
		{
			$buttons = false;
		}
		else
		{
			$buttons = explode(',', $buttons);
		}

		$hide = ((string) $this->element['hide']) ?
explode(',', (string) $this->element['hide']) :
array();
		
		// We search for defined editor (tinymce)
		$editor = $this->getEditor();
		if ($editor) {
			$js =	'<script type="text/javascript">' .
"\n";
			$js .= 	 'tinyMCE.init({'. "\n"
						.'mode : "textareas",'. "\n"
						.'theme : "advanced",'. "\n"
						.'language : "en",'. "\n"
						.'plugins : "emotions",'. "\n"
						.'editor_selector : "mceEditor",'.
"\n"					
						.'theme_advanced_buttons1 : "bold, italic, underline,
separator, strikethrough, justifyleft, justifycenter, justifyright,
justifyfull, bullist, numlist, undo, redo, link, unlink, separator,
emotions",'. "\n"
						.'theme_advanced_buttons2 : "",'. "\n"
						.'theme_advanced_buttons3 : "",'. "\n"
						.'theme_advanced_toolbar_location : "top",'.
"\n"
						.'theme_advanced_toolbar_align : "left",'.
"\n";
			//if ($displayPath == 1) {
				$js .= 'theme_advanced_path_location : "bottom",'.
"\n";
			//}
			$js .=		 'extended_valid_elements :
"a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]"
	});' . "\n";
			$js .=	'</script>';
			
			$js2 = "\t<script type=\"text/javascript\"
src=\"".JURI::root()."media/editors/tinymce/jscripts/tiny_mce/tiny_mce.js\"></script>\n";
			
			
			$js = '<script type="text/javascript">
				tinyMCE.init({
					// General
					//directionality: "ltr",
					//language : "en",
					menubar:false,
					statusbar: false,
					mode : "specific_textareas",
					skin : "lightgray",
					theme : "modern",
					schema: "html5",
					selector: "textarea.mce_editable",
					// Cleanup/Output
					inline_styles : true,
					gecko_spellcheck : true,
					entity_encoding : "raw",
					extended_valid_elements :
"hr[id|title|alt|class|width|size|noshade]",
					force_br_newlines : false, force_p_newlines : true, forced_root_block
: \'p\',
					toolbar_items_size: "small",
					invalid_elements : "script,applet,iframe",
					// Plugins
					plugins : "link image autolink lists",
					// Toolbar
					toolbar1: "bold italic underline strikethrough | alignleft
aligncenter alignright alignjustify | bullist numlist | undo redo | link
unlink anchor image",
					removed_menuitems: "newdocument",
					// URL
					relative_urls : true,
					remove_script_host : false,
					document_base_url : "'.JURI::base().'",
					// Layout
					content_css :
"'.JURI::base().'templates/system/css/editor.css",
					//importcss_append: true,
					// Advanced Options
					resize: "both",
					//height : "550",
					//width : "750",

				});
				</script>';
			
			$js2 = "\t<script type=\"text/javascript\"
src=\"".JURI::root()."media/editors/tinymce/tinymce.min.js\"></script>\n";
			
			
			$document	= JFactory::getDocument();
			$document->addCustomTag($js2);
			$document->addCustomTag($js);
			
			if (is_numeric( $width )) {
				$width .= 'px';
			}
			if (is_numeric( $height )) {
				$height .= 'px';
			}
			
			// Problem with required
			$class = str_replace('required', '', $class);
			
			$editor = '<textarea class="mce_editable"
name="' . $this->name . '" id="' .
$this->id . '"' . $columns . $rows . $class . $disabled .
$onchange . ' style="width:' . $width .';
height:'. $height.'">'
				. htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') .
'</textarea>';
		} else {
			$editor = '<textarea class="mce_editable"
name="' . $this->name . '" id="' .
$this->id . '"' . $columns . $rows . $class . $disabled .
$onchange . ' style="width:' . $width .';
height:'. $height.'">'
				. htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') .
'</textarea>';
		}
		return $editor;
	}

	/**
	 * Method to get a JEditor object based on the form field.
	 *
	 * @return  JEditor  The JEditor object.
	 *
	 * @since   1.6
	 */
	protected function getEditor()
	{
		// Only create the editor if it is not already created.
		if (empty($this->editor))
		{
			$editor = null;

			// Get the editor type attribute. Can be in the form of:
editor="desired|alternative".
			$type = trim((string) $this->element['editor']);

			if ($type)
			{
				// Get the list of editor types.
				$types = explode('|', $type);

				// Get the database object.
				$db = JFactory::getDBO();

				// Iterate over teh types looking for an existing editor.
				foreach ($types as $element)
				{
					// Build the query.
					$query = $db->getQuery(true);
					$query->select('element');
					$query->from('#__extensions');
					$query->where('element = ' . $db->quote($element));
					$query->where('folder = ' .
$db->quote('editors'));
					$query->where('enabled = 1');

					// Check of the editor exists.
					$db->setQuery($query, 0, 1);
					$editor = $db->loadResult();

					// If an editor was found stop looking.
					if ($editor)
					{
						break;
					}
				}
			}

			// Create the JEditor instance based on the given editor.
			if (is_null($editor))
			{
				$conf = JFactory::getConfig();
				$editor = $conf->get('editor');
			}
			//PHOCAEDIT
			if ($editor != trim((string) $this->element['editor'])) {
				return false;
			}
			// END PHOCAEDIT
			
			$this->editor = JEditor::getInstance($editor);
		}

		return $this->editor;
	}

	public function save()
	{
		return $this->getEditor()->save($this->id);
	}
}
models/fields/phocaemail.php000064400000006260151167552070012125
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
defined('JPATH_BASE') or die();
JFormHelper::loadFieldClass('email');

class JFormFieldPhocaEmail extends JFormFieldEMail
{
	protected $type 		= 'PhocaEmail';
	
	protected function getInput() {

		if (!$this->hidden &&
($this->form->getValue('version') == 1)) {
			// Initialize some field attributes.
			$size		= $this->element['size'] ? '
size="'.(int)
$this->element['size'].'"' : '';
			$class		= $this->element['class'] ? '
class="'.(string)
$this->element['class'].'"' : '';
			$maxLength	= $this->element['maxlength'] ? '
maxlength="'.(int)
$this->element['maxlength'].'"' : '';
			$readonly	= ((string) $this->element['readonly'] ==
'true') ? ' readonly="readonly"' :
'';
			$disabled	= ((string) $this->element['disabled'] ==
'true') ? ' disabled="disabled"' :
'';
			$placeholder= htmlspecialchars($this->getTitle() .
($this->required ?
''.JText::_('COM_PHOCAGUESTBOOK_REQUIREDSIGN') :
''), ENT_COMPAT, 'UTF-8');
			// Initialize JavaScript field attributes.
			$onchange	= $this->element['onchange'] ? '
onchange="'.(string)
$this->element['onchange'].'"' : '';
			$value 		= htmlspecialchars($this->value, ENT_COMPAT,
'UTF-8');
			$requInput	= $this->required ? ' required="required"
aria-required="true"' : '';
			
			//prepend:
			$preIcon	= $this->element['preicon'] 	? '<i
class="' . $this->element['preicon'] . '
tip" title="' . $placeholder .
'"></i>' : '';
			$postIcon	= $this->element['posticon'] 	? '<i
class="' . $this->element['preicon'] .
'"></i>' : '';
			if ($postIcon && $this->element['posthref']) {
				//$postIcon = '<a href="' . (string)
$this->element['posthref'] . '" title="' .
JText::_('COM_PHOCAGUESTBOOK_RELOAD_IMAGE') . '"
class="btn hasTooltip" >' . $postIcon .
'</a>';
				
				$postIcon = '<span class="add-on
input-group-addon"><a href="' . (string)
$this->element['posthref'] . '" title="' .
JText::_('COM_PHOCAGUESTBOOK_RELOAD_IMAGE') . '"
class="" >' . $postIcon .
'</a></span>';
			}

			// Get the label text from the XML element, defaulting to the element
name.
			$text = $this->element['label'] ? (string)
$this->element['label'] : (string)
$this->element['name'];
			$text = $this->translateLabel ? JText::_($text) : $text;

			// Add the opening label tag and main attributes attributes.
			$label = '<label id="' . $this->id .
'-lbl" for="' . $this->id . '"
class="element-invisible" title="' . $placeholder  .
'">' . $text . '</label>';

			return '<span class="add-on
input-group-addon">' . $preIcon . $label .
'</span>'
		    . '<input'. $requInput. ' type="text"
name="'.$this->name.'"
id="'.$this->id.'"
placeholder="'.$placeholder.'"
value="'.$value.'"'
				  
.$class.$size.$disabled.$readonly.$onchange.$maxLength.'/>';
		} else {
			return parent::getInput();
		}
		
	}
	
	protected function getLabel() {
		
		if (!$this->hidden &&
($this->form->getValue('version') == 1)) {
			return '';
		} else {
			return parent::getLabel();
		}
	}
	
}
?>
models/fields/phocaformcountry.php000064400000010410151167552070013415
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

class JFormFieldPhocaFormCountry extends JFormField
{
	protected $type 		= 'PhocaFormCountry';

	protected function getInput() {

		$app	= JFactory::getApplication();
		$db	 	= JFactory::getDBO();

		if ($this->id == 'jform_country') {
			$regionId = 'jform_region';
		} else if ($this->id == 'jform_country_phs') {
			$regionId = 'jform_region_phs';
		} else if ($this->id == 'jform_country_phb') {
			$regionId = 'jform_region_phb';
		}

		$s 	= array();
		$s[] 	= 'function phUpdateRegion'.$this->id.'(value)
{';


		$config 	= JComponentHelper::getParams('com_media');
		//$paramsC 	= PhocacartUtils::getComponentParameters() ;
		
		


		if (!$app->isClient('administrator')) {
			$paramsC 	= $app->getParams();
			$load_chosen= $paramsC->get( 'load_chosen', 1 );
			$s[] 	= '   var url =
\''.JURI::base(true).'/index.php?option=com_phocacart&task=checkout.setregion&format=json&'.
JSession::getFormToken().'=1\';';
		} else {
			$paramsC 	= PhocacartUtils::getComponentParameters();
			$load_chosen= $paramsC->get( 'load_chosen', 1 );
			$s[] 	= '   var url =
\''.JURI::base(true).'/index.php?option=com_phocacart&task=phocacartuser.setregion&format=json&'.
JSession::getFormToken().'=1\';';
		}

		$s[] 	= '   var dataPost = {};';
		$s[] 	= '   dataPost[\'countryid\'] =
encodeURIComponent(value);';
		$s[] 	= '   phRequestActive = jQuery.ajax({';
		$s[] 	= '      url: url,';
		$s[] 	= '      type:\'POST\',';
		$s[] 	= '      data:dataPost,';
		$s[] 	= '      dataType:\'JSON\',';
		$s[] 	= '      success:function(data){';
		$s[] 	= '         if ( data.status == 1 ){';
		$s[] 	= '           
jQuery(\'#'.$regionId.'\').empty().append(data.content);';
		if (!$app->isClient('administrator')) {
			if ($load_chosen > 0) {
				$s[] 	= '	          
jQuery(\'#'.$regionId.'\').trigger("chosen:updated");';//Reload
Chosen
			}
		} else {
			// in admin, older version of chosen is used
			$s[] 	= '	          
jQuery(\'#'.$regionId.'\').trigger("liszt:updated");';//Reload
Chosen older version
		}
		$s[] 	= '         } else {';
		$s[]	= '			  
jQuery("#ph-request-message").show();';
		$s[] 	= '	          
jQuery(\'#ph-request-message\').html(data.error)';
		$s[] 	= '         }';
		$s[] 	= '      }';
		$s[] 	= '   });';



		$s[] 	= '}';
		JFactory::getDocument()->addScriptDeclaration(implode("\n",
$s));




		$query = 'SELECT a.title AS text, a.id AS value'
		. ' FROM #__phocacart_countries AS a'
		. ' WHERE a.published = 1'
		. ' ORDER BY a.ordering';
		$db->setQuery( $query );
		$data = $db->loadObjectList();


		$attr = '';
		$attr .= !empty($this->class) ? ' class="' .
$this->class . ' form-control chosen-select
ph-input-select-countries"' : 'class="form-control
chosen-select ph-input-select-countries"';
		$attr .= !empty($this->size) ? ' size="' .
$this->size . '"' : '';
		$attr .= $this->multiple ? ' multiple' : '';
		$attr .= $this->required ? ' required
aria-required="true"' : '';
		$attr .= $this->autofocus ? ' autofocus' : '';
		
		// Set default value in case, there is no value
		if (($this->value == 0 || $this->value == '') &&
isset($this->default) && (int)$this->default > 0) {
			$this->value = $this->default;
			$this->form->setValue(str_replace('jform_',
'', $this->id), null, $this->default);

		}

		if ((string) $this->readonly == '1' || (string)
$this->readonly == 'true' || (string) $this->disabled ==
'1'|| (string) $this->disabled == 'true') {
			$attr .= ' disabled="disabled"';
		}
		$attr .= $this->onchange ? '
onchange="phUpdateRegion'.$this->id.'(this.value);'
. $this->onchange . '" ' : '
onchange="phUpdateRegion'.$this->id.'(this.value);"
';

		array_unshift($data,
Joomla\CMS\HTML\HTMLHelper::_('select.option', '',
'-&nbsp;'.JText::_('COM_PHOCACART_SELECT_COUNTRY').'&nbsp;-',
'value', 'text'));

		return Joomla\CMS\HTML\HTMLHelper::_('select.genericlist', 
$data,  $this->name, trim($attr), 'value', 'text',
$this->value, $this->id );
	}
}
?>
models/fields/phocaformregion.php000064400000005626151167552070013212
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

class JFormFieldPhocaFormRegion extends JFormField
{
	protected $type 		= 'PhocaFormRegion';

	protected function getInput() {

		$db = JFactory::getDBO();


		$country = $this->form->getValue('country');
		$countryPhs = $this->form->getValue('country_phs');
		$countryPhb = $this->form->getValue('country_phb');
		$countryId = 0;
		if ($this->id == 'jform_region' && (int)$country
> 0) {
			$countryId = (int)$country;
		}

		if ($this->id == 'jform_region_phs' &&
(int)$countryPhs > 0) {
			$countryId = (int)$countryPhs;
		}
		if ($this->id == 'jform_region_phb' &&
(int)$countryPhb > 0) {
			$countryId = (int)$countryPhb;
		}



		$query = 'SELECT a.title AS text, a.id AS value'
		. ' FROM #__phocacart_regions AS a'
		. ' WHERE a.published = 1';
		if ($countryId > 0) {
			$query .= ' AND a.country_id = '.(int)$countryId;
		}
		$query .= ' ORDER BY a.ordering';
		$db->setQuery( $query );
		$data = $db->loadObjectList();


		// Set default value in case, there is no value
		// Check if the default value belongs to country
		if (($this->value == 0 || $this->value == '') &&
isset($this->default) && (int)$this->default > 0) {
			$queryR = 'SELECT a.id'
			. ' FROM #__phocacart_regions AS a'
			. ' WHERE a.published = 1';
			if ($countryId > 0) {
				$queryR .= ' AND a.country_id = '.(int)$countryId;
			}
			$queryR .= ' ORDER BY a.ordering';
			$db->setQuery( $queryR );
			$dataR = $db->loadColumn();

			if (!empty($dataR)) {

				if (in_array($this->default, $dataR)) {
					$this->value = $this->default;
				}
			}
		}


		$attr = '';
		$attr .= !empty($this->class) ? ' class="' .
$this->class . ' form-control chosen-select
ph-input-select-region"' : 'class="form-control
chosen-select ph-input-select-region"';
		$attr .= !empty($this->size) ? ' size="' .
$this->size . '"' : '';
		$attr .= $this->multiple ? ' multiple' : '';
		$attr .= $this->required ? ' required
aria-required="true"' : '';
		$attr .= $this->autofocus ? ' autofocus' : '';

		if ((string) $this->readonly == '1' || (string)
$this->readonly == 'true' || (string) $this->disabled ==
'1'|| (string) $this->disabled == 'true') {
			$attr .= ' disabled="disabled"';
		}
		$attr .= $this->onchange ? ' onchange="' .
$this->onchange . '"' : '';


		array_unshift($data,
Joomla\CMS\HTML\HTMLHelper::_('select.option', '',
'-&nbsp;'.JText::_('COM_PHOCACART_SELECT_REGION').'&nbsp;-',
'value', 'text'));

		return Joomla\CMS\HTML\HTMLHelper::_('select.genericlist', 
$data,  $this->name, trim($attr), 'value', 'text',
$this->value, $this->id );
	}
}
?>
models/fields/phocamanufacturer.php000064400000002040151167552070013522
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

class JFormFieldPhocaManufacturer extends JFormField
{
	protected $type 		= 'PhocaManufacturer';

		protected function getInput() {
		
		$db = JFactory::getDBO();

		$query = 'SELECT a.title AS text, a.id AS value'
		. ' FROM #__phocacart_manufacturers AS a'
		. ' WHERE a.published = 1'
		. ' ORDER BY a.ordering';
		$db->setQuery( $query );
		$data = $db->loadObjectList();
		
		array_unshift($data,
Joomla\CMS\HTML\HTMLHelper::_('select.option', '',
'-
'.JText::_('COM_PHOCACART_SELECT_MANUFACTURER').'
-', 'value', 'text'));
		return Joomla\CMS\HTML\HTMLHelper::_('select.genericlist', 
$data,  $this->name, 'class="inputbox"',
'value', 'text', $this->value, $this->id );
	}
}
?>
models/fields/phocataglabels.php000064400000002501151167552070012766
0ustar00<?php
/*
 * @package		Joomla.Framework
 * @copyright	Copyright (C) 2005 - 2010 Open Source Matters, Inc. All
rights reserved.
 * @license		GNU General Public License version 2 or later; see
LICENSE.txt
 *
 * @component Phoca Component
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
version 2 or later;
 */
defined('_JEXEC') or die();
class JFormFieldPhocaTaglabels extends JFormField
{
	protected $type 		= 'PhocaTaglabels';

	protected function getInput() {

		$id 	= (int) $this->form->getValue('id');
		$javascript		= '';
		$required		= $this->required;// accept dynamically added required
		$multiple		= ((string) $this->element['multiple'] ==
'true') ? TRUE : FALSE;
		$class			= ((string) $this->element['class'] !=
'') ?
'class="'.$this->element['class'].'"'
: 'class="inputbox"';
		$attr			= '';
		$attr			.= $class . ' ';

		if ($multiple) {
			$attr		.= 'size="4" multiple="multiple"
';
		}
		if ($required) {
			$attr		.= 'required aria-required="true" ';
		}
		$attr			.= $javascript . ' ';

		$activeTags = array();
		if ((int)$id > 0) {
			$activeTags	= PhocacartTag::getTagLabels($id, 1);
		}

		return PhocacartTag::getAllTagsSelectBox($this->name, $this->id,
$activeTags, NULL, 'id', 1, $attr );
	}
}
?>
models/fields/phocataglabelssubmititems.php000064400000002537151167552070015265
0ustar00<?php
/*
 * @package		Joomla.Framework
 * @copyright	Copyright (C) 2005 - 2010 Open Source Matters, Inc. All
rights reserved.
 * @license		GNU General Public License version 2 or later; see
LICENSE.txt
 *
 * @component Phoca Component
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
version 2 or later;
 */
defined('_JEXEC') or die();
class JFormFieldPhocaTaglabelsSubmitItems extends JFormField
{
	protected $type 		= 'PhocaTaglabelsSubmitItems';

	protected function getInput() {

		$id 	= (int) $this->form->getValue('id');
		$javascript		= '';
		$required		= $this->required;// accept dynamically added required
		$multiple		= ((string) $this->element['multiple'] ==
'true') ? TRUE : FALSE;
		$class			= ((string) $this->element['class'] !=
'') ?
'class="'.$this->element['class'].'"'
: 'class="inputbox"';
		$attr			= '';
		$attr			.= $class . ' ';

		if ($multiple) {
			$attr		.= 'size="4" multiple="multiple"
';
		}
		if ($required) {
			$attr		.= 'required aria-required="true" ';
		}
		$attr			.= $javascript . ' ';

		$activeTags = array();
		if ((int)$id > 0) {
			$activeTags	= PhocacartTag::getTagLabelsSubmitItems($id);
		}

		return PhocacartTag::getAllTagsSelectBox($this->name, $this->id,
$activeTags, NULL, 'id', 1, $attr );
	}
}
?>
models/fields/phocatags.php000064400000002464151167552070011776
0ustar00<?php
/*
 * @package		Joomla.Framework
 * @copyright	Copyright (C) 2005 - 2010 Open Source Matters, Inc. All
rights reserved.
 * @license		GNU General Public License version 2 or later; see
LICENSE.txt
 *
 * @component Phoca Component
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
version 2 or later;
 */
defined('_JEXEC') or die();
class JFormFieldPhocaTags extends JFormField
{
	protected $type 		= 'PhocaTags';

	protected function getInput() {

		$id 	= (int) $this->form->getValue('id');
		$javascript		= '';
		$required		= $this->required;// accept dynamically added required
		$multiple		= ((string) $this->element['multiple'] ==
'true') ? TRUE : FALSE;
		$class			= ((string) $this->element['class'] !=
'') ?
'class="'.$this->element['class'].'"'
: 'class="inputbox"';
		$attr			= '';
		$attr			.= $class . ' ';

		if ($multiple) {
			$attr		.= 'size="4" multiple="multiple"
';
		}
		if ($required) {
			$attr		.= 'required aria-required="true" ';
		}
		$attr			.= $javascript . ' ';


		$activeTags = array();
		if ((int)$id > 0) {
			$activeTags	= PhocacartTag::getTags($id, 1);
		}

		return PhocacartTag::getAllTagsSelectBox($this->name, $this->id,
$activeTags, NULL, 'id', 0, $attr );
	}
}
?>
models/fields/phocatagssubmititems.php000064400000002520151167552070014255
0ustar00<?php
/*
 * @package		Joomla.Framework
 * @copyright	Copyright (C) 2005 - 2010 Open Source Matters, Inc. All
rights reserved.
 * @license		GNU General Public License version 2 or later; see
LICENSE.txt
 *
 * @component Phoca Component
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
version 2 or later;
 */
defined('_JEXEC') or die();
class JFormFieldPhocaTagsSubmitItems extends JFormField
{
	protected $type 		= 'PhocaTagsSubmitItems';

	protected function getInput() {

		$id 	= (int) $this->form->getValue('id');
		$javascript		= '';
		$required		= $this->required;// accept dynamically added required
		$multiple		= ((string) $this->element['multiple'] ==
'true') ? TRUE : FALSE;
		$class			= ((string) $this->element['class'] !=
'') ?
'class="'.$this->element['class'].'"'
: 'class="inputbox"';
		$attr			= '';
		$attr			.= $class . ' ';

		if ($multiple) {
			$attr		.= 'size="4" multiple="multiple"
';
		}
		if ($required) {
			$attr		.= 'required aria-required="true" ';
		}
		$attr			.= $javascript . ' ';

		$activeTags = array();
		if ((int)$id > 0) {
			$activeTags	= PhocacartTag::getTagsSubmitItems($id);
		}

		return PhocacartTag::getAllTagsSelectBox($this->name, $this->id,
$activeTags, NULL, 'id', 0, $attr );
	}
}
?>
models/fields/phocatax.php000064400000003252151167552070011630
0ustar00<?php
/*
 * @package		Joomla.Framework
 * @copyright	Copyright (C) 2005 - 2010 Open Source Matters, Inc. All
rights reserved.
 * @license		GNU General Public License version 2 or later; see
LICENSE.txt
 *
 * @component Phoca Component
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
version 2 or later;
 */
defined('_JEXEC') or die();
class JFormFieldPhocaTax extends JFormField
{
	protected $type 		= 'PhocaTax';

	protected function getInput() {
		$db = JFactory::getDBO();
		
		$javascript		= '';
		$required		= $this->required;// accept dynamically added required
		$multiple		= ((string) $this->element['multiple'] ==
'true') ? TRUE : FALSE;
		$class			= ((string) $this->element['class'] !=
'') ?
'class="'.$this->element['class'].'"'
: 'class="inputbox"';
		$attr			= '';
		$attr			.= $class . ' ';

		if ($multiple) {
			$attr		.= 'size="4" multiple="multiple"
';
		}
		if ($required) {
			$attr		.= 'required aria-required="true" ';
		}
		$attr			.= $javascript . ' ';

		$query = 'SELECT a.title AS text, a.id AS value'
		. ' FROM #__phocacart_taxes AS a'
		. ' WHERE a.published = 1'
		. ' ORDER BY a.ordering';
		$db->setQuery( $query );
		$data = $db->loadObjectList();

		if (!empty($data)) {
			foreach($data as $k => $v) {
				$data[$k]->text = JText::_($v->text);
			}
		}

		array_unshift($data,
Joomla\CMS\HTML\HTMLHelper::_('select.option', '',
'- '.JText::_('COM_PHOCACART_SELECT_TAX').'
-', 'value', 'text'));
		return Joomla\CMS\HTML\HTMLHelper::_('select.genericlist', 
$data,  $this->name, $attr, 'value', 'text',
$this->value, $this->id );
	}
}
?>
models/fields/phocatext.php000064400000007213151167552070012021
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
JFormHelper::loadFieldClass('text');

class JFormFieldPhocaText extends JFormFieldText
{
	protected $type 		= 'PhocaText';
	
	protected function getInput() {

		if (!$this->hidden &&
($this->form->getValue('version') == 1)) {
			// Initialize some field attributes.
			$size		= $this->element['size'] ? '
size="'.(int)
$this->element['size'].'"' : '';
			//$class		= $this->element['class'] ? '
class="'.(string) $this->element['class'].'
form-control"' :
'class="form-control"';//Bootstrap3
			$class		= $this->element['class'] ? '
class="'.(string) $this->element['class'].'
"' : '';
			$maxLength	= $this->element['maxlength'] ? '
maxlength="'.(int)
$this->element['maxlength'].'"' : '';
			$readonly	= ((string) $this->element['readonly'] ==
'true') ? ' readonly="readonly"' :
'';
			$disabled	= ((string) $this->element['disabled'] ==
'true') ? ' disabled="disabled"' :
'';
			$placeholder= htmlspecialchars($this->getTitle() .
($this->required ? ' ' .
JText::_('COM_PHOCAGUESTBOOK_REQUIREDSIGN') : ''),
ENT_COMPAT, 'UTF-8');
			
	
			// Initialize JavaScript field attributes.
			$onchange	= $this->element['onchange'] ? '
onchange="'.(string)
$this->element['onchange'].'"' : '';
			$value 		= htmlspecialchars($this->value, ENT_COMPAT,
'UTF-8');
			$requInput	= $this->required ? ' required="required"
aria-required="true"' : '';
			
			//prepend:
			$preIcon	= $this->element['preicon'] 	? '<i
class="' . $this->element['preicon'] . '"
title="' . $placeholder . '"></i>' :
'';
			$postIcon	= $this->element['posticon'] 	? '<i
class="' . $this->element['posticon'] .
'"></i>' : '';
			if ($postIcon && $this->element['posthref']) {
				//$postIcon = '<a href="' . (string)
$this->element['posthref'] . '" title="' .
JText::_('COM_PHOCAGUESTBOOK_RELOAD_IMAGE') . '"
class="btn hasTooltip" >' . $postIcon .
'</a>';
				
				$postIcon = '<span class="add-on
input-group-addon"><a href="' . (string)
$this->element['posthref'] . '" title="' .
JText::_('COM_PHOCAGUESTBOOK_RELOAD_IMAGE') . '"
class="" >' . $postIcon .
'</a></span>';
			}

			// Get the label text from the XML element, defaulting to the element
name.
			$text = $this->element['label'] ? (string)
$this->element['label'] : (string)
$this->element['name'];
			$text = $this->translateLabel ? JText::_($text) : $text;

			// Add the opening label tag and main attributes attributes.
			$label = '<label id="' . $this->id .
'-lbl" for="' . $this->id . '"
class="element-invisible" title="' . $placeholder  .
'">' . $text . '</label>';

			return '<span class="add-on
input-group-addon">' . $preIcon . $label .
'</span>'
		    . '<input'. $requInput. ' type="text"
name="'.$this->name.'"
id="'.$this->id.'"
placeholder="'.$placeholder.'"
value="'.$value.'"'
				   .$class.$size.$disabled.$readonly.$onchange.$maxLength.'/>
' . $postIcon;
				   
		
		} else {
			$postIcon	= $this->element['posticon'] 	? '<i
class="' . $this->element['posticon'] .
'"></i>' : '';
			if ($postIcon && $this->element['posthref']) {
				$postIcon = '<a href="' . (string)
$this->element['posthref'] . '" title="' .
JText::_('COM_PHOCAGUESTBOOK_RELOAD_IMAGE') . '"
class="btn " >' . $postIcon . '</a>';
			}
			return parent::getInput() . $postIcon;
		}
		
	}
	
	protected function getLabel() {
		
		if (!$this->hidden &&
($this->form->getValue('version') == 1)) {
			return '';
		} else {
			return parent::getLabel();
		}
	}
	
}
?>
models/fields/phocaurl.php000064400000005634151167552070011644
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
JFormHelper::loadFieldClass('url');

class JFormFieldPhocaUrl extends JFormFieldUrl
{
	protected $type 		= 'PhocaUrl';
	
	protected function getInput() {

		if (!$this->hidden &&
($this->form->getValue('version') == 1)) {
			// Initialize some field attributes.
			$size		= $this->element['size'] ? '
size="'.(int)
$this->element['size'].'"' : '';
			$class		= $this->element['class'] ? '
class="'.(string)
$this->element['class'].'"' : '';
			$maxLength	= $this->element['maxlength'] ? '
maxlength="'.(int)
$this->element['maxlength'].'"' : '';
			$readonly	= ((string) $this->element['readonly'] ==
'true') ? ' readonly="readonly"' :
'';
			$disabled	= ((string) $this->element['disabled'] ==
'true') ? ' disabled="disabled"' :
'';
			$placeholder= htmlspecialchars($this->getTitle() .
($this->required ?
''.JText::_('COM_PHOCAGUESTBOOK_REQUIREDSIGN') :
''), ENT_COMPAT, 'UTF-8');
			// Initialize JavaScript field attributes.
			$onchange	= $this->element['onchange'] ? '
onchange="'.(string)
$this->element['onchange'].'"' : '';
			$value 		= htmlspecialchars($this->value, ENT_COMPAT,
'UTF-8');
			$requInput	= $this->required ? ' required="required"
aria-required="true"' : '';
			
			//prepend:
			$preIcon	= $this->element['preicon'] 	? '<i
class="' . $this->element['preicon'] . '
tip" title="' . $placeholder .
'"></i>' : '';
			$postIcon	= $this->element['posticon'] 	? '<i
class="' . $this->element['preicon'] .
'"></i>' : '';
			if ($postIcon && $this->element['posthref']) {
				$postIcon = '<a href="' . (string)
$this->element['posthref'] . '" title="' .
JText::_('COM_PHOCAGUESTBOOK_RELOAD_IMAGE') . '"
class="btn hasTooltip" >' . $postIcon .
'</a>';
			}

			// Get the label text from the XML element, defaulting to the element
name.
			$text = $this->element['label'] ? (string)
$this->element['label'] : (string)
$this->element['name'];
			$text = $this->translateLabel ? JText::_($text) : $text;

			// Add the opening label tag and main attributes attributes.
			$label = '<label id="' . $this->id .
'-lbl" for="' . $this->id . '"
class="element-invisible" title="' . $placeholder  .
'">' . $text . '</label>';

			return '<span class="add-on">' . $preIcon .
$label . '</span>'
		    . '<input'. $requInput. ' type="text"
name="'.$this->name.'"
id="'.$this->id.'"
placeholder="'.$placeholder.'"
value="'.$value.'"'
				  
.$class.$size.$disabled.$readonly.$onchange.$maxLength.'/>';
		} else {
			return parent::getInput();
		}
		
	}
	
	protected function getLabel() {
		
		if (!$this->hidden &&
($this->form->getValue('version') == 1)) {
			return '';
		} else {
			return parent::getLabel();
		}
	}
	
}
?>
models/forms/checkout.xml000064400000000443151167552070011516
0ustar00<?xml version="1.0" encoding="UTF-8"?>
<form>

<fieldset name="user"
addrulepath="components/com_phocacart/models/rules"
addfieldpath="components/com_phocacart/models/fields"
label="COM_PHOCACART_FORM_LABEL">
			



			
		
	</fieldset>
	
	<fieldset name="hidden">
	
			
	</fieldset>
</form>
models/forms/index.html000064400000000072151167552070011162
0ustar00<html><body style="background-color:
#000;"></body></html>models/forms/question.xml000064400000006432151167552070011564
0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>

	<fieldset
addfieldpath="/components/com_phocacart/models/fields"
addrulepath="/components/com_phocacart/models/rules">

<field name="id" type="text" default="0"
label="JGLOBAL_FIELD_ID_LABEL" readonly="true"
class="readonly" filter="integer" />

<field name="user_id" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_USER_ID_LABEL"
description="COM_PHOCACART_FIELD_USER_ID_DESC"
filter="integer" />

<field name="product_id" type="hidden"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_PRODUCT_ID_LABEL"
description="COM_PHOCACART_FIELD_PRODUCT_ID_DESC"
filter="integer" />
<field name="category_id" type="hidden"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_CATEGORY_ID_LABEL"
description="COM_PHOCACART_FIELD_CATEGORY_ID_DESC"
filter="integer" />

<field name="name" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_F_NAME_LABEL"
description="COM_PHOCACART_FIELD_F_NAME_DESC"
filter="string" />

<field name="email" type="email"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_F_EMAIL_LABEL"
description="COM_PHOCACART_FIELD_F_EMAIL_DESC"
validate="phocacartemail" filter="string" />

<field name="phone" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_F_PHONE_LABEL"
description="COM_PHOCACART_FIELD_F_PHONE_DESC"
filter="string" />

<field name="phone_mobile" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_F_MOBILE_PHONE_LABEL"
description="COM_PHOCACART_FIELD_F_MOBILE_PHONE_DESC" 
filter="string" />

<field name="message" type="textarea"
class="inputbox ph-question-message" 
label="COM_PHOCACART_FIELD_F_MESSAGE_LABEL"
description="COM_PHOCACART_FIELD_F_MESSAGE_DESC"
filter="string" rows="7" cols="45" />

<field
			name="phq_captcha"
			id="question-captcha"
			type="phocacaptcha"
			required="true"
			label="COM_PHOCACART_SECURITY_CHECK"
			description="COM_PHOCACART_PLEASE_PROVE_THAT_YOU_ARE_HUMAN"
			validate="phocacartcaptcha"
			preicon=""
			posticon=""
			posthref=""
			class="inputbox"
		/>

<field name="ip" type="hidden"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_IP_LABEL"
description="COM_PHOCACART_FIELD_IP_DESC"
filter="string" />

<field name="ordering" type="PhocacartOrdering"
table="region" class="inputbox"
label="COM_PHOCACART_FIELD_ORDERING_LABEL"
description="COM_PHOCACART_FIELD_ORDERING_DESC"
filter="integer" />

	</fieldset>
	<fieldset name="publish"
label="COM_PHOCACART_GROUP_LABEL_PUBLISHING_DETAILS" >

<field name="published" type="list"
label="COM_PHOCACART_FIELD_PUBLISHED_LABEL"
description="COM_PHOCACART_FIELD_PUBLISHED_DESC"
class="inputbox" size="1" default="1"
filter="string" >
	<option value="1">JPUBLISHED</option>
	<option	value="0">JUNPUBLISHED</option>
</field>

<field name="language" type="contentlanguage"
label="JFIELD_LANGUAGE_LABEL"
description="COM_PHOCACART_FIELD_LANGUAGE_DESC"
class="inputbox" filter="string">
	<option value="*">JALL</option>
</field>

<field name="date" type="Calendar"
class="inputbox" label="COM_PHOCACART_FIELD_DATE_LABEL"
description="COM_PHOCACART_FIELD_DATE_DESC"
filter="server-utc" />

	</fieldset>

	<fieldset >
		<field	name="hidden_field" type="text"
preicon="icon-flag" id="phocacart-hidden"
validate="phocacarthidden"/>
		<field	name="privacy" type="hidden"
filter="integer"/>
	</fieldset>

</form>
models/forms/submit.xml000064400000032227151167552070011221
0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>

    <fields name="items_item">
        <fieldset name="items_item"
addfieldpath="/components/com_phocacart/models/fields"
addrulepath="/components/com_phocacart/models/rules">


            <field name="title" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_TITLE_LABEL"
description="COM_PHOCACART_FIELD_TITLE_DESC"
filter="string"/>
            <field name="alias" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_ALIAS_LABEL"
description="COM_PHOCACART_FIELD_ALIAS_DESC"
filter="string"/>
            <field name="sku" type="text"
class="inputbox" size="255"
label="COM_PHOCACART_FIELD_SKU_LABEL"
description="COM_PHOCACART_FIELD_SKU_DESC"
filter="string"/>
            <field name="upc" type="text"
class="inputbox" size="15"
label="COM_PHOCACART_FIELD_UPC_LABEL"
description="COM_PHOCACART_FIELD_UPC_DESC"
filter="string"/>
            <field name="ean" type="text"
class="inputbox" size="15"
label="COM_PHOCACART_FIELD_EAN_LABEL"
description="COM_PHOCACART_FIELD_EAN_DESC"
filter="string"/>
            <field name="jan" type="text"
class="inputbox" size="15"
label="COM_PHOCACART_FIELD_JAN_LABEL"
description="COM_PHOCACART_FIELD_JAN_DESC"
filter="string"/>
            <field name="isbn" type="text"
class="inputbox" size="15"
label="COM_PHOCACART_FIELD_ISBN_LABEL"
description="COM_PHOCACART_FIELD_ISBN_DESC"
filter="string"/>
            <field name="mpn" type="text"
class="inputbox" size="255"
label="COM_PHOCACART_FIELD_MPN_LABEL"
description="COM_PHOCACART_FIELD_MPN_DESC"
filter="string"/>

            <field name="serial_number" type="text"
class="inputbox" size="255"
label="COM_PHOCACART_FIELD_SERIAL_NUMBER_LABEL"
description="COM_PHOCACART_FIELD_SERIAL_NUMBER_DESC"
filter="string"/>
            <field name="registration_key"
type="text" class="inputbox" size="255"
label="COM_PHOCACART_FIELD_REGISTRATION_KEY_LABEL"
description="COM_PHOCACART_FIELD_REGISTRATION_KEY_DESC"
filter="string"/>

            <field name="external_id" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_EXTERNAL_PRODUCT_ID_LABEL"
description="COM_PHOCACART_FIELD_EXTERNAL_PRODUCT_ID_DESC"
filter="string"/>
            <field name="external_key" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_EXTERNAL_PRODUCT_KEY_LABEL"
description="COM_PHOCACART_FIELD_EXTERNAL_PRODUCT_KEY_DESC"
filter="string"/>

            <field name="external_link" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_EXTERNAL_LINK_LABEL"
description="COM_PHOCACART_FIELD_EXTERNAL_LINK_DESC"
filter="url"/>
            <field name="external_text" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_EXTERNAL_TEXT_LABEL"
description="COM_PHOCACART_FIELD_EXTERNAL_TEXT_DESC"
filter="string"/>
            <field name="external_link2" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_EXTERNAL_LINK_2_LABEL"
description="COM_PHOCACART_FIELD_EXTERNAL_LINK_2_DESC"
filter="url"/>
            <field name="external_text2" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_EXTERNAL_TEXT_2_LABEL"
description="COM_PHOCACART_FIELD_EXTERNAL_TEXT_2_DESC"
filter="string"/>

            <field name="price" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_PRICE_LABEL"
description="COM_PHOCACART_FIELD_PRICE_DESC"
filter="float"/>
            <field name="price_original" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_ORIGINAL_PRICE_LABEL"
description="COM_PHOCACART_FIELD_ORIGINAL_PRICE_DESC"
filter="float"/>

            <field name="tax_id" type="phocatax"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_TAX_LABEL"
description="COM_PHOCACART_FIELD_TAX_DESC"
filter="integer"/>

            <field name="catid_multiple"
type="phocacartcategory"
label="COM_PHOCACART_FIELD_CATEGORY_LABEL"
description="COM_PHOCACART_FIELD_CATEGORY_DESC"
class="inputbox" multiple="true"
filter="int_array"/>

            <field name="manufacturer_id"
type="phocamanufacturer"
label="COM_PHOCACART_FIELD_MANUFACTURER_LABEL"
description="COM_PHOCACART_FIELD_MANUFACTURER_DESC"
class="inputbox" filter="integer"/>


            <field name="description"
type="textarea" buttons="true"
hide="pagebreak,readmore" class="inputbox"
label="COM_PHOCACART_FIELD_DESCRIPTION_LABEL"
filter="string"
                  
description="COM_PHOCACART_FIELD_DESCRIPTION_DESC"
cols="75" rows="10"/>
            <field name="description_long"
type="textarea" buttons="true"
hide="pagebreak,readmore" class="inputbox"
label="COM_PHOCACART_FIELD_DESCRIPTION_LONG_LABEL"
filter="string"
                  
description="COM_PHOCACART_FIELD_DESCRIPTION_LONG_DESC"
cols="75" rows="10"/>
            <field name="features" type="textarea"
buttons="true" hide="pagebreak,readmore"
class="inputbox"
label="COM_PHOCACART_FIELD_FEATURES_LABEL"
filter="string"
                  
description="COM_PHOCACART_FIELD_FEATURES_DESC"
cols="75" rows="10"/>

            <field name="image" type="phocacartfile"
typemethod="image"
label="COM_PHOCACART_FIELD_IMAGE_LABEL"
description="COM_PHOCACART_FIELD_IMAGE_DESC" class="inputbox
imageCreateThumbs" size="40" filter="string"/>


            <field name="video" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_VIDEO_URL_LABEL"
description="COM_PHOCACART_FIELD_VIDEO_URL_DESC"
filter="url"/>

            <field name="type" default="0"
type="list"
label="COM_PHOCACART_FIELD_PRODUCT_TYPE_LABEL"
description="COM_PHOCACART_FIELD_PRODUCT_TYPE_DESC"
filter="integer">
                <option
value="0">COM_PHOCACART_PHYSICAL_PRODUCT</option>
                <option
value="1">COM_PHOCACART_DIGITAL_DOWNLOADABLE_PRODUCT</option>
                <option
value="2">COM_PHOCACART_MIXED_PRODUCT_DIGITAL_PHYSICAL</option>
                <option
value="3">COM_PHOCACART_PRICE_ON_DEMAND_PRODUCT</option>
            </field>

            <field name="unit_amount" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_UNIT_AMOUNT_LABEL"
description="COM_PHOCACART_FIELD_UNIT_AMOUNT_DESC"
filter="string"/>
            <field name="unit_unit" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_UNIT_UNIT_LABEL"
description="COM_PHOCACART_FIELD_UNIT_UNIT_DESC"
filter="string"/>


            <field name="length" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_LENGTH_LABEL"
description="COM_PHOCACART_FIELD_LENGTH_DESC"
filter="string"/>
            <field name="width" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_WIDTH_LABEL"
description="COM_PHOCACART_FIELD_WIDTH_DESC"
filter="string"/>
            <field name="height" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_HEIGHT_LABEL"
description="COM_PHOCACART_FIELD_HEIGHT_DESC"
filter="string"/>


            <field name="weight" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_WEIGHT_LABEL"
description="COM_PHOCACART_FIELD_WEIGHT_DESC"
filter="string"/>


            <field name="volume" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_VOLUME_LABEL"
description="COM_PHOCACART_FIELD_VOLUME_DESC"
filter="string"/>

            <field name="condition" type="list"
label="COM_PHOCACART_FIELD_PRODUCT_CONDITION_LABEL"
description="COM_PHOCACART_FIELD_PRODUCT_CONDITION_DESC"
class="inputbox" size="1" default="0"
filter="integer">
                <option
value="0">COM_PHOCACART_CONDITION_NEW</option>
                <option
value="1">COM_PHOCACART_CONDITION_REFURBISHED</option>
                <option
value="2">COM_PHOCACART_CONDITION_USED</option>
            </field>

            <field name="type_feed" type="textarea"
label="COM_PHOCACART_FIELD_PRODUCT_TYPE_FEED_LABEL"
description="COM_PHOCACART_FIELD_PRODUCT_TYPE_FEED_DESC"
class="inputbox" rows="3" cols="30"
filter="string"/>

            <field name="type_category_feed"
type="textarea"
label="COM_PHOCACART_FIELD_PRODUCT_CATEGORY_TYPE_FEED_LABEL"
description="COM_PHOCACART_FIELD_PRODUCT_CATEGORY_TYPE_FEED_DESC"
class="inputbox" rows="3"
                   cols="30" filter="string"/>

            <field name="delivery_date"
type="Calendar" class="inputbox"
label="COM_PHOCACART_FIELD_PRODUCT_DELIVERY_DATE_LABEL"
description="COM_PHOCACART_FIELD_PRODUCT_DELIVERY_DATE_DESC"
                   filter="string" showtime="true"
format="%Y-%m-%d %H:%M:%S"/>


            <field name="metatitle" type="text"
                   label="COM_PHOCACART_FIELD_META_TITLE_LABEL"
description="COM_PHOCACART_FIELD_META_TITLE_DESC"
                   class="inputbox"
filter="string"/>

            <field name="metakey" type="textarea"
                   label="JField_Meta_Keywords_Label"
description="JField_Meta_Keywords_Desc"
                   class="inputbox" rows="3"
cols="30" filter="string"/>

            <field name="metadesc" type="textarea"
                   label="JField_Meta_Description_Label"
description="JField_Meta_Description_Desc"
                   class="inputbox" rows="3"
cols="30" filter="string"/>

            <field name="date" type="Calendar"
class="inputbox" label="COM_PHOCACART_FIELD_DATE_LABEL"
description="COM_PHOCACART_FIELD_DATE_DESC"
filter="string"/>
            <field name="date_update"
type="Calendar" class="inputbox"
label="COM_PHOCACART_FIELD_UPDATE_DATE_LABEL"
description="COM_PHOCACART_FIELD_UPDATE_DATE_DESC"
filter="string"/>

            <field name="tags" type="phocatags"
multiple="true" label="COM_PHOCACART_FIELD_TAGS_LABEL"
description="COM_PHOCACART_FIELD_TAGS_DESC"
class="inputbox" size="1"
filter="int_array"/>

            <field name="taglabels"
type="phocataglabels" multiple="true"
label="COM_PHOCACART_FIELD_LABELS_LABEL"
description="COM_PHOCACART_FIELD_LABELS_DESC"
class="inputbox" size="1"
filter="int_array"/>


        </fieldset>
    </fields>

    <fields name="items_contact">

        <fieldset name="items_contact"
addfieldpath="/components/com_phocacart/models/fields"
addrulepath="/components/com_phocacart/models/rules">

            <field name="name" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_F_NAME_LABEL"
description="COM_PHOCACART_FIELD_F_NAME_DESC"
filter="string"/>

            <field name="email" type="email"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_F_EMAIL_LABEL"
description="COM_PHOCACART_FIELD_F_EMAIL_DESC"
filter="string" validate="phocacartemail"/>

            <field name="phone" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_F_PHONE_LABEL"
description="COM_PHOCACART_FIELD_F_PHONE_DESC"
filter="string"/>

            <field name="phone_mobile" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_F_MOBILE_PHONE_LABEL"
description="COM_PHOCACART_FIELD_F_MOBILE_PHONE_DESC"
filter="string"/>

            <field name="message" type="textarea"
class="inputbox ph-question-message"
label="COM_PHOCACART_FIELD_F_MESSAGE_LABEL"
description="COM_PHOCACART_FIELD_F_MESSAGE_DESC"
filter="string"
                   rows="7" cols="45"/>

        </fieldset>

    </fields>


    <fieldset
addfieldpath="/components/com_phocacart/models/fields"
addrulepath="/components/com_phocacart/models/rules">

        <field name="hidden_field" type="text"
preicon="icon-flag" id="phocacart-hidden"
validate="phocacarthidden"/>


        <field
                name="phq_captcha"
                id="question-captcha"
                type="phocacaptcha"
                required="true"
                label="COM_PHOCACART_SECURITY_CHECK"
               
description="COM_PHOCACART_PLEASE_PROVE_THAT_YOU_ARE_HUMAN"
                validate="phocacartcaptcha"
                preicon=""
                posticon=""
                posthref=""
                class="inputbox"
        />

        <field name="ip" type="hidden"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_IP_LABEL"
description="COM_PHOCACART_FIELD_IP_DESC"
filter="string"/>
        <field name="id" type="text"
default="0" label="JGLOBAL_FIELD_ID_LABEL"
readonly="true" class="readonly"/>
        <field name="user_id" type="user"
default="0" label="COM_PHOCACART_USER_ID_LABEL"
description="COM_PHOCACART_USER_ID_DESC"/>
        <field name="date_submit" type="Calendar"
class="inputbox" label="COM_PHOCACART_FIELD_DATE_LABEL"
description="COM_PHOCACART_FIELD_DATE_DESC"
filter="JComponentHelper::filterText"/>
        <field name="published" type="list"
label="COM_PHOCACART_FIELD_PUBLISHED_LABEL"
description="COM_PHOCACART_FIELD_PUBLISHED_DESC"
class="inputbox" size="1" default="1">
            <option value="1">JPUBLISHED</option>
            <option value="0">JUNPUBLISHED</option>
        </field>
        <field name="ordering"
type="PhocacartOrdering" table="submititem"
class="inputbox"
label="COM_PHOCACART_FIELD_ORDERING_LABEL"
description="COM_PHOCACART_FIELD_ORDERING_DESC"/>
        <field name="privacy" type="hidden"
filter="integer"/>

        <field name="upload_folder" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_UPLOAD_FOLDER_LABEL"
description="COM_PHOCACART_FIELD_UPLOAD_FOLDER_LABEL"
filter="string"/>
        <field name="upload_token" type="text"
class="inputbox" size="40"
label="COM_PHOCACART_FIELD_UPLOAD_TOKEN_LABEL"
description="COM_PHOCACART_FIELD_UPLOAD_TOKEN_LABEL"
filter="string"/>

    </fieldset>

    <fieldset>
        <field name="hidden_field" type="text"
preicon="icon-flag" id="phocacart-hidden"
validate="phocacarthidden"/>
    </fieldset>

</form>
models/index.html000064400000000054151167552070010034
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>models/item.php000064400000031044151167552070007511
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */

use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;

defined('_JEXEC') or die();
jimport('joomla.application.component.model');

class PhocaCartModelItem extends JModelLegacy
{
	var $item 				= null;
	var $category			= null;
	var $itemname			= null;
	var $itemnext			= null;
	var $itemprev			= null;

	function __construct() {
		$app	= JFactory::getApplication();
		parent::__construct();
		$this->setState('filter.language',$app->getLanguageFilter());
	}

	function getItem( $itemId, $catId) {
		if (empty($this->item)) {
			$query			= $this->getItemQuery( $itemId, $catId);
			$this->item		= $this->_getList( $query, 0 , 1 );

			if (empty($this->item)) {
				return null;
			}
		}
		return $this->item;
	}

	function getItemNext($ordering, $catid) {
		if (empty($this->itemnext)) {
			$query				= $this->getItemQueryOrdering( $ordering, $catid, 2 );
			$this->itemnext		= $this->_getList( $query, 0 , 1 );

			if (empty($this->itemnext)) {
				return null;
			}
		}
		return $this->itemnext;
	}
	function getItemPrev($ordering, $catid) {
		if (empty($this->itemprev)) {
			$query				= $this->getItemQueryOrdering( $ordering, $catid, 1 );
			$this->itemprev	= $this->_getList( $query, 0 , 1 );

			if (empty($this->itemprev)) {
				return null;
			}
		}
		return $this->itemprev;
	}

	private function getItemQueryOrdering($ordering, $catid, $direction) {

		$app		= JFactory::getApplication();
		$params 	= $app->getParams();
		$p['hide_products_out_of_stock']	= $params->get(
'hide_products_out_of_stock', 0);

		$skip			        = array();
		$skip['access']	        =
$params->get('sql_product_skip_access', 0);
		$skip['group']	        =
$params->get('sql_product_skip_group', 0);
		//$skip['attributes']	    =
$params->get('sql_product_skip_attributes', 0);
		$skip['category_type']  =
$params->get('sql_product_skip_category_type', 0);
		//$skip['tax']   			=
$params->get('sql_product_skip_tax', 0);

		$user 		= PhocacartUser::getUser();
		$userLevels	= implode (',',
$user->getAuthorisedViewLevels());
		$userGroups = implode (',',
PhocacartGroup::getGroupsById($user->id, 1, 1));


		$wheres[]	= " pc.category_id = ".(int) $catid;
		//$wheres[]	= " c.catid= c.id";
		$wheres[] = " a.published = 1";
		$wheres[] = " c.published = 1";

		if ($direction == 1) {
			$wheres[] = " pc.ordering < " . (int) $ordering;
			$order = 'DESC';
		} else {
			$wheres[] = " pc.ordering > " . (int) $ordering;
			$order = 'ASC';
		}

		if (!$skip['category_type']) {
			$wheres[] = " c.type IN (0,1)";// type: common, onlineshop,
pos
		}

		if (!$skip['access']) {
			$wheres[] = " c.access IN (" . $userLevels . ")";
			$wheres[] = " a.access IN (" . $userLevels . ")";
		}

		if (!$skip['group']) {
			$wheres[] = " (ga.group_id IN (" . $userGroups . ") OR
ga.group_id IS NULL)";
			$wheres[] = " (gc.group_id IN (" . $userGroups . ") OR
gc.group_id IS NULL)";
		}

		if ($this->getState('filter.language')) {
			$lang 		= JFactory::getLanguage()->getTag();
			$wheres[] 	=
PhocacartUtilsSettings::getLangQuery('a.language', $lang);
			$wheres[] 	=
PhocacartUtilsSettings::getLangQuery('c.language', $lang);
		}

		if ($p['hide_products_out_of_stock'] == 1) {
			$wheres[] = " a.stock > 0";
		}

		$query = ' SELECT a.id, a.title, a.alias, a.catid, c.id AS
categoryid, c.title AS categorytitle, c.alias AS categoryalias'
				.' FROM #__phocacart_products AS a'
				.' LEFT JOIN #__phocacart_product_categories AS pc ON
pc.product_id = a.id'
				.' LEFT JOIN #__phocacart_categories AS c ON c.id =
pc.category_id';
		if (!$skip['group']) {
			$query .= ' LEFT JOIN #__phocacart_item_groups AS ga ON a.id =
ga.item_id AND ga.type = 3'// type 3 is product
					. ' LEFT JOIN #__phocacart_item_groups AS gc ON c.id = gc.item_id
AND gc.type = 2';// type 2 is category
		}

		$query .= ' WHERE ' . implode( ' AND ', $wheres )
				.' ORDER BY pc.ordering '.$order;


		return $query;

	}
	private function getItemQuery( $itemId, $catId ) {

		$app		= JFactory::getApplication();
		$params 	= $app->getParams();
		$p['hide_products_out_of_stock']	= $params->get(
'hide_products_out_of_stock', 0);


		$user 		= PhocacartUser::getUser();
		$userLevels	= implode (',',
$user->getAuthorisedViewLevels());
		$userGroups = implode (',',
PhocacartGroup::getGroupsById($user->id, 1, 1));

		$categoryId	= 0;
		$category	= $this->getCategory($itemId, $catId);

		if (isset($category[0]->id)) {
			$categoryId = $category[0]->id;
		}

		$skip			        = array();
		$skip['access']	        =
$params->get('sql_product_skip_access', 0);
		$skip['group']	        =
$params->get('sql_product_skip_group', 0);
		//$skip['attributes']	    =
$params->get('sql_product_skip_attributes', 0);
		$skip['category_type']  =
$params->get('sql_product_skip_category_type', 0);
		$skip['tax']   			=
$params->get('sql_product_skip_tax', 0);

		$wheres		= array();
		$wheres[]	= " pc.category_id= ".(int) $categoryId;
		$wheres[]	= " pc.category_id= c.id";
		$wheres[] 	= " i.published = 1";
		$wheres[] 	= " c.published = 1";
		$wheres[] 	= " i.id = " . (int) $itemId;

		if (!$skip['category_type']) {
			$wheres[] = " c.type IN (0,1)";// type: common, onlineshop,
pos
		}

		if (!$skip['access']) {
			$wheres[] = " c.access IN (" . $userLevels . ")";
			$wheres[] = " i.access IN (" . $userLevels . ")";
		}

		if (!$skip['group']) {
			$wheres[] = " (ga.group_id IN (" . $userGroups . ") OR
ga.group_id IS NULL)";
			$wheres[] = " (gc.group_id IN (" . $userGroups . ") OR
gc.group_id IS NULL)";
		}


		if ($this->getState('filter.language')) {
			$wheres[] =  ' i.language IN
('.$this->_db->Quote(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
			$wheres[] =  ' c.language IN
('.$this->_db->Quote(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
		}

		if ($p['hide_products_out_of_stock'] == 1) {
			$wheres[] = " i.stock > 0";
		}

		// Views Plugin can load additional columns
		$additionalColumns = array();
		$pluginLayout 	= PluginHelper::importPlugin('pcv');
		if ($pluginLayout) {
			$pluginOptions 				= array();
			$eventData 					= array();
			Factory::getApplication()->triggerEvent('PCVonItemBeforeLoadColumns',
array('com_phocacart.items', &$pluginOptions, $eventData));

			if (isset($pluginOptions['columns']) &&
$pluginOptions['columns'] != '') {
				if (!empty($pluginOptions['columns'])) {
					foreach ($pluginOptions['columns'] as $k => $v) {
						$additionalColumns[] = PhocacartText::filterValue($v,
'alphanumeric3');
					}
				}
			}
		}

		$baseColumns = array('i.id', 'i.title',
'i.alias', 'i.description', 'i.features',
'i.metatitle', 'i.metadesc', 'i.metakey',
'i.metadata', 'i.type', 'i.image',
'i.weight', 'i.height', 'i.width',
'i.length', 'i.min_multiple_quantity',
'i.min_quantity_calculation', 'i.volume',
'i.description', 'i.description_long',
'i.price', 'i.price_original',
'i.stockstatus_a_id', 'i.stockstatus_n_id',
'i.stock_calculation', 'i.min_quantity',
'i.min_multiple_quantity', 'i.stock',
'i.sales', 'i.featured', 'i.external_id',
'i.unit_amount', 'i.unit_unit', 'i.video',
'i.external_link', 'i.external_text',
'i.external_link2', 'i.external_text2',
'i.public_download_file', 'i.public_download_text',
'i.public_play_file', 'i.public_play_text',
'i.sku', 'i.upc', 'i.ean', 'i.jan',
'i.isbn', 'i.mpn', 'i.serial_number',
'i.points_needed', 'i.points_received',
'i.date', 'i.date_update', 'i.delivery_date',
'i.gift_types');

		$col = array_merge($baseColumns, $additionalColumns);
		$col = array_unique($col);



		$columns	= implode(',', $col) . ', pc.ordering, c.id AS
catid, c.title AS cattitle, c.alias AS catalias, m.id as manufacturerid,
m.title as manufacturertitle, m.link as manufacturerlink,';

		if (!$skip['tax']) {
            $columns .= ' t.id as taxid, t.tax_rate as taxrate,
t.calculation_type as taxcalculationtype, t.title as taxtitle,';
        } else {
            $columns .= ' NULL as taxid, NULL as taxrate, NULL as
taxcalculationtype, NULL as taxtitle,';
        }

        if (!$skip['group']) {
            $columns .= ' MIN(ppg.price) as group_price,
MAX(pptg.points_received) as group_points_received';
        } else {
            $columns .= ' NULL as group_price, NULL as
group_points_received';
        }


		$groupsFull	= implode(',', $col) .',pc.ordering, c.id,
c.title, c.alias, m.id, m.title, m.link';

        if (!$skip['tax']) {
            $groupsFull .= ', t.id, t.tax_rate, t.calculation_type,
t.title';
        }

        $groupsFast	= 'i.id';
		$groups		= PhocacartUtilsSettings::isFullGroupBy() ? $groupsFull :
$groupsFast;


		$query = ' SELECT '.$columns
				.' FROM #__phocacart_products AS i'
				.' LEFT JOIN #__phocacart_product_categories AS pc ON
pc.product_id = i.id'
				.' LEFT JOIN #__phocacart_categories AS c ON c.id =
pc.category_id'
				.' LEFT JOIN #__phocacart_manufacturers AS m ON m.id =
i.manufacturer_id';

		if (!$skip['tax']) {
            $query .= ' LEFT JOIN #__phocacart_taxes AS t ON t.id =
i.tax_id';
        }

		if (!$skip['group']) {
			$query .= ' LEFT JOIN #__phocacart_item_groups AS ga ON i.id =
ga.item_id AND ga.type = 3';// type 3 is product
			$query .= ' LEFT JOIN #__phocacart_item_groups AS gc ON c.id =
gc.item_id AND gc.type = 2';// type 2 is category
			// user is in more groups, select lowest price by best group
			$query .= ' LEFT JOIN #__phocacart_product_price_groups AS ppg ON
i.id = ppg.product_id AND ppg.group_id IN (SELECT group_id FROM
#__phocacart_item_groups WHERE item_id = i.id AND group_id IN
('.$userGroups.') AND type = 3)';
			// user is in more groups, select highest points by best group
			$query .= ' LEFT JOIN #__phocacart_product_point_groups AS pptg ON
i.id = pptg.product_id AND pptg.group_id IN (SELECT group_id FROM
#__phocacart_item_groups WHERE item_id = i.id AND group_id IN
('.$userGroups.') AND type = 3)';
		}





		$query .= ' WHERE ' . implode( ' AND ', $wheres )
				.' GROUP BY '.$groups
				.' ORDER BY pc.ordering';

		//echo nl2br(str_replace('#__', 'jos_', $query));

		return $query;

	}

	function getCategory($itemId, $catId) {
		if (empty($this->category)) {
			$query			= $this->getCategoryQuery( $itemId, $catId );

			$this->category		= $this->_getList( $query, 0, 1 );
		}
		return $this->category;
	}

	function getCategoryQuery($itemId, $catId) {

		$user 		= PhocacartUser::getUser();
		$userLevels	= implode (',',
$user->getAuthorisedViewLevels());
		$userGroups = implode (',',
PhocacartGroup::getGroupsById($user->id, 1, 1));

		$wheres		= array();
		//$app		= JFactory::getApplication();
		//$params 	= $app->getParams();

		$wheres[] = " c.published = 1";

		$wheres[] = " c.type IN (0,1)";// type: common, onlineshop,
pos

		if ($this->getState('filter.language')) {
			$lang 		= JFactory::getLanguage()->getTag();
			//$wheres[] 	=
PhocacartUtilsSettings::getLangQuery('a.language', $lang);
			$wheres[] 	=
PhocacartUtilsSettings::getLangQuery('c.language', $lang);
		}

		if ((int)$catId > 0) {
			$wheres[]	= " c.id= ".(int)$catId;
		} else {
			$wheres[]	= " a.id= ".(int)$itemId;
		}

		$wheres[] = " c.access IN (".$userLevels.")";
		$wheres[] = " a.access IN (".$userLevels.")";

		$wheres[] = " (ga.group_id IN (".$userGroups.") OR
ga.group_id IS NULL)";
		$wheres[] = " (gc.group_id IN (".$userGroups.") OR
gc.group_id IS NULL)";

		$query = " SELECT c.id, c.title, c.alias, c.description,
c.parent_id"
				. " FROM #__phocacart_categories AS c"
				. ' LEFT JOIN #__phocacart_product_categories AS pc ON
pc.category_id = c.id'
				. " LEFT JOIN #__phocacart_products AS a ON a.id =
pc.product_id"
				. ' LEFT JOIN #__phocacart_item_groups AS ga ON a.id = ga.item_id
AND ga.type = 3'// type 3 is product
				. ' LEFT JOIN #__phocacart_item_groups AS gc ON c.id = gc.item_id
AND gc.type = 2'// type 2 is category
				. " WHERE " . implode( " AND ", $wheres )
				. " ORDER BY c.ordering";

		return $query;
	}

	public function hit($pk = 0) {
		$input = JFactory::getApplication()->input;
		$hitcount = $input->getInt('hitcount', 1);

		if ($hitcount) {
			$pk = (!empty($pk)) ? $pk : (int)
$this->getState('product.id');

			$table = JTable::getInstance('PhocaCartItem',
'Table');
			$table->load($pk);
			$table->hit($pk);
		}

		return true;
	}
}
?>
models/items.php000064400000056504151167552070007704 0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */


use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;

defined('_JEXEC') or die();
jimport('joomla.application.component.model');

class PhocaCartModelItems extends JModelLegacy
{

	protected $item 				= null;
	protected $item_ordering		= null;
	protected $layout_type			= null;
	protected $category 			= null;
	protected $subcategories 		= null;
	protected $category_ordering	= null;
	protected $pagination			= null;
	protected $total				= null;
	protected $ordering				= null;
	protected $items_layout_plugin	= '';

	public function __construct() {
		parent::__construct();


		$app				= Factory::getApplication();
		$config 			= Factory::getConfig();
		$paramsC 			= $app->getParams();
		$item_pagination	= $paramsC->get( 'item_pagination_default',
'20' );
		$item_ordering		= $paramsC->get( 'item_ordering', 1 );
		$layout_type		= $paramsC->get( 'layout_type',
'grid' );

		// Items View Menu link parameters
		$items_view_id_cats	= $paramsC->get( 'items_view_id_cats',
array() );
		$this->items_layout_plugin	= $paramsC->get(
'items_layout_plugin', '' );


		$manufacturer_alias	= $paramsC->get( 'manufacturer_alias',
'manufacturer');
		$manufacturer_alias	= $manufacturer_alias != '' ?
trim(PhocacartText::filterValue($manufacturer_alias,
'alphanumeric'))  : 'manufacturer';

		$limit					=
PhocacartPagination::getMaximumLimit($app->getUserStateFromRequest('com_phocacart.limit',
'limit', $item_pagination, 'int'));

		$this->setState('limit', $limit);
		$this->setState('limitstart',
$app->input->get('limitstart', 0, 'int'));
		$this->setState('limitstart',
($this->getState('limit') != 0 ?
(floor($this->getState('limitstart') /
$this->getState('limit')) *
$this->getState('limit')) : 0));
		$this->setState('filter.language',$app->getLanguageFilter());
		$this->setState('filter_order',
$app->input->get('filter_order', 'ordering'));
		$this->setState('filter_order_dir',
$app->input->get('filter_order_Dir', 'ASC'));
		$this->setState('itemordering',
$app->getUserStateFromRequest('com_phocacart.itemordering',
'itemordering', $item_ordering, 'int'));
		$this->setState('layouttype',
$app->getUserStateFromRequest('com_phocacart.layouttype',
'layouttype', $layout_type, 'string'));

		// =FILTER=
		$this->setState('tag',
$app->input->get('tag', '',
'string'));
		$this->setState('label',
$app->input->get('label', '',
'string'));
		$manufacturerParameter = '';
		$this->setState('manufacturer',
$app->input->get($manufacturer_alias, '',
'string'));
		$this->setState('price_from',
$app->input->get('price_from', '',
'float'));
		$this->setState('price_to',
$app->input->get('price_to', '',
'float'));

		// CATEGORIES
		// 1) there can be set one category per ID
		// 2) there can be set more categories per c parameter
		// 3) there can be set more categories by menu link parameters. If menu
link parameter is used, then 2) is deactivated
		//    because if somebody wants to force displaying only some categories,
another cannot be displayed e.g. per URL parameters
		//    E.g. we want to display only category 1 and 3 in items view and
user even set c=1,2,3 in URL - so the 2 will be just ignored

		// 1)
		$this->setState('id', $app->input->get('id',
'', 'int')); // Category ID (Active Category)

		// 2) 3)
		if (!empty($items_view_id_cats)) {
			$this->setState('c', implode(',',
$items_view_id_cats));
		} else {
			$this->setState('c', $app->input->get('c',
'', 'string')); // Category More (All Categories)
		}


		$this->setState('a', $app->input->get('a',
'', 'array')); // Attributes
		$this->setState('s', $app->input->get('s',
'', 'array')); // Specifications
		$parameters = PhocacartParameter::getAllParameters();
		$this->setState('parameter', $parameters);

		// =SEARCH=
		$this->setState('search',
$app->input->get('search', '',
'string'));

	}

	public function getLayoutType() {
		$layoutType 	= $this->getState('layouttype');
		$layoutType		= PhocacartRenderFront::getLayoutType($layoutType);
		return $layoutType;
	}

	public function getPagination() {
		if (empty($this->pagination)) {
			jimport('joomla.html.pagination');
			$this->pagination = new PhocacartPagination( $this->getTotal(),
$this->getState('limitstart'),
$this->getState('limit') );
		}
		return $this->pagination;
	}

	function getOrdering() {
		if(empty($this->ordering)) {
			$this->ordering =
PhocacartOrdering::renderOrderingFront($this->getState('itemordering'),
0);
		}
		return $this->ordering;
	}

	public function getTotal() {
		if (empty($this->total)) {
			$query = $this->getItemListQuery(1);
			$this->total = $this->_getListCount($query);
		}
		return $this->total;
	}

	public function getItemList() {
		if (empty($this->item)) {
			$query			= $this->getItemListQuery( );
			$this->item		= $this->_getList( $query
,$this->getState('limitstart'),
$this->getState('limit'));
		}
		return $this->item;
	}

	public function getCategory($categoryId) {
		if (empty($this->category)) {
			$query					= $this->getCategoriesQuery( $categoryId, FALSE );
			$this->category 		= $this->_getList( $query, 0, 1 );
		}
		return $this->category;
	}

	public function getSubcategories($categoryId) {
		if (empty($this->subcategories)) {
			$query					= $this->getCategoriesQuery( $categoryId, TRUE );
			$this->subcategories 	= $this->_getList( $query );
		}
		return $this->subcategories;
	}

	protected function getItemListQuery($count = 0) {

		$app		= Factory::getApplication();
		$user 		= PhocacartUser::getUser();
		$userLevels	= implode (',',
$user->getAuthorisedViewLevels());
		$userGroups = implode (',',
PhocacartGroup::getGroupsById($user->id, 1, 1));
		$params 	= $app->getParams();
		$wheres		= array();
		$lefts		= array();


		$skip			        = array();
		$skip['access']	        =
$params->get('sql_products_skip_access', 0);
		$skip['group']	        =
$params->get('sql_products_skip_group', 0);
		$skip['attributes']	    =
$params->get('sql_products_skip_attributes', 0);
		$skip['category_type']  =
$params->get('sql_products_skip_category_type', 0);
		$skip['tax']   			=
$params->get('sql_products_skip_tax', 0);

		$p = array();
		$p['hide_products_out_of_stock']	= $params->get(
'hide_products_out_of_stock', 0);
		$p['switch_image_category_items']	= $params->get(
'switch_image_category_items', 0 );
		$p['join_tag_label_filter']			= $params->get(
'join_tag_label_filter', 0 );
		$p['search_matching_option']		= $params->get(
'search_matching_option', 'any' );
		$p['search_deep']					= $params->get(
'search_deep', 0);
		$p['sql_search_skip_id']			= $params->get(
'sql_search_skip_id', 1 );

		$p['sql_search_skip_id_specific_type'] = 1;// POS or Online
Shop (Online Shop)
		if ($p['sql_search_skip_id'] != 1 &&
$p['sql_search_skip_id'] != 2){
			$p['sql_search_skip_id_specific_type'] = 0;

		}

		$wheres		= array();
		$wheres[] = ' a.published = 1';
		$wheres[] = ' c.published = 1';

		if (!$skip['category_type']) {
            $wheres[] = " c.type IN (0,1)";// type: common,
onlineshop, pos
        }

		if ($this->getState('filter.language')) {
			$lang 		= Factory::getLanguage()->getTag();
			$wheres[] 	=
PhocacartUtilsSettings::getLangQuery('a.language', $lang);
			$wheres[] 	=
PhocacartUtilsSettings::getLangQuery('c.language', $lang);
		}
		$itemOrdering = $this->getItemOrdering();


		if (!$skip['access']) {
			$wheres[] = " c.access IN (".$userLevels.")";
			$wheres[] = " a.access IN (".$userLevels.")";
		}

		if (!$skip['group']) {
			$wheres[] = " (ga.group_id IN (".$userGroups.") OR
ga.group_id IS NULL)";
			$wheres[] = " (gc.group_id IN (".$userGroups.") OR
gc.group_id IS NULL)";
		}

		if ($p['hide_products_out_of_stock'] == 1) {
			$wheres[] = " a.stock > 0";
		}

		// =FILTER=
		// -TAG- -LABEL-
		if ($p['join_tag_label_filter'] == 1) {

			// -TAG-
			$wheresTL = array();
			if ($this->getState('tag')) {
				$s = PhocacartSearch::getSqlParts('int', 'tag',
$this->getState('tag'));
				$wheresTL[]	= $s['where'];
				$lefts[]	= $s['left'];
			}
			// -LABEL-
			if ($this->getState('label')) {
				$s = PhocacartSearch::getSqlParts('int', 'label',
$this->getState('label'));
				$wheresTL[]	= $s['where'];
				$lefts[]	= $s['left'];
			}

			if ($this->getState('tag') ||
$this->getState('label')) {
				$startP = '';
				$endP 	= '';
				if (count($wheresTL) > 1) {
					$startP = '(';
					$endP 	= ')';
				}
				$wheres[] = $startP . implode(' OR ', $wheresTL) . $endP;

			}
		} else {

			// -TAG-
			if ($this->getState('tag')) {
				$s = PhocacartSearch::getSqlParts('int', 'tag',
$this->getState('tag'));
				$wheres[]	= $s['where'];
				$lefts[]	= $s['left'];

			}
			// -LABEL-
			if ($this->getState('label')) {
				$s = PhocacartSearch::getSqlParts('int', 'label',
$this->getState('label'));
				$wheres[]	= $s['where'];
				$lefts[]	= $s['left'];
			}

		}

		// -PARAMETER
		// Custom parameters set by user in administrator
		// All custom parameters are stored in one table so they are unique
		// So we can use one left for all parameters

		/*if ($this->getState('parameter')) {
			$parameterValues = array();
			foreach ($this->getState('parameter') as $k => $v) {
				$alias = PhocacartText::filterValue($v->alias, 'url');
				$parameter = $app->input->get($alias, '',
'string');

				if($parameter != '') {
					$parameterValues[] = $parameter;
				}
			}
			if (!empty($parameterValues)) {
				$parameterValuesString = implode(',',
$parameterValues);//Join all custom parameters together because of SQL
query - all should be in one IN(): AND pr.parameter_id IN (1,2,3)
				if ($parameterValuesString != '') {
					$s = PhocacartSearch::getSqlParts('int',
'parameter', $parameterValuesString);
					$wheres[] = $s['where'];
					$lefts[] = $s['left'];

				}
			}
		}*/

		if ($this->getState('parameter')) {
			//$leftOnce = 0;
			foreach ($this->getState('parameter') as $k => $v) {
				$alias = trim(PhocacartText::filterValue($v->alias,
'alphanumeric'));
				$parameter = $app->input->get($alias, '',
'string');

				if($parameter != '') {
					$s = PhocacartSearch::getSqlParts('int',
'parameter', $parameter, array(), $v->id);
					$wheres[] = $s['where'];// There must be AND between custom
parameters
					//if ($leftOnce < 1) {
						$lefts[] = $s['left'];
						//$leftOnce = 1;
					//}
				}
			}

		}


		// -MANUFACTURER-
		if ($this->getState('manufacturer')) {
			$s = PhocacartSearch::getSqlParts('int',
'manufacturer', $this->getState('manufacturer'));
			$wheres[]	= $s['where'];
			$lefts[]	= $s['left'];
		}
		// -PRICE-
		if ($this->getState('price_from')) {
			$s = PhocacartSearch::getSqlParts('int',
'price_from', $this->getState('price_from'));
			$wheres[]	= $s['where'];
			$lefts[]	= $s['left'];
		}
		if ($this->getState('price_to')) {
			$s = PhocacartSearch::getSqlParts('int', 'price_to',
$this->getState('price_to'));
			$wheres[]	= $s['where'];
			$lefts[]	= $s['left'];
		}

		// -CATEGORY-
		if ($this->getState('id')) {
			$s = PhocacartSearch::getSqlParts('int', 'id',
$this->getState('id'));
			$wheres[]	= $s['where'];
			$lefts[]	= $s['left'];
		}

		// -CATEGORY MORE-
		if ($this->getState('c')) {
			$s = PhocacartSearch::getSqlParts('int', 'c',
$this->getState('c'));
			$wheres[]	= $s['where'];
			$lefts[]	= $s['left'];
		}

		// -ATTRIBUTES-
		if ($this->getState('a')) {
			$s = PhocacartSearch::getSqlParts('array', 'a',
$this->getState('a'));
			$wheres[]	= $s['where'];
			$lefts[]	= $s['left'];
		}

		// -SPECIFICATIONS-
		if ($this->getState('s')) {
			$s = PhocacartSearch::getSqlParts('array', 's',
$this->getState('s'));
			$wheres[]	= $s['where'];
			$lefts[]	= $s['left'];
		}

		// =SEARCH=
		if ($this->getState('search')) {
			$s = PhocacartSearch::getSqlParts('string',
'search', $this->getState('search'), $p);
			$wheres[]	= '('.$s['where'].')';
			$lefts[]	= $s['left'];

			// Hit only one time
			if ($count == 0) {
				PhocacartStatisticsHits::searchHit($this->getState('search'));
			}
		}

		// Additional Images
		$leftImages = '';
		$selImages = '';

		if ($p['switch_image_category_items'] == 1) {
			$leftImages = ' LEFT JOIN #__phocacart_product_images AS im ON a.id
= im.product_id';
			$selImages	= ' GROUP_CONCAT(im.image) as additional_image,';

		}

		// Items Layout Plugin can change ordering
		// Items Layout Plugin can load additional columns
		$additionalColumns = array();
		if ($this->items_layout_plugin != '') {
			$this->items_layout_plugin =
PhocacartText::filterValue($this->items_layout_plugin,
'alphanumeric2');
			$pluginLayout 	= PluginHelper::importPlugin('pcl',
$this->items_layout_plugin);
			if ($pluginLayout) {
				$pluginOptions 				= array();
				$eventData 					= array();
				$eventData['pluginname'] 	= $this->items_layout_plugin;
				Factory::getApplication()->triggerEvent('PCLonItemsGetOptions',
array('com_phocacart.items', &$pluginOptions, $eventData));

				if (isset($pluginOptions['ordering']) &&
$pluginOptions['ordering'] != '') {
					$pluginOrdering =
PhocacartText::filterValue($pluginOptions['ordering'],
'alphanumeric5');
					if ($pluginOrdering != '') {
						$itemOrdering = $pluginOrdering . ',' . $itemOrdering;
					}
				}

				if (isset($pluginOptions['columns']) &&
$pluginOptions['columns'] != '') {
					if (!empty($pluginOptions['columns'])) {
						foreach ($pluginOptions['columns'] as $k => $v) {
							$additionalColumns[] = PhocacartText::filterValue($v,
'alphanumeric3');
						}
					}
				}
			}
		}

		// Views Plugin can load additional columns
		$pluginLayout 	= PluginHelper::importPlugin('pcv');
		if ($pluginLayout) {
			$pluginOptions 				= array();
			$eventData 					= array();
			Factory::getApplication()->triggerEvent('PCVonItemsBeforeLoadColumns',
array('com_phocacart.items', &$pluginOptions, $eventData));

			if (isset($pluginOptions['columns']) &&
$pluginOptions['columns'] != '') {
				if (!empty($pluginOptions['columns'])) {
					foreach ($pluginOptions['columns'] as $k => $v) {
						$additionalColumns[] = PhocacartText::filterValue($v,
'alphanumeric3');
					}
				}
			}
		}

		$baseColumns = array('a.id', 'a.title',
'a.image', 'a.alias', 'a.unit_amount',
'a.unit_unit', 'a.description',
			'a.sku', 'a.ean', 'a.upc',
'a.type', 'a.points_received',
'a.price_original',
			'a.stock', 'a.stock_calculation',
'a.min_quantity', 'a.min_multiple_quantity',
			'a.stockstatus_a_id',
'a.stockstatus_n_id','a.date', 'a.sales',
'a.featured',
			'a.external_id', 'a.unit_amount',
'a.unit_unit', 'a.external_link',
'a.external_text', 'a.price',
'a.gift_types');

		$col = array_merge($baseColumns, $additionalColumns);
		$col = array_unique($col);


		// Remove empty values:
		$wheres = array_filter($wheres);
		$lefts	= array_filter($lefts);

		if ($count == 1) {
			//$lefts[] = ' LEFT JOIN #__phocacart_categories AS c ON c.id =
a.catid';
			$lefts[] = ' LEFT JOIN #__phocacart_product_categories AS pc ON
pc.product_id =  a.id';
			$lefts[] = ' LEFT JOIN #__phocacart_categories AS c ON c.id =
pc.category_id';
			$lefts[] = ' LEFT JOIN #__phocacart_manufacturers AS m ON m.id =
a.manufacturer_id';

			if ($p['sql_search_skip_id_specific_type'] == 0){
				$lefts[] = ' LEFT JOIN #__phocacart_product_stock AS ps ON a.id =
ps.product_id';// search sku ean in advanced stock management
			}


			if (!$skip['attributes']) {
			    // see below for explanation
				// LEFT JOIN (SELECT id, product_id, MAX(required) AS required FROM
jos_phocacart_attributes GROUP BY product_id) AS at ON a.id = at.product_id
AND at.id > 0
			    $lefts[] = ' LEFT JOIN #__phocacart_attributes AS at ON a.id =
at.product_id AND at.id > 0 AND at.required = 1';
            }

			if (!$skip['group']) {
				$lefts[] = ' LEFT JOIN #__phocacart_item_groups AS ga ON a.id =
ga.item_id AND ga.type = 3';// type 3 is product
				$lefts[] = ' LEFT JOIN #__phocacart_item_groups AS gc ON c.id =
gc.item_id AND gc.type = 2';// type 2 is category
			}

			//$query = ' SELECT COUNT(DISTINCT a.id) AS count'; // 2.85ms
0.12mb
			$q = ' SELECT a.id' // 2.42ms 0.12mb
			. ' FROM #__phocacart_products AS a'
			. implode( ' ', $lefts )
			. ' WHERE ' . implode( ' AND ', $wheres )
			. ' GROUP BY a.id';

		} else {

			//$lefts[] = ' LEFT JOIN #__phocacart_categories AS c ON c.id =
a.catid';
			$lefts[] = ' LEFT JOIN #__phocacart_product_categories AS pc ON
pc.product_id = a.id';
			$lefts[] = ' LEFT JOIN #__phocacart_categories AS c ON c.id =
pc.category_id';
			$lefts[] = ' LEFT JOIN #__phocacart_reviews AS r ON a.id =
r.product_id AND r.id > 0';
			$lefts[] = ' LEFT JOIN #__phocacart_manufacturers AS m ON m.id =
a.manufacturer_id';

			if ($p['sql_search_skip_id_specific_type'] == 0){
				$lefts[] = ' LEFT JOIN #__phocacart_product_stock AS ps ON a.id =
ps.product_id';// search sku ean in advanced stock management
			}

			if (!$skip['tax']) {
				$lefts[] = ' LEFT JOIN #__phocacart_taxes AS t ON t.id =
a.tax_id';
			}

			if (!$skip['attributes']) {

				// We need to get information if at least one of the attributes of
selected product is required

				// 1) Select more rows - one product is displayed e.g. in two rows
				//$lefts[] = ' LEFT JOIN #__phocacart_attributes AS at ON a.id =
at.product_id AND at.id > 0';

				// 2) right solution as it select only the maximal value and if maximal
value is 1 then one of product attribute is required
				// LEFT JOIN (SELECT id, product_id, MAX(required) AS required FROM
jos_phocacart_attributes GROUP BY product_id) AS at ON a.id = at.product_id
AND at.id > 0

				// 3) faster version of 2)
				$lefts[] = ' LEFT JOIN #__phocacart_attributes AS at ON a.id =
at.product_id AND at.id > 0 AND at.required = 1';
            }

			if (!$skip['group']) {
				$lefts[] = ' LEFT JOIN #__phocacart_item_groups AS ga ON a.id =
ga.item_id AND ga.type = 3';// type 3 is product
				$lefts[] = ' LEFT JOIN #__phocacart_item_groups AS gc ON c.id =
gc.item_id AND gc.type = 2';// type 2 is category
				// user is in more groups, select lowest price by best group
				$lefts[] = ' LEFT JOIN #__phocacart_product_price_groups AS ppg ON
a.id = ppg.product_id AND ppg.group_id IN (SELECT group_id FROM
#__phocacart_item_groups WHERE item_id = a.id AND group_id IN (' .
$userGroups . ') AND type = 3)';
				// user is in more groups, select highest points by best group
				$lefts[] = ' LEFT JOIN #__phocacart_product_point_groups AS pptg
ON a.id = pptg.product_id AND pptg.group_id IN (SELECT group_id FROM
#__phocacart_item_groups WHERE item_id = a.id AND group_id IN (' .
$userGroups . ') AND type = 3)';
			}


			$columns	= implode(',', $col) . ','
						.' GROUP_CONCAT(DISTINCT c.id) AS catid, GROUP_CONCAT(DISTINCT
c.title) AS cattitle,'
						.' GROUP_CONCAT(DISTINCT c.alias) AS catalias,';

			if (!$skip['tax']) {
				$columns	.= ' t.id as taxid, t.tax_rate as taxrate,
t.calculation_type as taxcalculationtype, t.title as taxtitle,';
			} else {
				$columns	.= ' NULL as taxid, NULL as taxrate, NULL as
taxcalculationtype, NULL as taxtitle,';
			}

			if (!$skip['attributes']) {
                $columns	.= 'at.required AS attribute_required,
';
            }

			if (!$skip['group']) {
                $columns	.= ' MIN(ppg.price) as group_price,
MAX(pptg.points_received) as group_points_received,';
            } else {
                $columns	.= ' NULL as group_price, NULL as
group_points_received,';
            }


			$columns	.= ' m.id as manufacturerid, m.title as manufacturertitle,
m.alias as manufactureralias,'
						. $selImages
						.' AVG(r.rating) AS rating';


			$groupsFull	= implode(',', $col) ;

			if (!$skip['tax']) {
                $groupsFull	.= ', t.id, t.tax_rate,
t.calculation_type, t.title';
            }
			if (!$skip['attributes']) {
                $groupsFull	.= ', at.required';
            }

			$groupsFast	= 'a.id';
			$groups		= PhocacartUtilsSettings::isFullGroupBy() ? $groupsFull :
$groupsFast;


			$q = ' SELECT '.$columns
			. ' FROM #__phocacart_products AS a'
			. implode( ' ', $lefts )
			. $leftImages
			. ' WHERE ' . implode( ' AND ', $wheres )
			. ' GROUP BY '.$groups
			. ' ORDER BY '.$itemOrdering;


		}
		//echo "<br><br>" .
nl2br(str_replace('#__', 'jos_', $q));

		return $q;
	}

	protected function getCategoriesQuery( $categoryId, $subcategories = FALSE
) {

		$wheres		= array();
		$app		= Factory::getApplication();
		$params 	= $app->getParams();
		$user 		= PhocacartUser::getUser();
		$userLevels	= implode (',',
$user->getAuthorisedViewLevels());
		$userGroups = implode (',',
PhocacartGroup::getGroupsById($user->id, 1, 1));

		// Get the current category or get parent categories of the current
category
		if ($subcategories) {
			$wheres[]			= " c.parent_id = ".(int)$categoryId;
			$categoryOrdering 	= $this->getCategoryOrdering();
		} else {
			$wheres[]	= " c.id= ".(int)$categoryId;
		}

		$wheres[] = " c.published = 1";
		$wheres[] = " c.type IN (0,1)";// type: common, onlineshop,
pos
		$wheres[] = " c.access IN (".$userLevels.")";
		$wheres[] = " (gc.group_id IN (".$userGroups.") OR
gc.group_id IS NULL)";

		if ($this->getState('filter.language')) {
			$lang 		= Factory::getLanguage()->getTag();
			$wheres[] 	=
PhocacartUtilsSettings::getLangQuery('c.language', $lang);
		}

		if ($subcategories) {

			$columns	= 'c.id, c.title, c.alias, COUNT(c.id) AS numdoc';
			$groupsFull	= 'c.id, c.title, c.alias';
			$groupsFast	= 'c.id';
			$groups		= PhocacartUtilsSettings::isFullGroupBy() ? $groupsFull :
$groupsFast;

			$query = "SELECT ".$columns
				. " FROM #__phocacart_categories AS c"
				. " LEFT JOIN #__phocacart_products AS a ON a.catid = c.id AND
a.published = 1"
				. ' LEFT JOIN #__phocacart_item_groups AS gc ON c.id = gc.item_id
AND gc.type = 2'// type 2 is category
				. " WHERE " . implode( " AND ", $wheres )
				. " GROUP BY ".$groups
				. " ORDER BY ".$categoryOrdering;
		} else {
			$query = " SELECT c.id, c.title, c.alias, c.description,
c.metatitle, c.metakey, c.metadesc, c.metadata, cc.title as parenttitle,
c.parent_id as parentid, cc.alias as parentalias"
				. " FROM #__phocacart_categories AS c"
				. " LEFT JOIN #__phocacart_categories AS cc ON cc.id =
c.parent_id"
				. ' LEFT JOIN #__phocacart_item_groups AS gc ON c.id = gc.item_id
AND gc.type = 2'// type 2 is category
				. " WHERE " . implode( " AND ", $wheres )
				. " ORDER BY c.ordering";
		}
		return $query;
	}


	protected function getItemOrdering() {
		if (empty($this->item_ordering)) {
			$app						= Factory::getApplication();
			$params						= $app->getParams();
			//$ordering					= $params->get( 'item_ordering', 1 );
			$ordering					= $this->getState('itemordering');
			$this->item_ordering 		=
PhocacartOrdering::getOrderingText($ordering);
		}
		return $this->item_ordering;
	}

	protected function getCategoryOrdering() {
		if (empty($this->category_ordering)) {
			$app						= Factory::getApplication();
			$params						= $app->getParams();
			$ordering					= $params->get( 'category_ordering', 1 );
			$this->category_ordering 	=
PhocacartOrdering::getOrderingText($ordering, 1);
		}
		return $this->category_ordering;
	}
}
?>
models/orders.php000064400000007445151167552070010061 0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport('joomla.application.component.model');

class PhocaCartModelOrders extends JModelLegacy
{
	protected $orders 				= null;
	protected $orders_ordering		= null;
	protected $pagination			= null;
	protected $total				= null;

	public function __construct() {
		parent::__construct();

		$app		= JFactory::getApplication();
		$config 	= JFactory::getConfig();
		//$paramsC 	= PhocacartUtils::getComponentParameters() ;
		$paramsC 	= $app->getParams();
		$defaultP	= $paramsC->get( 'default_pagination',
'20' );
		$this->setState('limit',
$app->getUserStateFromRequest('com_phocacart.orders.limit',
'limit', $defaultP, 'int'));
		$this->setState('limitstart',
$app->input->get('limitstart', 0, 'int'));
		$this->setState('limitstart',
($this->getState('limit') != 0 ?
(floor($this->getState('limitstart') /
$this->getState('limit')) *
$this->getState('limit')) : 0));
		$this->setState('filter.language',$app->getLanguageFilter());
		$this->setState('filter_order',
JFactory::getApplication()->input->get('filter_order',
'ordering'));
		$this->setState('filter_order_dir',
JFactory::getApplication()->input->get('filter_order_Dir',
'ASC'));

	}

	public function getPagination($userId) {
		if (empty($this->pagination)) {
			jimport('joomla.html.pagination');
			$this->pagination = new PhocacartPagination(
$this->getTotal($userId), $this->getState('limitstart'),
$this->getState('limit') );
		}
		return $this->pagination;
	}

	public function getTotal() {
		if (empty($this->total)) {
			$query = $this->getOrderListQuery();
			$this->total = $this->_getListCount($query);
		}
		return $this->total;
	}

	public function getOrderList() {
		if (empty($this->orders)) {
			$query			= $this->getOrderListQuery();
			$this->orders	= $this->_getList( $query
,$this->getState('limitstart'),
$this->getState('limit'));
		}
		return $this->orders;
	}

	protected function getOrderListQuery() {

		$app				= JFactory::getApplication();
		$params 			= $app->getParams();
		$u					= PhocacartUser::getUser();
		$token				= $app->input->get('o', '',
'string');
		$orderGuestAccess	= $params->get( 'order_guest_access', 0
);
		if ($orderGuestAccess == 0) {
			$token = '';
		}
		$wheres		= array();
		$wheres[] 	= ' o.published = 1';
		if ($token != '') {
			$wheres[]	= ' o.order_token =
'.$this->_db->quote($token);
		} else {
			$wheres[]	= ' o.user_id = '.(int)$u->id;
		}
		$wheres[]	= ' t.type =
'.$this->_db->quote('brutto');

		$ordering = $this->getOrderOrdering();
		$query = ' SELECT o.*,'
		.' os.title AS status_title,'
		.' t.amount AS total_amount,'
		.' s.id AS shippingid, s.title AS shippingtitle, s.tracking_link as
shippingtrackinglink, s.tracking_description as
shippingtrackingdescription, os.orders_view_display as
ordersviewdisplay'
		.' FROM #__phocacart_orders AS o'
		.' LEFT JOIN #__phocacart_order_statuses AS os ON os.id =
o.status_id'
		.' LEFT JOIN #__phocacart_order_total AS t ON o.id =
t.order_id'
		.' LEFT JOIN #__phocacart_shipping_methods AS s ON s.id =
o.shipping_id'
		.' WHERE ' . implode( ' AND ', $wheres )
		.' ORDER BY '.$ordering;

		return $query;
	}

	protected function getOrderOrdering() {
		if (empty($this->orders_ordering)) {
			$app						= JFactory::getApplication();
			$params						= $app->getParams();
			$ordering					= $params->get( 'order_ordering', 8 );
			$this->orders_ordering 		=
PhocacartOrdering::getOrderingText($ordering, 2);
		}
		return $this->orders_ordering;
	}
}
?>
models/pos.php000064400000072347151167552070007367 0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport('joomla.application.component.model');
use Joomla\Utilities\ArrayHelper;

class PhocaCartModelPos extends JModelLegacy
{
	protected $item 				= null;
	protected $item_ordering		= null;
	protected $layout_type			= null;
	protected $category 			= null;
	protected $subcategories 		= null;
	protected $category_ordering	= null;
	protected $pagination			= null;
	protected $total				= null;
	protected $ordering				= null;

	public function __construct() {
		parent::__construct();

		$app				= JFactory::getApplication();
		$config 			= JFactory::getConfig();
		$paramsC 			= $app->getParams();
		$item_pagination	= $paramsC->get( 'pos_pagination_default',
24 );
		$item_ordering		= $paramsC->get( 'pos_ordering', 1 );

		$manufacturer_alias	= $paramsC->get( 'manufacturer_alias',
'manufacturer');
		$manufacturer_alias = $manufacturer_alias != '' ?
trim(PhocacartText::filterValue($manufacturer_alias,
'alphanumeric'))  : 'manufacturer';

		$this->setState('page',
$app->input->get('page',
'main.content.products'));
		//$limit					=
PhocacartPagination::getMaximumLimit($app->getUserStateFromRequest('com_phocacart.limit',
'limit', $item_pagination, 'int'), 1);

		$toDay = date('Y-m-d');
		$this->setState('date',
$app->input->get('date', $toDay, 'string'));

		$limitId 		=
'com_phocacart.'.$this->getState('page').'.limit';
		$limitStartId 	=
'com_phocacart.'.$this->getState('page').'.limitstart';
		$orderingId 	=
'com_phocacart.'.$this->getState('page').'.itemordering';

		switch($this->getState('page')){

			case 'section':
				$limit	= 0;
				$limitStart = 0;
			break;

			default:


				//$limitStart	= $app->getUserStateFromRequest($limitStartId,
'limit',0, 'int');

				$limit		=
PhocacartPagination::getMaximumLimit($app->getUserStateFromRequest($limitId,
'limit', $item_pagination, 'int'), 1);

			break;
		}

		$this->setState('limit', $limit);

		$this->setState('limitstart',
$app->input->get('limitstart', 0, 'int'));
		$this->setState('limitstart',
($this->getState('limit') != 0 ?
(floor($this->getState('limitstart') /
$this->getState('limit')) *
$this->getState('limit')) : 0));


		$this->setState('filter.language',$app->getLanguageFilter());
		$this->setState('filter_order',
$app->input->get('filter_order', 'ordering'));
		$this->setState('filter_order_dir',
$app->input->get('filter_order_Dir', 'ASC'));
		$this->setState('itemordering',
$app->getUserStateFromRequest($orderingId, 'itemordering',
$item_ordering, 'int'));






		// =FILTER=
		$this->setState('tag',
$app->input->get('tag', '',
'string'));
        $this->setState('label',
$app->input->get('label', '',
'string'));
		$this->setState('manufacturer',
$app->input->get($manufacturer_alias, '',
'string'));
		$this->setState('price_from',
$app->input->get('price_from', '',
'float'));
		$this->setState('price_to',
$app->input->get('price_to', '',
'float'));
		// Javascript update url has problems with "c", so changed to
"category"
		//$this->setState('c', $app->input->get('c',
'', 'string')); // Category More (All Categories)
		$this->setState('c',
$app->input->get('category', '',
'string')); // Category More (All Categories)
		//$this->setState('id',
$app->input->get('id', '', 'int')); //
Category ID (Active Category) ID IS VARIABLE - different for different
pages
		$this->setState('a', $app->input->get('a',
'', 'array')); // Attributes
		$this->setState('s', $app->input->get('s',
'', 'array')); // Specifications


		// =SEARCH=
		$this->setState('search',
$app->input->get('search', '',
'string'));


	}


	public function getPagination() {
		if (empty($this->pagination)) {
			jimport('joomla.html.pagination');
			$this->pagination = new PhocacartPagination( $this->getTotal(),
$this->getState('limitstart'),
$this->getState('limit') );
		}
		return $this->pagination;
	}

	function getOrdering() {
		if(empty($this->ordering)) {
			switch($this->getState('page')){

				case 'section':
					$this->ordering =
PhocacartOrdering::renderOrderingFront($this->getState('itemordering'),
8);
				break;

				case 'main.content.customers':
					$this->ordering =
PhocacartOrdering::renderOrderingFront($this->getState('itemordering'),
7);
				break;

				case 'main.content.orders':
					$this->ordering =
PhocacartOrdering::renderOrderingFront($this->getState('itemordering'),
11);
				break;

				case 'main.content.products':
				default:
					$this->ordering =
PhocacartOrdering::renderOrderingFront($this->getState('itemordering'),
0);
				break;
			}

		}
		return $this->ordering;
	}

	public function getTotal() {
		if (empty($this->total)) {

			switch($this->getState('page')){

				case 'section':
					$query = $this->getItemListQueryUnits(1);
				break;

				case 'main.content.customers':
					$query = $this->getItemListQueryCustomers(1);
				break;

				case 'main.content.orders':
					$query = $this->getItemListQueryOrders(1);
				break;

				case 'main.content.products':
				default:
					$query = $this->getItemListQuery(1);
				break;
			}


			$this->total = $this->_getListCount($query);

		}
		return $this->total;
	}


	public function getItemList($userId = 0, $vendorId = 0, $ticketId = 0,
$unitId = 0, $sectionId = 0) {

		// Section and Unit can be reset if not exists
		$this->setState('ticketid', $ticketId);
		$this->setState('sectionid', $sectionId);
		$this->setState('unitid', $unitId);
		$this->setState('vendorid', $vendorId);
		$this->setState('userid', $userId);


		if (empty($this->item)) {

			switch($this->getState('page')){

				case 'section':
					$query = $this->getItemListQueryUnits();
				break;

				case 'main.content.customers':
					$query = $this->getItemListQueryCustomers();
				break;

				case 'main.content.orders':
					$query = $this->getItemListQueryOrders();

				break;

				case 'main.content.products':
				default:
					$query = $this->getItemListQuery();
				break;
			}

			$this->item		= $this->_getList( $query
,$this->getState('limitstart'),
$this->getState('limit'));
		}
		return $this->item;
	}

	public function getCategory($categoryId) {
		if (empty($this->category)) {
			$query					= $this->getCategoriesQuery( $categoryId, FALSE );
			$this->category 		= $this->_getList( $query, 0, 1 );
		}
		return $this->category;
	}

	public function getSubcategories($categoryId) {
		if (empty($this->subcategories)) {
			$query					= $this->getCategoriesQuery( $categoryId, TRUE );
			$this->subcategories 	= $this->_getList( $query );
		}
		return $this->subcategories;
	}

	protected function getItemListQuery($count = 0) {

		$app		= JFactory::getApplication();
		$user 		= PhocacartUser::getUser();
		$userLevels	= implode (',',
$user->getAuthorisedViewLevels());
		$userGroups = implode (',',
PhocacartGroup::getGroupsById($user->id, 1, 1));
		$params 	= $app->getParams();

		$wheres		= array();
		$lefts		= array();

		// POS FILTER
		$p 							= array();
		$p['pos_categories']		= $params->get(
'pos_categories', array(-1) );
		$p['sql_search_skip_id']	= $params->get(
'sql_search_skip_id', 1 );
		$p['search_deep']			= $params->get( 'search_deep',
0 );

		$p['sql_search_skip_id_specific_type'] = 1;// POS or Online
Shop (POS)
		if ($p['sql_search_skip_id'] != 1 &&
$p['sql_search_skip_id'] != 3){
			$p['sql_search_skip_id_specific_type'] = 0;

		}

		if (in_array(-1, $p['pos_categories'])) {
			// All categories selected


		} else if (in_array(0, $p['pos_categories'])) {
			// No category selected - dummy select to not break framework rules
			$this->setState('limitstart', 0);
			$this->setState('limit', 0);
			return 'SELECT id FROM #__phocacart_products WHERE 1 <>
1;';
		} else {
			// Only some selected
			$wheres[] = ' c.id IN ('.implode(',',
$p['pos_categories']).')';

		}




		//$p['switch_image_category_items']	= $params->get(
'switch_image_category_items', 0 );

		$wheres[] = ' a.published = 1';
		$wheres[] = ' c.published = 1';
		$wheres[] = ' c.type IN (0,2)';// default categories or pos
categories only
		if ($this->getState('filter.language')) {


			$lang 		= JFactory::getLanguage()->getTag();
			$wheres[] 	=
PhocacartUtilsSettings::getLangQuery('a.language', $lang);
			$wheres[] 	=
PhocacartUtilsSettings::getLangQuery('c.language', $lang);
		}
		$itemOrdering = $this->getItemOrdering();


		$wheres[] = " c.access IN (".$userLevels.")";
		$wheres[] = " a.access IN (".$userLevels.")";

		$wheres[] = " (ga.group_id IN (".$userGroups.") OR
ga.group_id IS NULL)";
		$wheres[] = " (gc.group_id IN (".$userGroups.") OR
gc.group_id IS NULL)";

		// =FILTER=
		// -TAG-
		if ($this->getState('tag')) {
			$s = PhocacartSearch::getSqlParts('int', 'tag',
$this->getState('tag'));
			$wheres[]	= $s['where'];
			$lefts[]	= $s['left'];
		}
        // -TAG-
        if ($this->getState('label')) {
            $s = PhocacartSearch::getSqlParts('int',
'label', $this->getState('label'));
            $wheres[]	= $s['where'];
            $lefts[]	= $s['left'];
        }
		// -MANUFACTURER-
		if ($this->getState('manufacturer')) {
			$s = PhocacartSearch::getSqlParts('int',
'manufacturer', $this->getState('manufacturer'));
			$wheres[]	= $s['where'];
			$lefts[]	= $s['left'];
		}
		// -PRICE-
		if ($this->getState('price_from')) {
			$s = PhocacartSearch::getSqlParts('int',
'price_from', $this->getState('price_from'));
			$wheres[]	= $s['where'];
			$lefts[]	= $s['left'];
		}
		if ($this->getState('price_to')) {
			$s = PhocacartSearch::getSqlParts('int', 'price_to',
$this->getState('price_to'));
			$wheres[]	= $s['where'];
			$lefts[]	= $s['left'];
		}

		// -CATEGORY-
	/*	if ($this->getState('id')) {
			$s = PhocacartSearch::getSqlParts('int', 'id',
$this->getState('id'));
			$wheres[]	= $s['where'];
			$lefts[]	= $s['left'];
		}*/

		// -CATEGORY MORE-
		if ($this->getState('c')) {
			$s = PhocacartSearch::getSqlParts('int', 'c',
$this->getState('c'));
			$wheres[]	= $s['where'];
			$lefts[]	= $s['left'];
		}

		// -ATTRIBUTES-
		if ($this->getState('a')) {
			$s = PhocacartSearch::getSqlParts('array', 'a',
$this->getState('a'));
			$wheres[]	= $s['where'];
			$lefts[]	= $s['left'];
		}

		// -SPECIFICATIONS-
		if ($this->getState('s')) {
			$s = PhocacartSearch::getSqlParts('array', 's',
$this->getState('s'));
			$wheres[]	= $s['where'];
			$lefts[]	= $s['left'];
		}

		// =SEARCH=
		if ($this->getState('search')) {
			$s = PhocacartSearch::getSqlParts('string',
'search', $this->getState('search'), $p);
			$wheres[]	= '('.$s['where'].')';
			$lefts[]	= $s['left'];

			// Hit only one time
			if ($count == 0) {
				PhocacartStatisticsHits::searchHit($this->getState('search'));
			}
		}

		// Additional Images
		$leftImages = '';
		$selImages = '';

		/*if ($p['switch_image_category_items'] == 1) {
			$leftImages = ' LEFT JOIN #__phocacart_product_images AS im ON a.id
= im.product_id';
			$selImages	= ' GROUP_CONCAT(im.image) as additional_image,';

		}*/


		// Remove empty values:
		$wheres = array_filter($wheres);
		$lefts	= array_filter($lefts);

		if ($count == 1) {
			//$lefts[] = ' LEFT JOIN #__phocacart_categories AS c ON c.id =
a.catid';
			$lefts[] = ' LEFT JOIN #__phocacart_product_categories AS pc ON
pc.product_id =  a.id';
			$lefts[] = ' LEFT JOIN #__phocacart_categories AS c ON c.id =
pc.category_id';

			if ($p['sql_search_skip_id_specific_type'] == 0){
				$lefts[] = ' LEFT JOIN #__phocacart_product_stock AS ps ON a.id =
ps.product_id';// search sku ean in advanced stock management
			}

			$lefts[] = ' LEFT JOIN #__phocacart_attributes AS at ON a.id =
at.product_id AND at.id > 0 AND at.required = 1';
			$lefts[] = ' LEFT JOIN #__phocacart_item_groups AS ga ON a.id =
ga.item_id AND ga.type = 3';// type 3 is product
			$lefts[] = ' LEFT JOIN #__phocacart_item_groups AS gc ON c.id =
gc.item_id AND gc.type = 2';// type 2 is category

			//$query = ' SELECT COUNT(DISTINCT a.id) AS count'; // 2.85ms
0.12mb
			$q = ' SELECT a.id' // 2.42ms 0.12mb
			. ' FROM #__phocacart_products AS a'
			. implode( ' ', $lefts )
			. ' WHERE ' . implode( ' AND ', $wheres )
			. ' GROUP BY a.id';

		} else {

			//$lefts[] = ' LEFT JOIN #__phocacart_categories AS c ON c.id =
a.catid';
			$lefts[] = ' LEFT JOIN #__phocacart_product_categories AS pc ON
pc.product_id = a.id';
			$lefts[] = ' LEFT JOIN #__phocacart_categories AS c ON c.id =
pc.category_id';

			if ($p['sql_search_skip_id_specific_type'] == 0){
				$lefts[] = ' LEFT JOIN #__phocacart_product_stock AS ps ON a.id =
ps.product_id';// search sku ean in advanced stock management
			}
			$lefts[] = ' LEFT JOIN #__phocacart_taxes AS t ON t.id =
a.tax_id';
			$lefts[] = ' LEFT JOIN #__phocacart_reviews AS r ON a.id =
r.product_id AND r.id > 0';

			// We need to get information if at least one of the attributes of
selected product is required

			// 1) Select more rows - one product is displayed e.g. in two rows
			//$lefts[] = ' LEFT JOIN #__phocacart_attributes AS at ON a.id =
at.product_id AND at.id > 0';

			// 2) right solution as it select only the maximal value and if maximal
value is 1 then one of product attribute is required
			// LEFT JOIN (SELECT id, product_id, MAX(required) AS required FROM
jos_phocacart_attributes GROUP BY product_id) AS at ON a.id = at.product_id
AND at.id > 0

			// 3) faster version of 2)
			$lefts[] = ' LEFT JOIN #__phocacart_attributes AS at ON a.id =
at.product_id AND at.id > 0 AND at.required = 1';



			$lefts[] = ' LEFT JOIN #__phocacart_item_groups AS ga ON a.id =
ga.item_id AND ga.type = 3';// type 3 is product
			$lefts[] = ' LEFT JOIN #__phocacart_item_groups AS gc ON c.id =
gc.item_id AND gc.type = 2';// type 2 is category
			// user is in more groups, select lowest price by best group
			$lefts[] = ' LEFT JOIN #__phocacart_product_price_groups AS ppg ON
a.id = ppg.product_id AND ppg.group_id IN (SELECT group_id FROM
#__phocacart_item_groups WHERE item_id = a.id AND group_id IN
('.$userGroups.') AND type = 3)';
			// user is in more groups, select highest points by best group
			$lefts[] = ' LEFT JOIN #__phocacart_product_point_groups AS pptg ON
a.id = pptg.product_id AND pptg.group_id IN (SELECT group_id FROM
#__phocacart_item_groups WHERE item_id = a.id AND group_id IN
('.$userGroups.') AND type = 3)';


			$columns	= 'a.id, a.title, a.image, a.alias, a.unit_amount,
a.unit_unit, a.description, a.type,'
						.' GROUP_CONCAT(DISTINCT c.id) AS catid, GROUP_CONCAT(DISTINCT
c.title) AS cattitle,'
						.' GROUP_CONCAT(DISTINCT c.alias) AS catalias, a.price,
MIN(ppg.price) as group_price,'
						.' MAX(pptg.points_received) as group_points_received,
a.points_received, a.price_original,'
						.' t.id as taxid, t.tax_rate as taxrate, t.calculation_type as
taxcalculationtype, t.title as taxtitle,'
						.' a.stock, a.stock_calculation, a.min_quantity,
a.min_multiple_quantity, a.stockstatus_a_id, a.stockstatus_n_id,'
						.' a.date, a.sales, a.featured, a.external_id, a.unit_amount,
a.unit_unit, a.external_link, a.external_text,'. $selImages
						.' AVG(r.rating) AS rating, at.required AS
attribute_required';

			$groupsFull	= 'a.id, a.title, a.image, a.alias, a.description,
a.type, a.price, a.points_received, a.price_original, a.stock,
a.stock_calculation, a.min_quantity, a.min_multiple_quantity,
a.stockstatus_a_id, a.stockstatus_n_id, a.date, a.sales, a.featured,
a.external_id, a.unit_amount, a.unit_unit, a.external_link,
a.external_text, t.id, t.tax_rate, t.calculation_type, t.title,
at.required';
			$groupsFast	= 'a.id';
			$groups		= PhocacartUtilsSettings::isFullGroupBy() ? $groupsFull :
$groupsFast;

			$q = ' SELECT '.$columns
			. ' FROM #__phocacart_products AS a'
			. implode( ' ', $lefts )
			. $leftImages
			. ' WHERE ' . implode( ' AND ', $wheres )
			. ' GROUP BY '.$groups
			. ' ORDER BY '.$itemOrdering;

		}
		//echo "<br><br>" .
nl2br(str_replace('#__', 'jos_', $q));

		return $q;
	}


	protected function getItemListQueryCustomers($count = 0) {

		$app		= JFactory::getApplication();
		$db			= JFactory::getDBO();
		$user 		= PhocacartUser::getUser();
		$userLevels	= implode (',',
$user->getAuthorisedViewLevels());
		$userGroups = implode (',',
PhocacartGroup::getGroupsById($user->id, 1, 1));
		$params 	= $app->getParams();

		$pos_customers	= $params->get('pos_customers',
'');

		$customers		= array();
		if (!empty($pos_customers)) {
			foreach($pos_customers as $k => $v) {
				$customersA = JAccess::getUsersByGroup((int)$v);
				$customers = array_merge($customers, $customersA);

			}
		}
		$customers = ArrayHelper::toInteger($customers);
		$customers = array_unique($customers);
		$customerList = implode (',', $customers);


		$wheres		= array();
		$lefts		= array();
		$phrase 	= 'any';
		//$p['switch_image_category_items']	= $params->get(
'switch_image_category_items', 0 );

		$wheres[] = ' a.block = 0';


		$itemOrdering = $this->getItemOrdering();



		// =FILTER=

		// =SEARCH=

		if ($this->getState('search')) {

			$in 	= $this->getState('search');
			$words	= explode(' ', $in);
			$wheresS = array();
			foreach ($words as $word) {

				if (!$word = trim($word)) {
					continue;
				}

				$word		= $db->quote('%'.$db->escape($word,
true).'%', false);
				$wheresS2	= array();
				$wheresS2[]	= 'a.name LIKE '.$word;
				$wheresS2[]	= 'a.username LIKE '.$word;

				$wheresS[]	= implode(' OR ', $wheresS2);
			}
			$wheres[]	= '(' . implode(($phrase == 'all' ?
') AND (' : ') OR ('), $wheresS) . ')';
			$lefts[] 	= '';



		}

		// Customers
		if ($customerList != '') {
			$wheres[] = ' a.id IN ('.$customerList.')';
		}




		// Remove empty values:
		$wheres = array_filter($wheres);
		$lefts	= array_filter($lefts);

		if ($count == 1) {

			//$query = ' SELECT COUNT(DISTINCT a.id) AS count'; // 2.85ms
0.12mb
			$q = ' SELECT a.id' // 2.42ms 0.12mb
			. ' FROM #__users AS a'
			. implode( ' ', $lefts )
			. ' WHERE ' . implode( ' AND ', $wheres );
			//. ' GROUP BY a.id';

		} else {

			//$lefts[] = ' LEFT JOIN #__phocacart_categories AS c ON c.id =
a.catid';



			$columns	= 'a.id, a.name, a.username';

			$groupsFull	= 'a.id, a.name, a.username';
			$groupsFast	= 'a.id';
			$groups		= PhocacartUtilsSettings::isFullGroupBy() ? $groupsFull :
$groupsFast;

			$q = ' SELECT '.$columns
			. ' FROM #__users AS a'
			. implode( ' ', $lefts )
			. ' WHERE ' . implode( ' AND ', $wheres )
			//. ' GROUP BY '.$groups
			. ' ORDER BY '.$itemOrdering;

		}
		//echo "<br><br>" .
nl2br(str_replace('#__', 'jos_', $q));

		return $q;
	}

	protected function getItemListQueryUnits($count = 0) {

		$app		= JFactory::getApplication();
		$db			= JFactory::getDBO();
		$user 		= PhocacartUser::getUser();
		$userLevels	= implode (',',
$user->getAuthorisedViewLevels());
		$userGroups = implode (',',
PhocacartGroup::getGroupsById($user->id, 1, 1));
		$params 	= $app->getParams();
		$wheres		= array();
		$lefts		= array();
		$phrase 	= 'any';

		$itemOrdering = $this->getItemOrdering();


		$wheres[]	= 'a.section_id =
'.(int)$this->getState('sectionid');
		$wheres[]	= 'a.published = 1';


		// Get info about cart for each unit
		//$wheres[]	= 'cm.vendor_id =
'.(int)$this->getState('vendorid');// we need to load
empty units too
		$wheres[]	= '';// ticket_id - no specific ticket - we get
ticket list
		$wheres[]	= '';// unit_id - set in ON
		$wheres[]	= 'a.section_id =
'.(int)$this->getState('sectionid');
		$lefts[] 	= ' LEFT JOIN #__phocacart_cart_multiple AS cm ON
cm.unit_id = a.id AND cm.vendor_id =
'.(int)$this->getState('vendorid');


		// Remove empty values:
		$wheres = array_filter($wheres);
		$lefts	= array_filter($lefts);



		if ($count == 1) {
			$q = ' SELECT a.id' // 2.42ms 0.12mb
			. ' FROM #__phocacart_units AS a'
			. implode( ' ', $lefts )
			. ' WHERE ' . implode( ' AND ', $wheres );
		} else {

			$columns	= 'a.id, a.title, cm.user_id, cm.vendor_id, cm.ticket_id,
cm.unit_id, cm.section_id, cm.cart';

			$q = ' SELECT '.$columns
			. ' FROM #__phocacart_units AS a'
			. implode( ' ', $lefts )
			. ' WHERE ' . implode( ' AND ', $wheres )
			. ' ORDER BY '.$itemOrdering;

		}
	//	echo "<br><br>" .
nl2br(str_replace('#__', 'jos_', $q));

		return $q;
	}


	protected function getItemListQueryOrders($count = 0) {

		$app		= JFactory::getApplication();
		$db			= JFactory::getDBO();
		$user 		= PhocacartUser::getUser();
		$userLevels	= implode (',',
$user->getAuthorisedViewLevels());
		$userGroups = implode (',',
PhocacartGroup::getGroupsById($user->id, 1, 1));
		$params 	= $app->getParams();
		$wheres		= array();
		$lefts		= array();
		$phrase 	= 'any';

		$itemOrdering = $this->getItemOrdering();


		// =SEARCH=
		if ($this->getState('date')) {

			$wheres[]	= 'DATE(a.date) =
DATE('.$db->quote($this->getState('date')).')';

		}


		$wheres[]	= 'a.vendor_id =
'.(int)$this->getState('vendorid');
		$wheres[]	= 'a.published = 1';
		$wheres[]	= 't.type = '.$db->quote('brutto');


		$lefts[]	= ' LEFT JOIN #__phocacart_order_total AS t ON a.id =
t.order_id';
		$lefts[]	= ' LEFT JOIN #__phocacart_sections AS s ON s.id =
a.section_id';
		$lefts[]	= ' LEFT JOIN #__phocacart_units AS un ON un.id =
a.unit_id';
		$lefts[]	= ' LEFT JOIN #__users AS u1 ON u1.id = a.user_id';
		$lefts[]	= ' LEFT JOIN #__users AS u2 ON u2.id = a.vendor_id';




		// Remove empty values:
		$wheres = array_filter($wheres);
		$lefts	= array_filter($lefts);



		if ($count == 1) {
			$q = ' SELECT a.id' // 2.42ms 0.12mb
			. ' FROM #__phocacart_orders AS a'
			. implode( ' ', $lefts )
			. ' WHERE ' . implode( ' AND ', $wheres );
		} else {

			$columns	= 'a.id, a.title, a.user_id, a.vendor_id, a.ticket_id,
a.unit_id, a.section_id, a.currency_id,'
						.' s.title AS section_title, un.title AS unit_title, u1.name AS
user_title, u2.name AS vendor_title, a.date, t.amount AS total_amount,
t.amount_currency AS total_amount_currency';
			$q = ' SELECT '.$columns
			. ' FROM #__phocacart_orders AS a'
			. implode( ' ', $lefts )
			. ' WHERE ' . implode( ' AND ', $wheres )
			. ' ORDER BY '.$itemOrdering;

		}
		//echo "<br><br>" .
nl2br(str_replace('#__', 'jos_', $q));

		return $q;
	}

	protected function getCategoriesQuery( $categoryId, $subcategories = FALSE
) {

		$wheres		= array();
		$app		= JFactory::getApplication();
		$params 	= $app->getParams();
		$user 		= PhocacartUser::getUser();
		$userLevels	= implode (',',
$user->getAuthorisedViewLevels());
		$userGroups = implode (',',
PhocacartGroup::getGroupsById($user->id, 1, 1));

		// Get the current category or get parent categories of the current
category
		if ($subcategories) {
			$wheres[]			= " c.parent_id = ".(int)$categoryId;
			$categoryOrdering 	= $this->getCategoryOrdering();
		} else {
			$wheres[]	= " c.id= ".(int)$categoryId;
		}

		$wheres[] = " c.published = 1";
		$wheres[] = " c.type IN (0,2)";
		$wheres[] = " c.access IN (".$userLevels.")";
		$wheres[] = " (gc.group_id IN (".$userGroups.") OR
gc.group_id IS NULL)";

		if ($this->getState('filter.language')) {
			$lang 		= JFactory::getLanguage()->getTag();

			$wheres[] 	=
PhocacartUtilsSettings::getLangQuery('c.language', $lang);
		}

		if ($subcategories) {

			$columns	= 'c.id, c.title, c.alias, COUNT(c.id) AS numdoc';
			$groupsFull	= 'c.id, c.title, c.alias';
			$groupsFast	= 'c.id';
			$groups		= PhocacartUtilsSettings::isFullGroupBy() ? $groupsFull :
$groupsFast;

			$query = "SELECT ".$columns
				. " FROM #__phocacart_categories AS c"
				. " LEFT JOIN #__phocacart_products AS a ON a.catid = c.id AND
a.published = 1"
				. ' LEFT JOIN #__phocacart_item_groups AS gc ON c.id = gc.item_id
AND gc.type = 2'// type 2 is category
				. " WHERE " . implode( " AND ", $wheres )
				. " GROUP BY ".$groups
				. " ORDER BY ".$categoryOrdering;
		} else {
			$query = " SELECT c.id, c.title, c.alias, c.description,
c.metatitle, c.metakey, c.metadesc, c.metadata, cc.title as parenttitle,
c.parent_id as parentid, cc.alias as parentalias"
				. " FROM #__phocacart_categories AS c"
				. " LEFT JOIN #__phocacart_categories AS cc ON cc.id =
c.parent_id"
				. ' LEFT JOIN #__phocacart_item_groups AS gc ON c.id = gc.item_id
AND gc.type = 2'// type 2 is category
				. " WHERE " . implode( " AND ", $wheres )
				. " ORDER BY c.ordering";
		}
		return $query;
	}


	protected function getItemOrdering() {
		if (empty($this->item_ordering)) {
			$app						= JFactory::getApplication();
			$params						= $app->getParams();
			//$ordering					= $params->get( 'item_ordering', 1 );
			$ordering					= $this->getState('itemordering');
			switch($this->getState('page')){

				case 'section':
					$this->item_ordering 		=
PhocacartOrdering::getOrderingText($ordering, 8);
				break;

				case 'main.content.customers':
					$this->item_ordering 		=
PhocacartOrdering::getOrderingText($ordering, 7);
				break;

				case 'main.content.orders':
					$this->item_ordering 		=
PhocacartOrdering::getOrderingText($ordering, 11);
				break;

				case 'main.content.products':
				default:
					$this->item_ordering 		=
PhocacartOrdering::getOrderingText($ordering);

				break;
			}

		}
		return $this->item_ordering;
	}

	protected function getCategoryOrdering() {
		if (empty($this->category_ordering)) {
			$app						= JFactory::getApplication();
			$params						= $app->getParams();
			$ordering					= $params->get( 'category_ordering', 1 );
			$this->category_ordering 	=
PhocacartOrdering::getOrderingText($ordering, 1);
		}
		return $this->category_ordering;
	}















	// ACTIONS
	public function saveShipping($shippingId) {

		$app	= JFactory::getApplication();
		$user	= $vendor = $ticket = $unit = $section = array();
		$dUser 	= PhocacartUser::defineUser($user, $vendor, $ticket, $unit,
$section);


		$data['shipping']	= (int)$shippingId;
		$data['user_id']	= (int)$user->id;
		$shipping 			= new PhocacartShipping();
		$shipping->setType(array(0,2));

		if ((int)$shippingId == 0) {
			// Deselect Shipping
		} else {
			$isValidShipping =
$shipping->checkAndGetShippingMethod($shippingId);
			if (!$isValidShipping) {
				$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_SHIPPING_METHOD_NOT_AVAILABLE'),
'error');
				return false;
			}
		}
		$row = $this->getTable('PhocacartCart', 'Table');
		if (!$row->load(array('user_id' => (int)$user->id,
'vendor_id' => (int)$vendor->id, 'ticket_id'
=> (int)$ticket->id, 'unit_id' => (int)$unit->id,
'section_id' => (int)$section->id))) {}

		if (empty($row->cart)) {
			$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_CART_IS_EMPTY_SHIPPING_METHOD_CANNOT_BE_SET'),
'error');
			return false;
		}

		if (!$row->bind($data)) {
			$this->setError($this->_db->getErrorMsg());
			return false;
		}

		$row->date = gmdate('Y-m-d H:i:s');

		if (!$row->check()) {
			$this->setError($this->_db->getErrorMsg());
			return false;
		}

		if (!$row->store()) {
			$this->setError($this->_db->getErrorMsg());
			return false;
		}

		if ((int)$shippingId == 0) {
			$app->enqueueMessage(JText::_('COM_PHOCACART_SUCCESS_SHIPPING_METHOD_DESELECTED'),
'success');
		} else {
			$app->enqueueMessage(JText::_('COM_PHOCACART_SUCCESS_SHIPPING_METHOD_SELECTED'),
'success');
		}


		return true;
	}

	public function savePaymentAndCouponAndReward($paymentId, $couponId,
$reward) {

		$app	= JFactory::getApplication();
		$user	= $vendor = $ticket = $unit = $section = array();
		$dUser 	= PhocacartUser::defineUser($user, $vendor, $ticket, $unit,
$section);


		$data['payment'] 	= (int)$paymentId;
		$data['coupon'] 	= (int)$couponId;
		$data['user_id']	= (int)$user->id;
		$data['reward'] 	= (int)$reward;
		$payment 			= new PhocacartPayment();
		$payment->setType(array(0,2));

		if ((int)$paymentId == 0) {
			// Deselect Payment
		} else {
			$isValidPayment	= $payment->checkAndGetPaymentMethod($paymentId);
			if (!$isValidPayment) {
				$app->enqueueMessage( $paymentId .
JText::_('COM_PHOCACART_ERROR_PAYMENT_METHOD_NOT_AVAILABLE'),
'error');
				return false;
			}
		}


		$row = $this->getTable('PhocacartCart', 'Table');
		if (!$row->load(array('user_id' => (int)$user->id,
'vendor_id' => (int)$vendor->id, 'ticket_id'
=> (int)$ticket->id, 'unit_id' => (int)$unit->id,
'section_id' => (int)$section->id))) {}


		if (empty($row->cart)) {
			$app->enqueueMessage(JText::_('COM_PHOCACART_ERROR_CART_IS_EMPTY_PAYMENT_METHOD_CANNOT_BE_SET'),
'error');
			return false;
		}

		if (!$row->bind($data)) {
			$this->setError($this->_db->getErrorMsg());
			return false;
		}

		$row->date = gmdate('Y-m-d H:i:s');

		if (!$row->check()) {
			$this->setError($this->_db->getErrorMsg());
			return false;
		}

		if (!$row->store()) {
			$this->setError($this->_db->getErrorMsg());
			return false;
		}

		if ((int)$paymentId == 0) {
			$app->enqueueMessage(JText::_('COM_PHOCACART_SUCCESS_PAYMENT_METHOD_DESELECTED'),
'success');
		} else {
			$app->enqueueMessage(JText::_('COM_PHOCACART_SUCCESS_PAYMENT_METHOD_SELECTED'),
'success');
		}


		return true;
	}
}
?>
models/question.php000064400000012150151167552070010417 0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();


use Joomla\CMS\Uri\Uri;

jimport('joomla.application.component.model');

class PhocaCartModelQuestion extends JModelForm
{
	function __construct() {
		$app	= JFactory::getApplication();
		parent::__construct();
		$this->setState('filter.language',$app->getLanguageFilter());
	}

	public function getForm($data = array(), $loadData = true)
	{
		// Get the form.
		$form = $this->loadForm('com_phocacart.question',
'question', array('control' => 'jform',
'load_data' => true));
		if (empty($form)) {
			return false;
		}

		$app	= JFactory::getApplication();
		$params = $app->getParams();

		// Set required or not && disable if not available
		if(!$params->get('display_name_form', 2)){
			$form->removeField('name');
		} else if ($params->get('display_name_form', 2) == 2){
			$form->setFieldAttribute('name', 'required',
'true');
		}

		if(!$params->get('display_email_form', 2)){
			$form->removeField('email');
		} else if ($params->get('display_email_form', 2) == 2){
			$form->setFieldAttribute('email', 'required',
'true');
		}

		if(!$params->get('display_phone_form', 2)){
			$form->removeField('phone');
		} else if ($params->get('display_phone_form', 2) == 2){
			$form->setFieldAttribute('phone', 'required',
'true');
		}

		if(!$params->get('display_message_form', 2)){
			$form->removeField('message');
		} else if ($params->get('display_message_form', 2) == 2){
			$form->setFieldAttribute('message', 'required',
'true');
		}

		if (!$params->get('enable_hidden_field_question', 0)){
			$form->removeField('hidden_field');
		} else {

			$form->setFieldAttribute('hidden_field', 'id',
$params->get('hidden_field_id'));
			$form->setFieldAttribute('hidden_field', 'class',
$params->get('hidden_field_class'));
			$form->setFieldAttribute('hidden_field', 'name',
$params->get('hidden_field_name'));

		}

		if (!$params->get('enable_captcha_question', 2)) {
			$form->removeField('phq_captcha');
		} else {
			$form->setFieldAttribute('phq_captcha', 'type',
'phocacaptcha');
			$form->setFieldAttribute('phq_captcha',
'captcha_id', $params->get('captcha_id'));
			$form->setFieldAttribute('phq_captcha',
'validate', 'phocacartcaptcha');
		}

		return $form;
	}

	protected function loadFormData() {
		$data = (array)
JFactory::getApplication()->getUserState('com_phocacart.question.data',
array());
		return $data;
	}

	function store(&$data) {

		JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));

		$uri 	= \Joomla\CMS\Uri\Uri::getInstance();
		$app    = JFactory::getApplication();
		$params = PhocacartUtils::getComponentParameters() ;

		// Maximum of character, they will be saved in database
		$data['message']		= substr($data['message'], 0,
$params->get('max_char_question', 3000));
		$data['date'] 			= gmdate('Y-m-d H:i:s');   // Create
the timestamp for the date

		$data['params']			= '';
		$data['category_id']	=
PhocacartUtils::getIntFromString($data['category_id']);
		$data['product_id']		=
PhocacartUtils::getIntFromString($data['product_id']);
		$data['ordering']		= $this->increaseOrdering();
		$row = $this->getTable('PhocaCartQuestion');


		// Bind the form fields to the table
		if (!$row->bind($data)) {
			$this->setError($this->_db->getErrorMsg());
			return false;
		}

		// Make sure the table is valid
		if (!$row->check()) {
			$this->setError($this->_db->getErrorMsg());
			return false;
		}

		// Store the Phoca guestbook table to the database
		if (!$row->store()) {
			$this->setError($this->_db->getErrorMsg());
			return false;
		}

		// Everything OK - send email
		if ($params->get('send_email_question', 0) > 0 ||
$params->get('send_email_question_others', '') !=
'') {

			$data['product'] 	= array();
			$data['category']	= array();
			$productId			= 0;
			if(isset($data['product_id']) &&
(int)$data['product_id'] > 0) {
				if(isset($data['category_id']) &&
(int)$data['category_id'] > 0) {
					$data['product'] =
PhocacartProduct::getProduct($data['product_id'],
$data['category_id']);
					$data['category'] =
PhocacartCategory::getCategoryById($data['category_id']);
				} else {
					$data['product'] =
PhocacartProduct::getProduct($data['product_id']);
				}
				$productId = $data['product'];
			}


			$send = PhocacartEmail::sendQuestionMail($data,
Uri::getInstance()->toString(), $params);

			if (!$send) {
				$user 	= PhocacartUser::getUser();
				PhocacartLog::add(2, 'Ask a Question - ERROR - Problems with
sending email', $productId, 'IP: '.
$data['ip'].', User ID: '.$user->id);
			}
		}

		$data['id'] = $row->id;

		return true;
	}

	public function increaseOrdering() {
		$this->_db->setQuery('SELECT MAX(ordering) FROM
#__phocacart_questions');
		$max = $this->_db->loadResult();
		$ordering = $max + 1;
		return $ordering;
	}
}
?>
models/rules/Alphanumeric.php000064400000003040151167552070012310
0ustar00<?php
/**
 * Joomla! Content Management System
 *
 * @copyright  Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license    GNU General Public License version 2 or later; see
LICENSE.txt
 */


defined('JPATH_PLATFORM') or die;

use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormRule;
use Joomla\Registry\Registry;
use Joomla\String\StringHelper;


class JFormRuleAlphanumeric extends FormRule
{

	protected $regex = '/[^a-zA-Z0-9]+/i';

	public function test(\SimpleXMLElement $element, $value, $group = null,
Registry $input = null, Form $form = null){

		// If the field is empty and not required, the field is valid.
		$required = ((string) $element['required'] == 'true'
|| (string) $element['required'] == 'required');

		if (!$required && empty($value)){
			return true;
		}

		// Uncomment for Possible string length rule
		/*
		if (StringHelper::strlen($value) > 10) {
			return new \UnexpectedValueException(\JText::_('The maximum
allowable string length is 10 characters'));
		}
		*/
		if (empty($this->regex)) {
			throw new \UnexpectedValueException(sprintf('%s has invalid
regex.', get_class($this)));
		}

		if (JCOMPAT_UNICODE_PROPERTIES) {
			$this->modifiers = (strpos($this->modifiers, 'u') !==
false) ? $this->modifiers : $this->modifiers . 'u';
		}

        if (!preg_match( $this->regex . $this->modifiers , $value)) {
            return true;
        }

        return new
\UnexpectedValueException(\JText::_('COM_PHOCACART_ONLY_ALPHANUMERIC_CHARACTERS_ARE_ALLOWED'));

	}
}
models/rules/index.html000064400000000072151167552070011166
0ustar00<html><body style="background-color:
#000;"></body></html>models/rules/phocacartcaptcha.php000064400000002115151167552070013172
0ustar00<?php
/**
 * @package    phocaguestbook
 * @subpackage Models
 * @copyright  Copyright (C) 2012 Jan Pavelka www.phoca.cz
 * @license    http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */

defined('_JEXEC') or die;

class JFormRulePhocacartCaptcha extends JFormRule
{
	public function test(SimpleXMLElement $element, $value, $group = null,
JRegistry $input = null, JForm $form = null)
	{
		$app = JFactory::getApplication();
		//E_ERROR, E_WARNING, E_NOTICE, E_USER_ERROR, E_USER_WARNING,
E_USER_NOTICE.
		$info = array();
		$info['field'] = 'question_captcha';
		$params = PhocacartUtils::getComponentParameters();
		$session = JFactory::getSession();
		$namespace =
'phccrt'.$params->get('session_suffix');

		// Possible parameters in Options for different captchas
		$captchaId = 1;

		switch($captchaId) {
			case 1:
			default:
				if (!PhocacartCaptchaRecaptcha::isValid()) {

					// What happens when the CAPTCHA was entered incorrectly
					$app->enqueueMessage(JText::_('COM_PHOCACART_WRONG_CAPTCHA'
), 'warning');
					return false;
				}

				return true;
			break;
		}
		return false;
	}
}
models/rules/phocacartemail.php000064400000002217151167552070012661
0ustar00<?php
/**
 * @package    phocaguestbook
 * @subpackage Models
 * @copyright  Copyright (C) 2012 Jan Pavelka www.phoca.cz
 * @license    http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */

defined('_JEXEC') or die;

JFormHelper::loadRuleClass('email');

class JFormRulePhocaCartEmail extends JFormRuleEmail
{

	public function test(SimpleXMLElement $element, $value, $group = null,
JRegistry $input = null, JForm $form = null)
	{

		$app = JFactory::getApplication();
		//E_ERROR, E_WARNING, E_NOTICE, E_USER_ERROR, E_USER_WARNING,
E_USER_NOTICE.
		$info = array();
		$info['field'] = 'phocacart_email';
		$params = PhocacartUtils::getComponentParameters();

		//EMAIL FORMAT
		if(!parent::test($element, $value, $group, $input, $form)){

			$app->enqueueMessage(JText::_('COM_PHOCACART_BAD_EMAIL' ),
'warning');
			return false;
		}

		//BANNED EMAIL
		$banned = $params->get('banned_email');
		foreach(explode(';', $banned) as $item){
			if (trim($item) != '') {
				if (\Joomla\String\StringHelper::stristr($item, $value) !== false){

					$app->enqueueMessage(JText::_('COM_PHOCACART_BAD_EMAIL'
), 'warning');
					return false;
				}
			}

			return true;
		}
	}
}
models/rules/phocacartfile.php000064400000002215151167552070012507
0ustar00<?php
/**
 * @package    phocaguestbook
 * @subpackage Models
 * @copyright  Copyright (C) 2012 Jan Pavelka www.phoca.cz
 * @license    http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */

defined('_JEXEC') or die;

//JFormHelper::loadRuleClass('email');

class JFormRulePhocaCartFile extends JFormRule
{

	public function test(SimpleXMLElement $element, $value, $group = null,
JRegistry $input = null, JForm $form = null)
	{



		$app = JFactory::getApplication();
		//E_ERROR, E_WARNING, E_NOTICE, E_USER_ERROR, E_USER_WARNING,
E_USER_NOTICE.
		$info = array();
		$info['field'] = 'phocacart_email';
		$params = PhocacartUtils::getComponentParameters();

		//EMAIL FORMAT
		if(!parent::test($element, $value, $group, $input, $form)){

			$app->enqueueMessage(JText::_('COM_PHOCACART_BAD_EMAIL' ),
'warning');
			return false;
		}

		//BANNED EMAIL
		$banned = $params->get('banned_email');
		foreach(explode(';', $banned) as $item){
			if (trim($item) != '') {
				if (\Joomla\String\StringHelper::stristr($item, $value) !== false){

					$app->enqueueMessage(JText::_('COM_PHOCACART_BAD_EMAIL'
), 'warning');
					return false;
				}
			}

			return true;
		}
	}
}
models/rules/phocacarthidden.php000064400000001361151167552070013024
0ustar00<?php
/**
 * @package    phocacart
 * @subpackage Models
 * @copyright  Copyright (C) 2012 Jan Pavelka www.phoca.cz
 * @license    http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */

defined('_JEXEC') or die;

class JFormRulePhocaCartHidden extends JFormRule
{

	public function test(SimpleXMLElement $element, $value, $group = null,
JRegistry $input = null, JForm $form = null)
	{
		
		$app = JFactory::getApplication();
		//E_ERROR, E_WARNING, E_NOTICE, E_USER_ERROR, E_USER_WARNING,
E_USER_NOTICE.
		$info = array();
		$info['field'] = 'phocacart_hidden';
		//Get POST Data - - - - - - - - - 
		if ($value != '') {
			
			
			$app->enqueueMessage(JText::_('COM_PHOCACART_POSSIBLE_SPAM_DETECTED'
), 'error');
			return false;
		}
		
		return true;
	}
}
models/rules/phocacarttitle.php000064400000001500151167552070012705
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

class JFormRulePhocaCartTitle extends JFormRule
{

	public function test(&$element, $value, $group = null, &$input =
null, &$form = null)
	{
		
		$app = JFactory::getApplication();
		//E_ERROR, E_WARNING, E_NOTICE, E_USER_ERROR, E_USER_WARNING,
E_USER_NOTICE.
		//$info = array();
		//$info['field'] = 'guestbook_title';
		
		//if (preg_match("~[<|>]~",$value)) {
		
		//}
	
		$app->enqueueMessage(JText::_('COM_PHOCACART_BAD_SUBJECT' ),
'warning');
		return false;
		

		return true;
	}
}
models/submit.php000064400000033177151167552070010067 0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();


use Joomla\CMS\Uri\Uri;

jimport('joomla.application.component.model');

class PhocaCartModelSubmit extends JModelForm
{
	function __construct() {
		$app	= JFactory::getApplication();
		parent::__construct();
		$this->setState('filter.language',$app->getLanguageFilter());
	}

	public function getForm($data = array(), $loadData = true)
	{
		// Get the form.
		$form = $this->loadForm('com_phocacart.submit',
'submit', array('control' => 'jform',
'load_data' => true));
		if (empty($form)) {
			return false;
		}

		$app	= JFactory::getApplication();
		$params = $app->getParams();

		/*
		// Set required or not && disable if not available
		if(!$params->get('display_name_form', 2)){
			$form->removeField('name');
		} else if ($params->get('display_name_form', 2) == 2){
			$form->setFieldAttribute('name', 'required',
'true');
		}

		if(!$params->get('display_email_form', 2)){
			$form->removeField('email');
		} else if ($params->get('display_email_form', 2) == 2){
			$form->setFieldAttribute('email', 'required',
'true');
		}

		if(!$params->get('display_phone_form', 2)){
			$form->removeField('phone');
		} else if ($params->get('display_phone_form', 2) == 2){
			$form->setFieldAttribute('phone', 'required',
'true');
		}

		if(!$params->get('display_message_form', 2)){
			$form->removeField('message');
		} else if ($params->get('display_message_form', 2) == 2){
			$form->setFieldAttribute('message', 'required',
'true');
		}*/

		if (!$params->get('enable_hidden_field_submit_item', 0)){
			$form->removeField('hidden_field');
		} else {

			$form->setFieldAttribute('hidden_field', 'id',
$params->get('hidden_field_id'));
			$form->setFieldAttribute('hidden_field', 'class',
$params->get('hidden_field_class'));
			$form->setFieldAttribute('hidden_field', 'name',
$params->get('hidden_field_name'));

	}

		if (!$params->get('enable_captcha_submit_item', 2)) {
			$form->removeField('phq_captcha');
		} else {
			$form->setFieldAttribute('phq_captcha', 'type',
'phocacaptcha');
			$form->setFieldAttribute('phq_captcha',
'captcha_id', $params->get('captcha_id'));
			$form->setFieldAttribute('phq_captcha',
'validate', 'phocacartcaptcha');
		}

		return $form;
	}

	protected function loadFormData() {
		$data = (array)
JFactory::getApplication()->getUserState('com_phocacart.submit.data',
array());
		return $data;
	}

	function store(&$data, $file)
	{


		JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));

		$uri = \Joomla\CMS\Uri\Uri::getInstance();
		$app = JFactory::getApplication();
		$user = JFactory::getUser();
		$path       = PhocacartPath::getPath('submititem');

		$params = PhocacartUtils::getComponentParameters();
		$submit_item_max_char_textarea 	=
$params->get('submit_item_max_char_textarea', 5000);
		$submit_item_form_fields 		=
$params->get('submit_item_form_fields', '');
		$items = array_map('trim', explode(',',
$submit_item_form_fields));
		$items = array_unique($items);

		$submit_item_form_fields_contact =
$params->get('submit_item_form_fields_contact',
'');
		$itemsC = array_map('trim', explode(',',
$submit_item_form_fields_contact));
		$itemsC = array_unique($itemsC);

		$submit_item_form_fields_parameters	= $params->get(
'submit_item_form_fields_parameters', '' );
		$itemsP = array_map('trim', explode(',',
$submit_item_form_fields_parameters));
		$itemsP = array_unique($itemsP);




		// Maximum of character, they will be saved in database
		$data['items_item']['description'] =
isset($data['items_item']['description']) ?
substr($data['items_item']['description'], 0,
$submit_item_max_char_textarea) : '';
		$data['items_item']['description_long'] =
isset($data['items_item']['description_long']) ?
substr($data['items_item']['description_long'], 0,
$submit_item_max_char_textarea) : '';
		$data['items_item']['features'] =
isset($data['items_item']['features']) ?
substr($data['items_item']['features'], 0,
$submit_item_max_char_textarea) : '';
		$data['items_item']['type_feed'] =
isset($data['items_item']['type_feed']) ?
substr($data['items_item']['type_feed'], 0,
$submit_item_max_char_textarea) : '';
		$data['items_item']['type_category_feed'] =
isset($data['items_item']['type_category_feed']) ?
substr($data['items_item']['type_category_feed'], 0,
$submit_item_max_char_textarea) : '';
		$data['items_item']['metakey'] =
isset($data['items_item']['metakey']) ?
substr($data['items_item']['metakey'], 0,
$submit_item_max_char_textarea) : '';
		$data['items_item']['metadesc'] =
isset($data['items_item']['metadesc']) ?
substr($data['items_item']['metadesc'], 0,
$submit_item_max_char_textarea) : '';
		$data['items_item']['message'] =
isset($data['items_item']['message']) ?
substr($data['items_item']['message'], 0,
$submit_item_max_char_textarea) : '';


		$tempData = array();
		$tempData['ip'] = $data['ip'];
		$tempData['privacy'] = $data['privacy'];


		$item = array();
		$contact = array();
		$parameter = array();

		if (!empty($items)) {
			foreach ($items as $k => $v) {
				$v = trim(str_replace('*', '', $v));
				if (isset($data['items_item'][$v]) &&
$data['items_item'][$v] != '') {
					$item[$v] = $data['items_item'][$v];
				}
			}
		}



		if (!empty($itemsP)) {
			$parameters = PhocacartParameter::getAllParameters('alias');
			foreach ($itemsP as $k => $v) {
				$v = trim(str_replace('*', '', $v));
				$vId   	= 0;
                if (isset($parameters[$v]->id) &&
$parameters[$v]->id > 0) {
                    $vId = (int)$parameters[$v]->id;
                }
                if (!empty($data['items_parameter'][$vId])) {
                	$parameter[$vId] =
$data['items_parameter'][$vId];
                }
			}
		}


		if (!empty($itemsC)) {
			foreach ($itemsC as $k => $v) {
				$v = trim(str_replace('*', '', $v));
				if (isset($data['items_contact'][$v]) &&
$data['items_contact'][$v] != '') {
					$contact[$v] = $data['items_contact'][$v];
				}
			}
		}




		$data = array();
		$data = $tempData;

		$data['items_item'] = $item;
		$data['items_contact'] = $contact;
		$data['items_parameter'] = $parameter;

		$data['date_submit'] = gmdate('Y-m-d H:i:s');   //
Create the timestamp for the date
		$data['user_id'] 	= (int)$user->id;
		$data['title'] 		= isset($item['title']) &&
$item['title'] != '' ? $item['title'] :
$data['date_submit'];
		$data['alias']		=
PhocacartUtils::getAliasName($data['title']);
		$data['ordering']	= $this->increaseOrdering();
		$data['published']	= 1;

		$data['upload_token'] 			= PhocacartUtils::getToken();
		$data['upload_folder']			=
PhocacartUtils::getToken('folder');


		$folderPath         = JPath::clean($path['orig_abs_ds'] .
$data['upload_folder']);

		// Images upload
		$fileData = array();
		if (!empty($file['items_item']['image'])) {

			if (!isset($file['items_item']['image'][0]) ||
(isset($file['items_item']['image'][0]) &&
$file['items_item']['image'][0]['error'] ==
4)){

				// No file uploaded - is OK when not required
				// If requried - this will be checkedn in form field and in controller

			} else {
				$filesUploaded =
PhocacartFileUpload::submitItemUpload($file['items_item']['image'],
$data, $fileData, 'image');

				if (!$filesUploaded) {

					// message set in app
					if (JFolder::exists($folderPath)) {
						JFolder::delete($folderPath);
					}
					return false;

				} else {
					$data['items_item']['image'] = $fileData;
				}
			}


		}


		$dataItem 		= $data['items_item'];
		$dataContact 	= $data['items_contact'];
		$dataParameter	= $data['items_parameter'];


		$data['items_item'] = json_encode($dataItem);
		$data['items_contact'] = json_encode($dataContact);
		$data['items_parameter'] = json_encode($dataParameter);


		$row = $this->getTable('PhocaCartSubmitItem');


		if (!$row->bind($data)) {
			$this->setError($this->_db->getErrorMsg());
			if (JFolder::exists($folderPath)) { JFolder::delete($folderPath); }
			return false;
		}


		if (!$row->check()) {
			$this->setError($this->_db->getErrorMsg());
			if (JFolder::exists($folderPath)) { JFolder::delete($folderPath); }
			return false;
		}

		if (!$row->store()) {
			$this->setError($this->_db->getErrorMsg());
			if (JFolder::exists($folderPath)) { JFolder::delete($folderPath); }
			return false;
		}

		// Everything OK - send email
		if ($params->get('send_email_submit_item', 0) > 0 ||
$params->get('send_email_submit_item_others', '') !=
'') {

			$send = PhocacartEmail::sendSubmitItemMail($dataItem, $dataContact,
$dataParameter, Uri::getInstance()->toString(), $params);

			if (!$send) {
				$user 	= PhocacartUser::getUser();
				PhocacartLog::add(2, 'Submit Item - ERROR - Problems with sending
email', 0, 'IP: '. $data['ip'].', User ID:
'.$user->id);
			}
		}

		$data['id'] = $row->id;

		return true;
	}

	protected function preprocessForm(JForm $form, $data, $group =
'content'){


		// Load Parameter Values for Parameters
		$parameters = PhocacartParameter::getAllParameters();

		// Items and Items (Contact) are defined in view
		// Items (Parameters) will be defined here

		$pC 		= PhocacartUtils::getComponentParameters();

		// Items and Items (Contact) are defined in this view
		// Items (Parameters) will be defined model (when creating the form)

        // ITEMS
        // Preprocess form before saving - before validate the form - we
need to set required fields so validate can check them
        $submit_item_form_fields 		=
$pC->get('submit_item_form_fields', '');
        $submit_item_form_fields_contact =
$pC->get('submit_item_form_fields_contact', '');

        $items = array();
        if($submit_item_form_fields != '') {
            $items = array_map('trim', explode(',',
$submit_item_form_fields));
            $items = array_unique($items);
        }

        $itemsC = array();
        if($submit_item_form_fields_contact != '') {
            $itemsC = array_map('trim', explode(',',
$submit_item_form_fields_contact));
            $itemsC = array_unique($itemsC);
        }


        $fieldSets = $form->getFieldsets();

        foreach ($fieldSets as $name => $fieldSet) {
            if (isset($fieldSet->name) && ($fieldSet->name ==
'items_item' || $fieldSet->name == 'items_contact'))
{
                foreach ($form->getFieldset($name) as $field) {

                    $itemsCurrent = array();
                    if ($fieldSet->name == 'items_item') {
                        $itemsCurrent = $items;
                    }
                    if ($fieldSet->name == 'items_contact') {
                        $itemsCurrent = $itemsC;
                    }

                    $isIncluded = 0;
                    if (in_array($field->fieldname . '*',
$itemsCurrent)) {
                        $isIncluded = 2;// included and required
                    }

                    if ($isIncluded == 2) {

                        //$field->required = true;
                        //$field->addAttribute($field->fieldname,
'true');
                        //$field->__set('required', true);
                        // BE AWARE - GROUP NEEDS TO BE DEFINED
                        $form->setFieldAttribute($field->fieldname,
'required', 'true', $fieldSet->name);

                    }
                }
            }
        }

		$submit_item_form_fields_parameters	= $pC->get(
'submit_item_form_fields_parameters', '' );


		if($submit_item_form_fields_parameters != '') {
			$itemsP = array_map('trim', explode(',',
$submit_item_form_fields_parameters));
			$itemsP = array_unique($itemsP);



			if (count($parameters) > 0 && !empty($itemsP)) {
				$addform = new SimpleXMLElement('<form />');
				$fields = $addform->addChild('fields');
				$fields->addAttribute('name',
'items_parameter');
				$fieldset = $fields->addChild('fieldset');
				$fieldset->addAttribute('name',
'items_parameter');

				foreach ($parameters as $k => $v) {

					$isIncluded = 0;
					if (in_array($v->alias, $itemsP)) {
						$isIncluded = 1;// included
					}
					if (in_array($v->alias . '*', $itemsP)) {
						$isIncluded = 2;// included and required
					}

					if ($isIncluded > 0) {

						$field = $fieldset->addChild('field');
						$field->addAttribute('name', $v->id);
						$field->addAttribute('parameterid', $v->id);
				        $field->addAttribute('parameteralias',
$v->alias);
						$field->addAttribute('type',
'PhocaCartParameterValues');
						//$field->addAttribute('language',
$language->lang_code);
						$field->addAttribute('label', $v->title);
						$field->addAttribute('class',
'chosen-select');
						$field->addAttribute('multiple', 'true');
						$field->addAttribute('translate_label',
'false');
						$field->addAttribute('select', 'true');
						$field->addAttribute('new', 'true');
						$field->addAttribute('edit', 'true');
						$field->addAttribute('clear', 'true');
						$field->addAttribute('propagate', 'true');
						$field->addAttribute('filter', 'int_array');
						if ($isIncluded == 2) {
							$field->addAttribute('required', 'true');
						}
					}
				}


				$form->load($addform, false);
			}
		}

		parent::preprocessForm($form, $data, $group);
	}

	public function increaseOrdering() {
		$this->_db->setQuery('SELECT MAX(ordering) FROM
#__phocacart_submit_items');
		$max = $this->_db->loadResult();
		$ordering = $max + 1;
		return $ordering;
	}
}
?>
models/wishlist.php000064400000001016151167552070010415 0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport('joomla.application.component.model');

class PhocaCartModelWishList extends JModelForm
{

	public function getForm($data = array(), $loadData = true) {
		return false;
	}
}
?>
phocacart.php000064400000001357151167552070007240 0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined( '_JEXEC' ) or die( 'Restricted access' );
require_once( JPATH_COMPONENT.'/controller.php' );
require_once( JPATH_COMPONENT.'/helpers/route.php' );
JLoader::registerPrefix('Phocacart', JPATH_ADMINISTRATOR .
'/components/com_phocacart/libraries/phocacart');
$controller = JControllerLegacy::getInstance('PhocaCart');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
?>
router.php000064400000047650151167552070006622 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_phocacart
 *
 * @copyright   Copyright (C) 2005 - 2016 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;
/*
if (! class_exists('PhocacartLoader')) {
    require_once(
JPATH_ADMINISTRATOR.'/components/com_phocacart/libraries/loader.php');
}
phocacart import('phocacart.category.category');
*/
JLoader::registerPrefix('Phocacart', JPATH_ADMINISTRATOR .
'/components/com_phocacart/libraries/phocacart');

class PhocacartRouter extends JComponentRouterBase
{
	public function build(&$query) {


		$viewsNoId 		= array('categories', 'checkout',
'comparison', 'download', 'terms',
'account', 'orders', 'payment',
'info', 'items', 'wishlist', 'pos',
'submit');
		$viewsId		= array('category', 'item',
'items', 'feed');
		$viewsNotOwnId	= array('question');
		$viewsAll	= array_merge($viewsNoId, $viewsId, $viewsNotOwnId);

		$segments = array();

		// Get a menu item based on Itemid or currently active
		$params = PhocacartUtils::getComponentParameters();
		//$advanced = $params->get('sef_advanced_link', 0);
		$advanced = $params->get('remove_sef_ids', 0);// REMOVE IDs

		// Preview from administration
		$app = JFactory::getApplication();
		$viewFrom = $app->input->get('view');



		if ($viewFrom == 'phocacartitem') {
			$advanced = 0;// force displaying IDs in administration preview
		}

		// Unset limitstart=0 since it's pointless
		if (isset($query['limitstart']) &&
$query['limitstart'] == 0)
		{
			unset($query['limitstart']);
		}

		// We need a menu item.  Either the one specified in the query, or the
current active one if none specified
		if (empty($query['Itemid']))
		{
			$menuItem = $this->menu->getActive();
			$menuItemGiven = false;
		}
		else
		{
			$menuItem = $this->menu->getItem($query['Itemid']);
			$menuItemGiven = true;
		}



		// Check again
		if ($menuItemGiven && isset($menuItem) &&
$menuItem->component != 'com_phocacart')
		{
			$menuItemGiven = false;
			unset($query['Itemid']);
		}

		if (isset($query['view']))
		{
			$view = $query['view'];
		}
		else
		{
			// We need to have a view in the query or it is an invalid URL

			return $segments;
		}



		// Are we dealing with an item or category that is attached to a menu
item?
	/*	if (($menuItem instanceof stdClass)
			&& $menuItem->query['view'] ==
$query['view']
			&& isset($query['id'])
			&& $menuItem->query['id'] == (int)
$query['id'])
		{*/

		if (($menuItem instanceof stdClass)
			&& $menuItem->query['view'] ==
$query['view']
			&& isset($query['view']) &&
in_array($query['view'], $viewsNoId)
			) {

			unset($query['view']);

			if (isset($query['catid'])){
				unset($query['catid']);
			}

			if (isset($query['layout'])){
				unset($query['layout']);
			}

			unset($query['id']);



			return $segments;
		}


		// Category
		// Item
		if ($view == 'category' || $view == 'item'){
			if (!$menuItemGiven){
				$segments[] = $view;
			}


			unset($query['view']);



			if ($view == 'item')
			{
				if (isset($query['id']) &&
isset($query['catid']) && $query['catid'])
				{
					$catid = $query['catid'];



					// Make sure we have the id and the alias
					if (strpos($query['id'], ':') === false)
					{


						$db = JFactory::getDbo();
						$dbQuery = $db->getQuery(true)
							->select('alias')
							->from('#__phocacart_products')
							->where('id=' . (int) $query['id']);
						$db->setQuery($dbQuery);
						$alias = $db->loadResult();
						$query['id'] = $query['id'] . ':' .
$alias;

					}
				}
				else
				{
					// We should have these two set for this view.  If we don't, it
is an error

					return $segments;
				}
			} else {
				if (isset($query['id']))
				{
					$catid = $query['id'];
				}
				else
				{
					// We should have id set for this view.  If we don't, it is an
error
					return $segments;
				}
			}

			if ($menuItemGiven &&
isset($menuItem->query['id']))
			{
				$mCatid = $menuItem->query['id'];
			}
			else
			{
				$mCatid = 0;
			}

			//$categories = JCategories::getInstance('Content');
			//$category = $categories->get($catid);
			$category = PhocacartCategory::getCategoryById($catid);


			if (!$category)
			{
				// We couldn't find the category we were given.  Bail.
				return $segments;
			}


			$path = PhocacartCategory::getPath(array(), (int)$category->id,
(int)$category->parent_id, $category->title, $category->alias);


			$array = array();

			foreach ($path as $id)
			{
				$id = $id['id']. ':'.$id['alias'];
				if ((int) $id == (int) $mCatid)
				{
					break;
				}

				list($tmp, $id) = explode(':', $id, 2);

				$array[] = $id;
			}

			$array = array_reverse($array);

			if (!$advanced && count($array))
			{
				$array[0] = (int) $catid . ':' . $array[0];
			}

			$segments = array_merge($segments, $array);

			if ($view == 'item')
			{
				if ($advanced)
				{
					list($tmp, $id) = explode(':', $query['id'], 2);
				}
				else
				{
					$id = $query['id'];
				}

				$segments[] = $id;
			}

			unset($query['id']);
			unset($query['catid']);
		}

		// Question
		if ($view == 'question'){
			if (!$menuItemGiven){
				$segments[] = $view;
			}

			if (isset($query['view'])) {
				$segments[]	= $query['view'];
				unset($query['view']);
			}
			//unset($query['view']);

			if (isset($query['id']) &&
isset($query['catid']) && $query['catid']) {
				$catid = $query['catid'];

				// Make sure we have the id and the alias
				if (strpos($query['id'], ':') === false) {


					$db = JFactory::getDbo();
					$dbQuery = $db->getQuery(true)
						->select('alias')
						->from('#__phocacart_products')
						->where('id=' . (int) $query['id']);
					$db->setQuery($dbQuery);
					$alias = $db->loadResult();
					$query['id'] = $query['id'] . ':' .
$alias;

				}
			} else {
				// We should have these two set for this view.  If we don't, it is
an error

				return $segments;
			}

			if ($menuItemGiven &&
isset($menuItem->query['id'])) {
				$mCatid = $menuItem->query['id'];
			}
			else
			{
				$mCatid = 0;
			}

			$category = PhocacartCategory::getCategoryById($catid);


			if (!$category) {
				// We couldn't find the category we were given.  Bail.
				return $segments;
			}


			$path = PhocacartCategory::getPath(array(), (int)$category->id,
(int)$category->parent_id, $category->title, $category->alias);


			$array = array();

			foreach ($path as $id)
			{
				$id = $id['id']. ':'.$id['alias'];
				if ((int) $id == (int) $mCatid)
				{
					break;
				}

				list($tmp, $id) = explode(':', $id, 2);

				$array[] = $id;
			}

			$array = array_reverse($array);

			if (!$advanced && count($array))
			{
				$array[0] = (int) $catid . ':' . $array[0];
			}

			$segments = array_merge($segments, $array);


			if ($advanced)
			{
				list($tmp, $id) = explode(':', $query['id'], 2);
			}
			else
			{
				$id = $query['id'];
			}

			$segments[] = $id;


			unset($query['id']);
			unset($query['catid']);
		}
		/*
		if ($view == 'question') {

			if (!$menuItemGiven){
				$segments[] = $view;
			}
			if (isset($query['view'])) {
				$segments[]	= $query['view'];
				unset($query['view']);
			}
			if (isset($query['catid'])) {
				$segments[]	= $query['catid'];
				unset($query['catid']);
			}
			if (isset($query['id'])) {
				$segments[]	= $query['id'];
				unset($query['id']);
			}
		}*/

		if (!isset($query['id'])) { // Check if a id was specified.
			if (isset($query['view']) &&
in_array($query['view'], $viewsNoId)) {
				$segments[]	= $query['view']; // Every View without ID
				unset($query['view']);
			}

		} else {
			if (isset($query['view']) &&
in_array($query['view'], $viewsId)) {

				$segments[]	= $query['view']; // Every View with ID except
(category and item): items, feed
				$segments[]	= $query['id'];
				unset($query['id']);
				unset($query['view']);
			}

		}



		/*
		 * If the layout is specified and it is the same as the layout in the
menu item, we
		 * unset it so it doesn't go into the query string.
		 */
		if (isset($query['layout']))
		{
			if ($menuItemGiven &&
isset($menuItem->query['layout']))
			{
				if ($query['layout'] ==
$menuItem->query['layout'])
				{
					unset($query['layout']);
				}
			}
			else
			{
				if ($query['layout'] == 'default')
				{
					unset($query['layout']);
				}
			}
		}

		$total = count($segments);

		for ($i = 0; $i < $total; $i++)
		{
			$segments[$i] = str_replace(':', '-',
$segments[$i]);
		}



		return $segments;
	}

	public function parse(&$segments) {




		$viewsNoId 		= array('categories', 'checkout',
'comparison', 'download', 'terms',
'account', 'orders', 'payment',
'info', 'items', 'wishlist', 'pos',
'submit');
		$viewsId		= array('category', 'item',
'items', 'feed');
		$viewsNotOwnId	= array('question');
		$viewsAll		= array_merge($viewsNoId, $viewsId, $viewsNotOwnId);

		// question - can be an ID page (id of product) but without ID page -
direct link

		$total = count($segments);
		$vars = array();

		// Get the active menu item.
		$item = $this->menu->getActive();
		$params = PhocacartUtils::getComponentParameters();
		//$advanced = $params->get('sef_advanced_link', 0);
		$advanced = $params->get('remove_sef_ids', 0);// REMOVE IDs
		$db = JFactory::getDbo();

		if($advanced == 1){

            $segmentId = '';
            $segmentCatid = '';
            // As default first part is category but it can even be view
            // If it is a view, shift they key to next part
            $segmentCatidKey = 0;

            for ($i = 0; $i < $total; $i++){

                if(isset($segments[$i]) && $i == 0 &&
in_array($segments[$i], $viewsNotOwnId)) {
                    $segmentCatidKey = 1;// First part is a view (e.g.
Quick View), shift the key to next part
                    $vars['view'] = $segments[$i];
                    continue;
                }

                $segmentCatidTemp = '';
                $query = $db->getQuery(true)
                    ->select($db->quoteName(array('id')))
                   
->from($db->quoteName('#__phocacart_categories'))
                    ->where($db->quoteName('alias') .
' = ' . $db->quote($segments[$i]));
                $db->setQuery($query);
                $segmentCatidTemp = $db->loadResult();
                if(!empty($segmentCatidTemp)) {
                    $segmentCatid = $segmentCatidTemp;
                    continue;
                }

                //we found or did not find the category ID, we will check
it later
                if (empty($segmentId)){

                    //$segmentProductId = '';
                    $query = $db->getQuery(true)
                       
->select($db->quoteName(array('id')))
                       
->from($db->quoteName('#__phocacart_products'))
                        ->where($db->quoteName('alias') .
' = ' . $db->quote($segments[$i]));
                    $db->setQuery($query);
                    $segmentId = $db->loadResult();

                    if(!empty($segmentId)) {

                        $segments[$i] =
$segmentId.'-'.$segments[$i];
                    }
                }

            }

            if(!empty($segmentCatid)) {
                //we found one or more category IDS, and add the last ID to
the beginning of the line (to the first segment)
                $segments[$segmentCatidKey] =
$segmentCatid.'-'.$segments[$segmentCatidKey];
            }
            //disable advanced mode and then the router works as before
            $advanced = 0;
        }

		/*if($advanced == 1){

		    $segmentId = '';
            $segmentCatid = '';

            for ($i = 0; $i < $total; $i++){

                if(isset($segments[$i]) && $i == 0 &&
in_array($segments[$i], $viewsNotOwnId)) {
                    $vars['view'] = $segments[$i];
                    continue;
                }

                if(empty($segmentCatid)){

                    $query = $db->getQuery(true)
                       
->select($db->quoteName(array('id')))
                       
->from($db->quoteName('#__phocacart_categories'))
                        ->where($db->quoteName('alias') .
' = ' . $db->quote($segments[$i]));
                    $db->setQuery($query);
                    $segmentCatid = $db->loadResult();
                    if(!empty($segmentCatid)) {
                        $segments[$i] =
$segmentCatid.'-'.$segments[$i];
                        continue;
                    }

                }

                if (empty($segmentId)){

                    //$segmentProductId = '';
                    $query = $db->getQuery(true)
                       
->select($db->quoteName(array('id')))
                       
->from($db->quoteName('#__phocacart_products'))
                        ->where($db->quoteName('alias') .
' = ' . $db->quote($segments[$i]));
                    $db->setQuery($query);
                    $segmentId = $db->loadResult();

                    if(!empty($segmentId)) {
                        $segments[$i] =
$segmentId.'-'.$segments[$i];
                    }
                }

            }
            $advanced = 0;
        }*/

		for ($i = 0; $i < $total; $i++) {
		    $segments[$i] = preg_replace('/-/', ':',
$segments[$i], 1);
		}


		// Count route segments
		$count = count($segments);


		/*
		 * Standard routing for items.  If we don't pick up an Itemid then
we get the view from the segments
		 * the first segment is the view and the last segment is the id of the
item or category.
		 */
		if (!isset($item)) {
			$vars['view'] = $segments[0];

			// Called if no menu item created
			$vars['id'] = $segments[$count - 1];

			unset($segments[0]);
			return $vars;
		}


		// First handle views without ID
		if ($count == 1) {
			if(isset($segments[0]) && in_array($segments[0], $viewsNoId)) {
					$vars['view']  = $segments[0];
				unset($segments[0]);
				return $vars;
			}

			// Question can include ID/CATID but can be without ID/CATID

			if(isset($segments[0]) && in_array($segments[0],
$viewsNotOwnId)) {
					$vars['view']  = $segments[0];

				return $vars;
			}
		}



		/*
		 * If there is only one segment, then it points to either an item or a
category.
		 * We test it first to see if it is a category.  If the id and alias
match a category,
		 * then we assume it is a category.  If they don't we assume it is
an item
		 */

		if ($count == 1) {
			// We check to see if an alias is given.  If not, we assume it is an
item CATEGORY BETTER
			// Mostly handling of wrong URl: categories/wrong-alias ( return
category = 0, no category found)
			//                               category/wrong-alias (return item = 0,
no product found)
			if (strpos($segments[0], ':') === false)
			{
				if (isset($item->query['view']) &&
$item->query['view'] == 'category') {
					$vars['view'] = 'item';
				} else if (isset($item->query['view']) &&
$item->query['view'] == 'categories') {
					$vars['view'] = 'category';
				} else {
					$vars['view'] = 'categories';
				}

				$vars['id'] = (int) $segments[0];

				return $vars;
			}

			list($id, $alias) = explode(':', $segments[0], 2);

			// First we check if it is a category
			//- $category =
JCategories::getInstance('Content')->get($id);
			$category = PhocacartCategory::getCategoryById($id);


			if ($category && $category->alias == $alias)
			{
				$vars['view'] = 'category';
				$vars['id'] = $id;
				unset($segments[0]);
				return $vars;
			} else {
				// TO DO specify catid - load from libraries
				$query = $db->getQuery(true)
					->select($db->quoteName(array('alias',
'catid')))
					->from($db->quoteName('#__phocacart_products'))
					->where($db->quoteName('id') . ' = ' . (int)
$id);
				$db->setQuery($query);
				$item1 = $db->loadObject();


				if ($item1) {
					if ($item1->alias == $alias) {

						$vars['view'] 	= 'item';
						$vars['id'] 	= (int) $id;
						$vars['catid']	 = (int) $item1->catid;

						// We have direct link to category view and item1->catid is null
						if ((int) $vars['catid'] == 0 &&
isset($item->query['id']) &&
$item->query['id'] > 0) {
							$vars['catid'] = (int)$item->query['id'];
						}


						return $vars;
					}
				}
			}
		}

		/*
		 * If there was more than one segment, then we can determine where the
URL points to
		 * because the first segment will have the target category id prepended
to it.  If the
		 * last segment has a number prepended, it is an item, otherwise, it is a
category.
		 */


		if (!$advanced) {

			$view 	= '';
			$id 	= 0;
			$catid 	= 0;
			if ($count == 3) {

				// Second part can be category/subcategory string
				$second = explode(':', $segments[1]);

				if (isset($second[0]) && (int)$second[0] > 0) {
					// Question
					$view 		= $segments[0];
					$cat_id 	= (int)$segments[1];
					$item_id 	= (int)$segments[2];

				} else {
					$view 		= 'item';// can be category, right view will be
solved after
					$cat_id 	= (int)$segments[0];
					// $segments[1] is a part of category/subcategory string
					$item_id 	= (int)$segments[2];

				}

			} else {
				// Item
				$view		= '';
				$cat_id 	= (int)$segments[0];
				$item_id 	= (int)$segments[$count - 1];

			}


			if ($cat_id > 0) {
				if ($item_id > 0) {
					if ($view != '') {
						$vars['view'] = $view;
					} else {
						$vars['view'] = 'item';
					}

					$vars['catid'] = $cat_id;
					$vars['id'] = $item_id;


				} else {
					$vars['view'] = 'category';
					$vars['id'] = $cat_id;
				}
			} else {
				if ($item_id > 0)
				{
					if ($count == 3) {
						$vars['view'] 	= $view;
						$vars['catid'] 	= $cat_id;
						$vars['id'] 	= $item_id;
					} else {
						// Other than category or item view with ID (items, feed)
						$vars['view'] = $segments[0];
						$vars['id'] = $item_id;
					}
				}
			}

		/*	if (empty($vars) && count($segments) > 1) {

				throw new Exception(JText::_('Nothing found'), 404);
				return false;
			}
		*/

			unset($segments[0]);
			unset($segments[1]);
			return $vars;
		}
/*
		// We get the category id from the menu item and search from there
		if (isset($item->query['id'])) {
			$id = $item->query['id'];
		} else {

			if ($count == 3) {
				// Question

				$id 	= (int)$segments[$count - 2];

			} else {
				// Item
				$id 	= (int)$segments[0];
			}
		}




		$category = PhocacartCategory::getCategoryById($id);

		if (!$category)
		{
			throw new
Exception(JText::_('COM_PHOCACART_ERROR_PARENT_CATEGORY_NOT_FOUND'),
404);
			return $vars;
		}

		$categories = PhocacartCategory::getChildren($category->id);
		$vars['catid'] = $id;
		$vars['id'] = $id;
		$found = 0;

		foreach ($segments as $segment) {
			$segment = str_replace(':', '-', $segment);

			foreach ($categories as $category)
			{
				if ($category->alias == $segment)
				{
					$vars['id'] = $category->id;
					$vars['catid'] = $category->id;
					$vars['view'] = 'category';
					$categories = PhocacartCategory::getChildren($category->id);
					$found = 1;

					break;
				}
			}

			if ($found == 0)
			{
				if ($advanced)
				{
					$db = JFactory::getDbo();
					$query = $db->getQuery(true)
						->select($db->quoteName('id'))
						->from('#__phocacart_item')
						->where($db->quoteName('catid') . ' = ' .
(int) $vars['catid'])
						->where($db->quoteName('alias') . ' = ' .
$db->quote($segment));
					$db->setQuery($query);
					$cid = $db->loadResult();
				}
				else
				{
					$cid = $segment;
				}

				$vars['id'] = $cid;
				$vars['view'] = 'item';
			}

			$found = 0;
		}*/



		return $vars;
	}
}

/**
 * Content router functions
 *
 * These functions are proxys for the new router interface
 * for old SEF extensions.
 *
 * @param   array  &$query  An array of URL arguments
 *
 * @return  array  The URL arguments to use to assemble the subsequent URL.
 *
 * @deprecated  4.0  Use Class based routers instead
 */
function PhocaCartBuildRoute(&$query)
{
	$router = new PhocacartRouter;

	return $router->build($query);
}

/**
 * Parse the segments of a URL.
 *
 * This function is a proxy for the new router interface
 * for old SEF extensions.
 *
 * @param   array  $segments  The segments of the URL to parse.
 *
 * @return  array  The URL attributes to be used by the application.
 *
 * @since   3.3
 * @deprecated  4.0  Use Class based routers instead
 */
function PhocaCartParseRoute($segments)
{
	$router = new PhocacartRouter;

	return $router->parse($segments);
}
views/account/index.html000064400000000054151167552070011342
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/account/metadata.xml000064400000000271151167552070011650
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view title="COM_PHOCACART_ACCOUNT_GROUP">
		<message><![CDATA[COM_PHOCACART_ACCOUNT_GROUP_DESC]]></message>
	</view>
</metadata>views/account/tmpl/default.php000064400000013241151167552070012460
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$layoutUL 		= new JLayoutFile('user_login', null,
array('component' => 'com_phocacart'));
$layoutUR 		= new JLayoutFile('user_register', null,
array('component' => 'com_phocacart'));

echo '<div id="ph-pc-account-box"
class="pc-account-view'.$this->p->get(
'pageclass_sfx' ).'">';

echo
PhocacartRenderFront::renderHeader(array(JText::_('COM_PHOCACART_MY_ACCOUNT')));


/*if ( $this->t['description'] != '') {
	echo '<div class="ph-desc">'.
$this->t['description']. '</div>';
}*/

if ((int)$this->u->id > 0) {

	// Reward Points
	if ((int)$this->t['display_reward_points_total_info'] > 0)
{
		echo '<div
class="'.$this->s['c']['row'].'
ph-account-box-row" >';
		echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-account-box-header"
id="phaccountrewardpoints"><h3>'.JText::_('COM_PHOCACART_REWARD_POINTS').'</h3></div>';
		echo '</div>';

		echo '<div
class="'.$this->s['c']['row'].'
ph-account-box-action">';

		echo '<div
class="'.$this->s['c']['col.xs12.sm8.md8'].'">'.
JText::_('COM_PHOCACART_TOTAL_AMOUNT_OF_YOUR_REWARD_POINTS') .
': </div>';
		echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'">'.$this->t['rewardpointstotal'].'</div>';

		//echo '<div class="ph-cb"></div>';

		echo '</div>'."\n";// end box action
	}

	// Header
	echo '<div
class="'.$this->s['c']['row'].'
ph-account-box-row" >';
	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-account-box-header"
id="phaccountaddressedit"><h3>'.JText::_('COM_PHOCACART_BILLING_AND_SHIPPING_ADDRESS').'</h3></div>';
	echo '</div>';

	echo '<form
action="'.$this->t['linkcheckout'].'"
method="post"
class="'.$this->s['c']['form-horizontal.form-validate'].'"
role="form" id="phcheckoutAddress">';
	echo '<div id="ph-request-message"
style="display:none"></div>';

	echo '<div
class="'.$this->s['c']['row'].'
ph-account-box-action">';

	echo '<div
class="'.$this->s['c']['col.xs12.sm6.md6'].'
ph-account-billing-row" id="phBillingAddress" >';
	echo '<div
class="ph-box-header">'.JText::_('COM_PHOCACART_BILLING_ADDRESS').'</div>';
	echo $this->t['dataaddressform']['b'];
	echo '</div>';// end row

	echo '<div
class="'.$this->s['c']['col.xs12.sm6.md6'].'
ph-account-shipping-row" id="phShippingAddress" >';
	echo '<div
class="ph-box-header">'.JText::_('COM_PHOCACART_SHIPPING_ADDRESS').'</div>';
	echo $this->t['dataaddressform']['s'];
	echo '</div>';// end row

	//echo '<div class="ph-cb"></div>';

	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
'.$this->s['c']['pull-right'].' ph-right
ph-account-check-box">';

	if ($this->t['dataaddressform']['s'] !=
'' &&
$this->t['$delivery_billing_same_enabled'] != -1) {
		echo '<div class="checkbox">';
		echo '<label><input type="checkbox"
id="phCheckoutBillingSameAsShipping"
name="phcheckoutbsas" ' .
$this->t['dataaddressform']['bsch'] . ' >
' .
JText::_('COM_PHOCACART_DELIVERY_AND_BILLING_ADDRESSES_ARE_THE_SAME')
. '</label>';
		echo '</div>';
	}

	echo '</div>';

	//echo '<div class="ph-cb"></div>';

	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
'.$this->s['c']['pull-right'].' ph-right
ph-account-address-save">';
	echo '<button class="btn btn-primary btn-sm
ph-btn"><span
class="'.$this->s['i']['save'].'"></span>
'.JText::_('COM_PHOCACART_SAVE').'</button>';
	//echo '<input type="submit" value="submit"
/>';
	echo '</div>';

	//echo '<div class="ph-cb"></div>';
	echo '</div>'."\n";// end box action


	echo '<input type="hidden" name="tmpl"
value="component" />';
	echo '<input type="hidden" name="option"
value="com_phocacart" />'. "\n";
	echo '<input type="hidden" name="task"
value="checkout.saveaddress" />'. "\n";
	echo '<input type="hidden" name="return"
value="'.$this->t['actionbase64'].'"
/>'. "\n";
	echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
	echo '</form>'. "\n";

	if ($this->t['display_edit_profile'] == 1) {
		echo $this->loadTemplate('profile');
	}

} else {

	require_once
JPATH_SITE.'/components/com_users/helpers/route.php';
	jimport( 'joomla.application.module.helper' );
	$module = JModuleHelper::getModule('mod_login');
	$mP 	= new JRegistry();
	$mP->loadString($module->params);

	$lang 	= JFactory::getLanguage();
	$lang->load('mod_login');

	echo '<div
class="'.$this->s['c']['row'].'
ph-account-box-row" >';
	//echo '<div class="ph-account-box-header"
id="phaccountloginedit"><div
class="ph-pull-right"><span
class="'.$this->s['i']['remove-circle'].'
ph-account-icon-not-ok"></span></div><h3>1.
'.JText::_('COM_PHOCACART_LOGIN_REGISTER').'</h3></div>';
	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-account-box-header"
id="phaccountloginedit"><h3>'.JText::_('COM_PHOCACART_LOGIN_REGISTER').'</h3></div>';
	echo '</div>';


	echo '<div
class="'.$this->s['c']['row'].'
ph-account-box-action">';


	echo '<div
class="'.$this->s['c']['col.xs12.sm8.md8'].'
ph-right-border">';

	$d = array();
	$d['s'] = $this->s;
	$d['t'] = $this->t;
	echo $layoutUL->render($d);

	echo '</div>'. "\n";// end columns

	echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'
ph-left-border">';

	$d = array();
	$d['s'] = $this->s;
	$d['t'] = $this->t;
	echo $layoutUR->render($d);

	echo '</div>'. "\n";// end columns

	echo '<div class="ph-cb"></div>';

	echo '</div>'. "\n";// end account box login

	echo '</form>'. "\n";

}


echo '</div>';
echo '<div>&nbsp;</div>';
echo PhocacartUtilsInfo::getInfo();
?>
views/account/tmpl/default.xml000064400000000730151167552070012470
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_PHOCACART_ACCOUNT_LAYOUT">
		<message>
			<![CDATA[COM_PHOCACART_ACCOUNT_LAYOUT_DESC]]>
		</message>
	</layout>
	
		<name>COM_PHOCACART_ACCOUNT_LAYOUT</name>
		<description>COM_PHOCACART_ACCOUNT_LAYOUT_DESC</description>
		
		<fields name="params">
<fieldset name="basic"
addfieldpath="/administrator/components/com_phocacart/models/fields"
>

			
		</fieldset>
</fields>

</metadata>views/account/tmpl/default_profile.php000064400000023674151167552070014213
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_users
 *
 * @copyright   Copyright (C) 2005 - 2014 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

Joomla\CMS\HTML\HTMLHelper::_('behavior.keepalive');
Joomla\CMS\HTML\HTMLHelper::_('behavior.formvalidation');
//Joomla\CMS\HTML\HTMLHelper::_('formbehavior.chosen',
'select');

//load user_profile plugin language
$lang = JFactory::getLanguage();
$lang->load('plg_user_profile', JPATH_ADMINISTRATOR);
?>
<div class="profile-edit<?php /* echo $this->pageclass_sfx */
?>">
<?php if ($this->params->get('show_page_heading')) :
?>
	<div class="page-header">
		<h1><?php echo
$this->escape($this->params->get('page_heading'));
?></h1>
	</div>
<?php endif; ?>

<script type="text/javascript">
	Joomla.twoFactorMethodChange = function(e)
	{
		var selectedPane = 'com_users_twofactor_' +
jQuery('#jform_twofactor_method').val();

		jQuery.each(jQuery('#com_users_twofactor_forms_container>div'),
function(i, el) {
			if (el.id != selectedPane)
			{
				jQuery('#' + el.id).hide(0);
			}
			else
			{
				jQuery('#' + el.id).show(0);
			}
		});
	}
</script>

<?php

// Header
echo '<div
class="'.$this->s['c']['row'].'
ph-account-box-row" >';
echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-account-box-header"
id="phaccountaddressedit"><h3>'.JText::_('COM_PHOCACART_EDIT_MY_PROFILE').'</h3></div>';
echo '</div>';

echo '<form
action="'.$this->t['linkaccount'].'"
method="post" class="form-horizontal form-validate"
role="form" id="phcheckoutAddress">';

echo '<div
class="'.$this->s['c']['row'].'
ph-account-box-action">';
echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-account-billing-row" id="phUserProfile" >';
//echo '<div
class="ph-box-header">'.JText::_('COM_PHOCACART_USER_PROFILE').'</div>';

?>

<?php foreach ($this->form->getFieldsets() as $group =>
$fieldset):// Iterate through the form fieldsets and display each one.?>
	<?php $fields = $this->form->getFieldset($group);

	if ($group != 'core') {
		continue;
	}
	?>
	<?php if (count($fields)):
	/* ?>
	<fieldset>
		<?php if (isset($fieldset->label)):// If the fieldset has a label
set, display it as the legend.?>
		<legend><?php echo JText::_($fieldset->label);
?></legend>
		<?php endif; */ ?>
		<?php foreach ($fields as $field):// Iterate through the fields in the
set and display them.?>
			<?php if ($field->hidden):// If the field is hidden, just display
the input.?>
				<div class="<?php echo
$this->s['c']['control-group'] ?>">
					<div class="<?php echo
$this->s['c']['controls'] ?>">
						<?php echo $field->input;?>
					</div>
				</div>
			<?php else:?>
				<div class="<?php echo
$this->s['c']['control-group'] ?>">
					<div class="<?php echo
$this->s['c']['control-label'] ?>">
						<?php echo $field->label; ?>
						<?php if (!$field->required && $field->type !=
'Spacer') : ?>
						<span class="optional"><?php echo
JText::_('COM_USERS_OPTIONAL'); ?></span>
						<?php endif; ?>
					</div>
					<div class="<?php echo
$this->s['c']['controls'] ?>">
						<?php echo $field->input; ?>
					</div>
				</div>
			<?php endif;?>
		<?php endforeach;?>
	<?php /* </fieldset> */ ?>
	<?php endif;?>
<?php endforeach;?>

<?php if (count($this->twofactormethods) > 1): ?>
	<fieldset>
		<legend><?php echo
JText::_('COM_USERS_PROFILE_TWO_FACTOR_AUTH')
?></legend>

		<div class="<?php echo
$this->s['c']['control-group'] ?>">
			<div class="<?php echo
$this->s['c']['control-label'] ?>">
				<label id="jform_twofactor_method-lbl"
for="jform_twofactor_method" class="<?php echo
$this->s['c']['hastooltip'] ?>"
					   title="<strong><?php echo
JText::_('COM_USERS_PROFILE_TWOFACTOR_LABEL')
?></strong><br/><?php echo
JText::_('COM_USERS_PROFILE_TWOFACTOR_DESC') ?>">
					<?php echo JText::_('COM_USERS_PROFILE_TWOFACTOR_LABEL');
?>
				</label>
			</div>
			<div class="controls">
				<?php echo
Joomla\CMS\HTML\HTMLHelper::_('select.genericlist',
$this->twofactormethods, 'jform[twofactor][method]',
array('onchange' =>
'Joomla.twoFactorMethodChange()'), 'value',
'text', $this->otpConfig->method,
'jform_twofactor_method', false) ?>
			</div>
		</div>
		<div id="com_users_twofactor_forms_container">
			<?php foreach($this->twofactorform as $form): ?>
			<?php $style = $form['method'] ==
$this->otpConfig->method ? 'display: block' :
'display: none'; ?>
			<div id="com_users_twofactor_<?php echo
$form['method'] ?>" style="<?php echo $style;
?>">
				<?php echo $form['form'] ?>
			</div>
			<?php endforeach; ?>
		</div>
	</fieldset>

	<fieldset>
		<legend>
			<?php echo JText::_('COM_USERS_PROFILE_OTEPS') ?>
		</legend>
		<div class="alert alert-info">
			<?php echo JText::_('COM_USERS_PROFILE_OTEPS_DESC') ?>
		</div>
		<?php if (empty($this->otpConfig->otep)): ?>
		<div class="alert alert-warning">
			<?php echo JText::_('COM_USERS_PROFILE_OTEPS_WAIT_DESC')
?>
		</div>
		<?php else: ?>
		<?php foreach ($ths->otpConfig->otep as $otep): ?>
		<span class="<?php echo
$this->s['c']['col.xs12.sm3.md3']?>">
			<?php echo substr($otep, 0, 4) ?>-<?php echo substr($otep, 4,
4) ?>-<?php echo substr($otep, 8, 4) ?>-<?php echo
substr($otep, 12, 4) ?>
		</span>
		<?php endforeach; ?>
		<div class="ph-cb"></div>
		<?php endif; ?>
	</fieldset>
<?php endif; ?>

<?php

echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
'.$this->s['c']['pull-right'].' ph-right
ph-account-address-save">';
echo '<button
class="'.$this->s['c']['btn.btn-primary.btn-sm'].'
ph-btn"><span
class="'.$this->s['i']['save'].'"></span>
'.JText::_('COM_PHOCACART_SAVE').'</button>';
//echo '<input type="submit" value="submit"
/>';
echo '</div>';


echo '</div>';// end row
echo '</div>';// end row


//echo '<div class="ph-cb"></div>';




//echo '<div class="ph-cb"></div>';
echo '</div>'."\n";// end box action


echo '<input type="hidden" name="tmpl"
value="component" />';
echo '<input type="hidden" name="option"
value="com_phocacart" />'. "\n";
echo '<input type="hidden" name="task"
value="account.saveprofile" />'. "\n";
echo '<input type="hidden" name="return"
value="'.$this->t['actionbase64'].'"
/>'. "\n";
echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
echo '</form>'. "\n";

/*
?>

<form id="member-profile" action="<?php echo
JRoute::_('index.php?option=com_phocacart&task=account.save');
?>" method="post" class="form-validate
form-horizontal" enctype="multipart/form-data">
<?php foreach ($this->form->getFieldsets() as $group =>
$fieldset):// Iterate through the form fieldsets and display each one.?>
	<?php $fields = $this->form->getFieldset($group);?>
	<?php if (count($fields)):
	?>
	<fieldset>
		<?php if (isset($fieldset->label)):// If the fieldset has a label
set, display it as the legend.?>
		<legend><?php echo JText::_($fieldset->label);
?></legend>
		<?php endif;?>
		<?php foreach ($fields as $field):// Iterate through the fields in the
set and display them.?>
			<?php if ($field->hidden):// If the field is hidden, just display
the input.?>
				<div class="control-group">
					<div class="controls">
						<?php echo $field->input;?>
					</div>
				</div>
			<?php else:?>
				<div class="control-group">
					<div class="control-label">
						<?php echo $field->label; ?>
						<?php if (!$field->required && $field->type !=
'Spacer') : ?>
						<span class="optional"><?php echo
JText::_('COM_USERS_OPTIONAL'); ?></span>
						<?php endif; ?>
					</div>
					<div class="controls">
						<?php echo $field->input; ?>
					</div>
				</div>
			<?php endif;?>
		<?php endforeach;?>
	</fieldset>
	<?php endif;?>
<?php endforeach;?>

<?php if (count($this->twofactormethods) > 1): ?>
	<fieldset>
		<legend><?php echo
JText::_('COM_USERS_PROFILE_TWO_FACTOR_AUTH')
?></legend>

		<div class="control-group">
			<div class="control-label">
				<label id="jform_twofactor_method-lbl"
for="jform_twofactor_method" class="<?php echo
$this->s['c']['hastooltip'] ?>"
					   title="<strong><?php echo
JText::_('COM_USERS_PROFILE_TWOFACTOR_LABEL')
?></strong><br/><?php echo
JText::_('COM_USERS_PROFILE_TWOFACTOR_DESC') ?>">
					<?php echo JText::_('COM_USERS_PROFILE_TWOFACTOR_LABEL');
?>
				</label>
			</div>
			<div class="controls">
				<?php echo
Joomla\CMS\HTML\HTMLHelper::_('select.genericlist',
$this->twofactormethods, 'jform[twofactor][method]',
array('onchange' =>
'Joomla.twoFactorMethodChange()'), 'value',
'text', $this->otpConfig->method,
'jform_twofactor_method', false) ?>
			</div>
		</div>
		<div id="com_users_twofactor_forms_container">
			<?php foreach($this->twofactorform as $form): ?>
			<?php $style = $form['method'] ==
$this->otpConfig->method ? 'display: block' :
'display: none'; ?>
			<div id="com_users_twofactor_<?php echo
$form['method'] ?>" style="<?php echo $style;
?>">
				<?php echo $form['form'] ?>
			</div>
			<?php endforeach; ?>
		</div>
	</fieldset>

	<fieldset>
		<legend>
			<?php echo JText::_('COM_USERS_PROFILE_OTEPS') ?>
		</legend>
		<div class="alert alert-info">
			<?php echo JText::_('COM_USERS_PROFILE_OTEPS_DESC') ?>
		</div>
		<?php if (empty($this->otpConfig->otep)): ?>
		<div class="alert alert-warning">
			<?php echo JText::_('COM_USERS_PROFILE_OTEPS_WAIT_DESC')
?>
		</div>
		<?php else: ?>
		<?php foreach ($this->otpConfig->otep as $otep): ?>
		<span class="span3">
			<?php echo substr($otep, 0, 4) ?>-<?php echo substr($otep, 4,
4) ?>-<?php echo substr($otep, 8, 4) ?>-<?php echo
substr($otep, 12, 4) ?>
		</span>
		<?php endforeach; ?>
		<div class="clearfix"></div>
		<?php endif; ?>
	</fieldset>
<?php endif; ?>

		<div class="form-actions">
			<button type="submit" class="btn btn-primary
validate"><span><?php echo JText::_('JSUBMIT');
?></span></button>
			<a class="btn" href="<?php echo
JRoute::_(''); ?>" title="<?php echo
JText::_('JCANCEL'); ?>"><?php echo
JText::_('JCANCEL'); ?></a>

			<input type="hidden" name="option"
value="com_phocacart" />
			<input type="hidden" name="task"
value="account.saveprofile" />
			<?php
			echo '<input type="hidden" name="return"
value="'.$this->t['actionbase64'].'"
/>'. "\n";
			echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
			?>
		</div>
	</form>
</div>*/ ?>
views/account/tmpl/index.html000064400000000054151167552070012316
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/account/view.html.php000064400000010040151167552070011767
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');

class PhocaCartViewAccount extends JViewLegacy
{
	protected $t;
	protected $r;
	protected $p;
	protected $u;
	protected $s;
	protected $fields2;
	protected $data2;
	protected $form2;

	// User profile
	protected $params;
	protected $fields;
	protected $data;
	protected $form;
	protected $state;
	protected $twofactorform;
	protected $twofactormethods;
	protected $otpConfig;

	function display($tpl = null)
	{
		$app								= JFactory::getApplication();
		$this->u							= PhocacartUser::getUser();
		$uri 								= \Joomla\CMS\Uri\Uri::getInstance();
		$document							= JFactory::getDocument();
		$this->p 							= $app->getParams();
		$this->s                            =
PhocacartRenderStyle::getStyles();
		$model								= $this->getModel();

		$this->t['action']							= $uri->toString();
		$this->t['actionbase64']					=
base64_encode($this->t['action']);
		$this->t['linkaccount']						=
JRoute::_(PhocacartRoute::getAccountRoute());
		$this->t['linkcheckout']					=
JRoute::_(PhocacartRoute::getCheckoutRoute());
		$this->t['display_edit_profile']			= $this->p->get(
'display_edit_profile', 1 );
		$this->t['display_reward_points_total_info']=
$this->p->get( 'display_reward_points_total_info', 0 );
		$this->t['$delivery_billing_same_enabled']  =
$this->p->get('delivery_billing_same_enabled', 0);

		$lang = JFactory::getLanguage();
		//$lang->load('com_users.sys');
		$lang->load('com_users');


		if ((int)$this->u->id > 0) {
			// Checkout Model
			jimport('joomla.application.component.model');
			JModelLegacy::addIncludePath(JPATH_SITE.'/components/com_phocacart/models');
			$modelCheckout 				= JModelLegacy::getInstance( 'Checkout',
'PhocaCartModel' );

			// Check if all form items are filled out by user, if yes, don't
load the form and save some queries
			$this->fields2				= $modelCheckout->getFields(0,0,1); // Fields
will be loaded in every case
			$this->data2				= $modelCheckout->getData();
			$this->form2				= $modelCheckout->getForm();
			$this->t['dataaddressform']	=
PhocacartUser::getAddressDataForm($this->form2,
$this->fields2['array'], $this->u);


			// USER PROFILE - USER MODULE
			jimport('joomla.application.component.model');
			//JLoader::import('user',JPATH_SITE.'/components/com_users/models');
			JModelLegacy::addIncludePath(JPATH_SITE.'/components/com_users/models');
			$modelUsers 			= JModelLegacy::getInstance( 'Profile',
'UsersModel' );
			$this->data	            = $modelUsers->getData();
			$loadformpath 			= JPATH_SITE.'/components/com_users/models';
			JForm::addFormPath($loadformpath.'/forms');
			JForm::addFieldPath($loadformpath.'/fields');
			$this->form	  			= $modelUsers->getForm();

			$this->state            = $modelUsers->getState();
			$this->params           =
$this->state->get('params');
			$this->twofactorform    = $modelUsers->getTwofactorform();
			$this->twofactormethods = UsersHelper::getTwoFactorMethods();
			$this->otpConfig        = $modelUsers->getOtpConfig();
			$this->data->tags 		= new JHelperTags;
			$this->data->tags->getItemTags('com_users.user.',
$this->data->id);

			// REWARD POINTS
			$reward = new PhocacartReward();
			$this->t['rewardpointstotal'] =
$reward->getTotalPointsByUserId((int)$this->u->id);


		}

		$media = PhocacartRenderMedia::getInstance('main');
		$media->loadBase();
		$media->loadChosen();
		//- PhocacartRenderJs::renderBillingAndShippingSame();
        $media->loadSpec();

		$this->_prepareDocument();
		parent::display($tpl);

	}

	protected function _prepareDocument() {
		PhocacartRenderFront::prepareDocument($this->document, $this->p,
false, false, JText::_('COM_PHOCACART_ACCOUNT'));
	}
}
?>
views/categories/index.html000064400000000054151167552070012033
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/categories/metadata.xml000064400000000277151167552070012347
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view title="COM_PHOCACART_CATEGORIES_GROUP">
		<message><![CDATA[COM_PHOCACART_CATEGORIES_GROUP_DESC]]></message>
	</view>
</metadata>views/categories/tmpl/default.php000064400000002036151167552070013151
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

echo '<div id="ph-pc-categories-box"
class="pc-categories-view'.$this->p->get(
'pageclass_sfx' ).'">';

echo $this->t['event']->onCategoriesBeforeHeader;
echo PhocacartRenderFront::renderHeader(array(), '',
$this->t['image_categories_view']);

if ( $this->t['main_description'] != '') {
	echo '<div class="ph-desc">'.
$this->t['main_description']. '</div>';
}
if (!empty($this->t['categories'])) {
	echo '<div class="ph-categories">';

	if ($this->t['categories_view_layout'] == 2) {
		echo $this->loadTemplate('colspan');
	} else {
		echo $this->loadTemplate('standard');
	}
	echo '</div>'. "\n";
}
echo '</div>';
echo '<div>&nbsp;</div>';
echo PhocacartUtilsInfo::getInfo();
?>
views/categories/tmpl/default.xml000064400000003053151167552070013162
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_PHOCACART_CATEGORIES_LAYOUT">
		<message>
			<![CDATA[COM_PHOCACART_CATEGORIES_LAYOUT_DESC]]>
		</message>
	</layout>
	
		<name>COM_PHOCACART_CATEGORIES_LAYOUT</name>
		<description>COM_PHOCACART_CATEGORIES_LAYOUT_DESC</description>
		
		<fields name="params">
<fieldset name="basic"
addfieldpath="/administrator/components/com_phocacart/models/fields"
>

		<field name="display_categories"
type="phocacartcategory" section="com_phocacart"
default="0"
label="COM_PHOCACART_FIELD_DISPLAY_CATEGORIES_LABEL"
description="COM_PHOCACART_FIELD_DISPLAY_CATEGORIES_DESC"
multiple="true" />
		
		<field name="hide_categories"
type="phocacartcategory" section="com_phocacart"
default="0"
label="COM_PHOCACART_FIELD_HIDE_CATEGORIES_LABEL"
description="COM_PHOCACART_FIELD_HIDE_CATEGORIES_DESC"
multiple="true" />
		
		<field name="show_pagination" type="radio" 
class="btn-group btn-group-yesno" default="1"
label="COM_PHOCACART_FIELD_SHOW_PAGINATION_LABEL"
description="COM_PHOCACART_FIELD_SHOW_PAGINATION_DESC">
			<option value="0">COM_PHOCACART_HIDE</option>
			<option value="1">COM_PHOCACART_DISPLAY</option>
		</field>

		<field name="show_pagination_top" type="radio" 
class="btn-group btn-group-yesno" default="1"
label="COM_PHOCACART_FIELD_SHOW_PAGINATION_TOP_LABEL"
description="COM_PHOCACART_FIELD_SHOW_PAGINATION_TOP_DESC">
			<option value="0">COM_PHOCACART_HIDE</option>
			<option value="1">COM_PHOCACART_DISPLAY</option>
		</field>
			
		</fieldset>
</fields>

</metadata>views/categories/tmpl/default_colspan.php000064400000005735151167552070014701
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$layoutC	= new JLayoutFile('categories_category', null,
array('component' => 'com_phocacart'));

$i      = $j = $k = 0;
$last   = count($this->t['categories']);
$mod    = $last%5;

echo '<div class="ph-t-box">';
foreach ($this->t['categories'] as $v) {

	$size = 'medium';
	// START
	if ($j == 5|| ($j == 0 && $k > 0)) {//Not valid for first zero,
but valid for each zero after first round
		echo '</div>';// End the row4 so 5 can start the new row
		echo '<div
class="'.$this->s['c']['grid'].'
ph-row-cats ph-t-box">' . "\n";// Start the new row
after 4 ended it
	}

	if ($j == 0 || $j == 9) {
		$size = 'large';
		echo '<div class="ph-t-row ph-t-row-c1">' .
"\n";// c1 is colspan
		echo ' <div
class="'.$this->s['c']['thumbnail'].'
ph-t-cell b-thumbnail ph-thumbnail ph-thumbnail-c">' .
"\n";
	}

	if ($j == 1 || $j == 3 || $j == 5 || $j == 7) {

		if (($last - 2 == $i) && $mod != 0 ) {
			echo '<div class="ph-t-row ph-t-row-c1">' .
"\n";// c2 is standard column (no colspan) - not for last group

		} else if (($last - 1 == $i) && $mod == 2 ) {
			echo '<div class="ph-t-row ph-t-row-c1">' .
"\n";// c2 is standard column (no colspan) - not for last group
			$size = 'large';
		} else {
			echo '<div class="ph-t-row ph-t-row-c2">' .
"\n";// c2 is standard column (no colspan)

		}
		echo ' <div
class="'.$this->s['c']['thumbnail'].'
ph-t-cell b-thumbnail ph-thumbnail ph-thumbnail-c">' .
"\n";
	}
	if ($j == 2 || $j == 4 || $j == 6 || $j == 8) {
		echo ' <div
class="'.$this->s['c']['thumbnail'].'
ph-t-cell b-thumbnail ph-thumbnail ph-thumbnail-c">' .
"\n";
	}



	//echo $this->loadTemplate('category');
	//echo "Cell ". ($j) . "(".$i.") - ".$last;
	echo '<div
class="'.$this->s['c']['grid'].'
ph-item-box">';


	//echo '<div class="b-thumbnail ph-thumbnail
ph-thumbnail-c">';
	//echo '<div class="ph-item-content">';


	$d									= array();
	$d['t'] 							= $this->t;
    $d['s'] 							= $this->s;
	$d['v']								= $v;
	$d['image_size']					= $size;
	echo $layoutC->render($d);

	echo '</div>';// end ph-item-box

	//echo '<div class="clearfix"></div>';
	//echo '</div>';// end ph-caption
	//echo '</div>';// end ph-item-content
	//echo '</div>';// end thumbnails
	//echo '</div>';// end ph-item-box


	// END
	if ($j == 0 || $j == 2 || $j == 4 || $j == 6 || $j == 8 || $j == 9) {
		echo ' </div>';
		echo '</div>';
	}

	if ($j == 1 || $j == 3 || $j == 5 || $j == 7) {
		echo ' </div>' . "\n";

		if ($i == ($last - 1)) {

			echo '</div>';// close last opened column
		}
	}


	$i++;
	$j++;
	if ($j >= 10) {$j = 0; $k = 1;}// run the round again from start

}
echo '</div>';



?>
views/categories/tmpl/default_standard.php000064400000002442151167552070015032
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$layoutC	= new JLayoutFile('categories_category', null,
array('component' => 'com_phocacart'));

echo '<div
class="'.PhocacartRenderFront::completeClass(array($this->s['c']['row'],
$this->t['class_row_flex'], 'grid',
'ph-row-cats',
$this->t['class_lazyload'])).'">';
$col	= 12/(int)$this->p->get('columns_cats', 3);

foreach ($this->t['categories'] as $v) {

	echo '<div
class="'.$this->s['c']["col.xs12.sm{$col}.md{$col}"].'
row-item">';
	echo '<div
class="'.$this->s['c']['grid'].'
ph-item-box">';
	echo '<div
class="'.$this->s['c']['thumbnail'].'
b-thumbnail ph-thumbnail ph-thumbnail-c">';
	echo '<div class="ph-item-content">';

	$d					= array();
	$d['t']				= $this->t;
	$d['s'] 			= $this->s;
	$d['p']             = $this->p;
	$d['v']				= $v;
	$d['image_size']	= 'medium';
	echo $layoutC->render($d);

	echo '<div class="ph-cb"></div>';
	echo '</div>';
	echo '</div>';
	echo '</div>';
	echo '</div>'. "\n";
}
echo '</div>';
?>
views/categories/tmpl/index.html000064400000000054151167552070013007
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/categories/view.html.php000064400000007323151167552070012472
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');

class PhocaCartViewCategories extends JViewLegacy
{
	protected $t;
	protected $r;
	protected $p;
	protected $s;

	public function display($tpl = null) {


		$app									= JFactory::getApplication();
		$model									= $this->getModel();
		$document								= JFactory::getDocument();
		$this->p 								= $app->getParams();
		$this->s								= PhocacartRenderStyle::getStyles();

		$this->t['view']						= 'categories';
		$this->t['csv_display_subcategories']	= $this->p->get(
'csv_display_subcategories', 0 );
		$this->t['categories']					=
$model->getCategoriesList($this->t['csv_display_subcategories']);
		$this->t['csv_display_category_desc']	= $this->p->get(
'csv_display_category_desc', 0 );
		$this->t['cart_metakey'] 				= $this->p->get(
'cart_metakey', '' );
		$this->t['cart_metadesc'] 				= $this->p->get(
'cart_metadesc', '' );
		$this->t['main_description']			= $this->p->get(
'main_description', '' );
		$this->t['main_description']			=
PhocacartRenderFront::renderArticle($this->t['main_description']);

		$this->t['image_width_cats']			= $this->p->get(
'image_width_cats', '' );
		$this->t['image_height_cats']			= $this->p->get(
'image_height_cats', '' );
		$this->t['display_view_category_button']=
$this->p->get( 'display_view_category_button', 1 );
		$this->t['category_name_link']			= $this->p->get(
'category_name_link', 0 );
		$this->t['categories_view_layout']		= $this->p->get(
'categories_view_layout', 1 );

		$this->t['lazy_load_categories']		= $this->p->get(
'lazy_load_categories', 0 );
		$this->t['medium_image_width']			= $this->p->get(
'medium_image_width', 300 );
		$this->t['medium_image_height']			= $this->p->get(
'medium_image_height', 200 );
		$this->t['display_webp_images']			= $this->p->get(
'display_webp_images', 0 );

		$this->t['image_categories_view']			= $this->p->get(
'image_categories_view', '' );
		$this->t['image_categories_view']			=
$this->t['image_categories_view'] != '' ?
JURI::base(true) . '/'.
$this->t['image_categories_view'] : '';


		$this->t['class_row_flex']              =
$this->p->get('equal_height', 1)  == 1 ?
'ph-row-flex' : '';
        $this->t['class_fade_in_action_icons']  =
$this->p->get('fade_in_action_icons', 0)  == 1 ?
'b-thumbnail' : '';
        $this->t['class_lazyload']       		=
$this->t['lazy_load_categories']  == 1 ?
'ph-lazyload' : '';


        $media = PhocacartRenderMedia::getInstance('main');
		$media->loadBase();
		$media->loadChosen();


		$this->t['path'] =
PhocacartPath::getPath('categoryimage');

		// Plugins ------------------------------------------
		JPluginHelper::importPlugin('pcv');
		//$this->t['dispatcher'] 	= J
EventDispatcher::getInstance();
		$this->t['event']		= new stdClass;

		$results =
\JFactory::getApplication()->triggerEvent('PCVonCategoriesBeforeHeader',
array('com_phocacart.categories',
&$this->t['categories'], &$this->p));

		$this->t['event']->onCategoriesBeforeHeader =
trim(implode("\n", $results));
		// END Plugins --------------------------------------

        $media->loadSpec();
		$this->_prepareDocument();
		parent::display($tpl);

		echo $media->returnLazyLoad();// Render all bottom scripts // Must be
loaded bottom because of ignoring async in Firefox

	}

	protected function _prepareDocument() {
		PhocacartRenderFront::prepareDocument($this->document, $this->p);
	}
}
?>
views/category/index.html000064400000000054151167552070011523
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/category/metadata.xml000064400000000273151167552070012033
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view title="COM_PHOCACART_CATEGORY_GROUP">
		<message><![CDATA[COM_PHOCACART_CATEGORY_GROUP_DESC]]></message>
	</view>
</metadata>views/category/tmpl/default.php000064400000046170151167552070012650
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;

defined('_JEXEC') or die();

$layoutC 	= new JLayoutFile('button_compare', null,
array('component' => 'com_phocacart'));
$layoutW 	= new JLayoutFile('button_wishlist', null,
array('component' => 'com_phocacart'));
$layoutQVB 	= new JLayoutFile('button_quickview', null,
array('component' => 'com_phocacart'));
$layoutS	= new JLayoutFile('product_stock', null,
array('component' => 'com_phocacart'));
$layoutPOQ	= new JLayoutFile('product_order_quantity', null,
array('component' => 'com_phocacart'));
$layoutR	= new JLayoutFile('product_rating', null,
array('component' => 'com_phocacart'));
$layoutAI	= new JLayoutFile('button_add_to_cart_icon', null,
array('component' => 'com_phocacart'));
$layoutIL	= new JLayoutFile('items_list', null,
array('component' => 'com_phocacart'));
$layoutIGL	= new JLayoutFile('items_gridlist', null,
array('component' => 'com_phocacart'));
$layoutIG	= new JLayoutFile('items_grid', null,
array('component' => 'com_phocacart'));
$layoutAAQ	= new JLayoutFile('popup_container_iframe', null,
array('component' => 'com_phocacart'));

// HEADER - NOT AJAX
if (!$this->t['ajax']) {
	echo '<div id="ph-pc-category-box"
class="pc-category-view'.$this->p->get(
'pageclass_sfx' ).'">';
	$c = isset($this->t['categories']) ?
count($this->t['categories']) : 0;
	echo $this->loadTemplate('header');
	echo $this->loadTemplate('subcategories');
	echo $this->loadTemplate('pagination_top');
	echo '<div id="phItemsBox">';
}


// ITEMS a) items displayed by layout plugin, b) items displayed common
way, c) no items found
if (!empty($this->items) &&
$this->t['pluginlayout']) {

	$pluginOptions 				= array();
	$eventData 					= array();
	$dLA 						= array();
	$eventData['pluginname'] 	=
$this->t['category_layout_plugin'];

	Factory::getApplication()->triggerEvent('PCLonCategoryGetOptions',
array('com_phocacart.category', &$pluginOptions,
$eventData));

	if (isset($pluginOptions['layouttype']) &&
$pluginOptions['layouttype'] != '') {
		$this->t['layouttype'] =
PhocacartText::filterValue($pluginOptions['layouttype'],
'alphanumeric5');
	}

	$lt			= $this->t['layouttype'];
	$dLA['t'] 	= $this->t;
	$dLA['s'] 	= $this->s;

	echo '<div id="phItems" class="ph-items
'.$lt.'">';

	Factory::getApplication()->triggerEvent('PCLonCategoryInsideLayout',
array('com_phocacart.category', &$this->items, $dLA,
$eventData));

	echo $this->loadTemplate('pagination');

	echo '</div>'. "\n"; // end items

} else if (!empty($this->items)) {

	$price			= new PhocacartPrice;
	$col 			=
PhocacartRenderFront::getColumnClass((int)$this->t['columns_cat']);
	$lt				= $this->t['layouttype'];
	$i				= 1; // Not equal Heights

	echo '<div id="phItems" class="ph-items
'.$lt.'">';
	echo '<div
class="'.PhocacartRenderFront::completeClass(array($this->s['c']['row'],
$this->t['class_row_flex'],
$this->t['class_lazyload'], $lt)).'">';

	foreach ($this->items as $v) {

		$label 				= PhocacartRenderFront::getLabel($v->date, $v->sales,
$v->featured);
		$link 				= JRoute::_(PhocacartRoute::getItemRoute($v->id,
$v->catid, $v->alias, $v->catalias));

		// Image data
		$attributesOptions 	= $this->t['hide_attributes_category']
== 0 ? PhocacartAttribute::getAttributesAndOptions((int)$v->id) :
array();

		if (!isset($v->additional_image)) { $v->additional_image =
'';}
		$image = PhocacartImage::getImageDisplay($v->image,
$v->additional_image, $this->t['pathitem'],
$this->t['switch_image_category_items'],
$this->t['image_width_cat'],
$this->t['image_height_cat'], '', $lt,
$attributesOptions);

		// :L: IMAGE
		$dI	= array();
		if (isset($image['image']->rel) &&
$image['image']->rel != '') {
			$dI['t']				= $this->t;
			$dI['s']				= $this->s;
			$dI['product_id']		= (int)$v->id;
			$dI['layouttype']		= $lt;
			$dI['title']			= $v->title;
			$dI['image']			= $image;
			$dI['typeview']			= 'Category';
		}

		// :L: COMPARE
		$icon 				= array();
		$icon['compare'] 	= '';
		if ($this->t['display_compare'] == 1) {
			$d					= array();
			$d['s']				= $this->s;
			$d['linkc']			= $this->t['linkcomparison'];
			$d['id']			= (int)$v->id;
			$d['catid']			= $this->t['categoryid'];
			$d['return']		= $this->t['actionbase64'];
			$d['method']		= $this->t['add_compare_method'];
			$icon['compare'] 	= $layoutC->render($d);
		}

		// :L: WISHLIST
		$icon['wishlist'] = '';
		if ($this->t['display_wishlist'] == 1) {
			$d					= array();
			$d['s']				= $this->s;
			$d['linkw']			= $this->t['linkwishlist'];
			$d['id']			= (int)$v->id;
			$d['catid']			= $this->t['categoryid'];
			$d['return']		= $this->t['actionbase64'];
			$d['method']		= $this->t['add_wishlist_method'];
			$icon['wishlist'] 	= $layoutW->render($d);
		}

		// :L: QUICKVIEW
		$icon['quickview'] = '';
		if ($this->t['display_quickview'] == 1) {
			$d					= array();
			$d['s']				= $this->s;
			$d['linkqvb']		=
JRoute::_(PhocacartRoute::getItemRoute($v->id, $v->catid,
$v->alias, $v->catalias));
			$d['id']			= (int)$v->id;
			$d['catid']				=
$this->t['display_products_all_subcategories'] == 1 ?
$v->catid : $this->t['categoryid'];
			$d['return']		= $this->t['actionbase64'];
			$icon['quickview'] 	= $layoutQVB->render($d);
		}

		// :L: PRICE
		$dP = array();
		$priceItems = array();
		if ($this->t['can_display_price']) {

			$dP['type'] = $v->type;// PRODUCTTYPE
			$priceItems	= $price->getPriceItems($v->price, $v->taxid,
$v->taxrate, $v->taxcalculationtype, $v->taxtitle,
$v->unit_amount, $v->unit_unit, 1, 1, $v->group_price);

			$price->getPriceItemsChangedByAttributes($priceItems,
$attributesOptions, $price, $v);
			$dP['priceitemsorig']= array();
			$dP['priceitems']	= $priceItems;

			if ($v->price_original != '' &&
$v->price_original > 0) {
				$dP['priceitemsorig'] =
$price->getPriceItems($v->price_original, $v->taxid,
$v->taxrate, $v->taxcalculationtype);
			}
			//$dP['class']		= 'ph-category-price-box '.$lt;
			$dP['class']		= 'ph-category-price-box';// Cannot be
dynamic as can change per ajax - this can cause jumping of boxes
			$dP['product_id']	= (int)$v->id;
			$dP['typeview']		= 'Category';


			// Display discount price
			// Move standard prices to new variable (product price -> product
discount)
			$dP['priceitemsdiscount']		= $dP['priceitems'];
			$dP['discount'] 				=
PhocacartDiscountProduct::getProductDiscountPrice($v->id,
$dP['priceitemsdiscount']);

			// Display cart discount (global discount) in product views - under
specific conditions only
			// Move product discount prices to new variable (product price ->
product discount -> product discount cart)
			$dP['priceitemsdiscountcart']	=
$dP['priceitemsdiscount'];
			$dP['discountcart']				=
PhocacartDiscountCart::getCartDiscountPriceForProduct($v->id,
$v->catid, $dP['priceitemsdiscountcart']);

			$dP['zero_price']		= 1;// Apply zero price if possible
		}

		// :L: LINK TO PRODUCT VIEW
		$dV = array();
		$dV['s'] = $this->s;
		$dV['display_view_product_button'] 	=
$this->t['display_view_product_button'];
		if ((int)$this->t['display_view_product_button'] > 0) {
			$dV['link']							= $link;
			//$dV['display_view_product_button'] 	=
$this->t['display_view_product_button'];
		}

		// :L: ADD TO CART
		$dA = $dA2 = $dA3 = $dA4 = $dAb = $dF = array();
		$icon['addtocart'] = '';

		// STOCK ===================================================
		// Set stock: product, variations, or advanced stock status
		$dSO 				= '';
		$dA['class_btn']	= '';
		$dA['class_icon']	= '';
		if ($this->t['display_stock_status'] == 2 ||
$this->t['display_stock_status'] == 3) {

			$stockStatus 				= array();
			$stock 						=
PhocacartStock::getStockItemsChangedByAttributes($stockStatus,
$attributesOptions, $v);



			if ($this->t['hide_add_to_cart_stock'] == 1 &&
(int)$stock < 1) {
				$dA['class_btn'] 		= 'ph-visibility-hidden';// hide
button
				$dA['class_icon']		= 'ph-display-none';// hide
icon
			}

			if($stockStatus['stock_status'] ||
$stockStatus['stock_count'] !== false) {
				$dS							= array();
				$dS['s']	                = $this->s;
				$dS['class']				= 'ph-category-stock-box';
				$dS['product_id']			= (int)$v->id;
				$dS['typeview']				= 'Category';
				$dS['stock_status_output'] 	=
PhocacartStock::getStockStatusOutput($stockStatus);
				$dSO = $layoutS->render($dS);
			}

			if($stockStatus['min_quantity']) {
				$dPOQ						= array();
				$dPOQ['s']	                = $this->s;
				$dPOQ['text']				=
JText::_('COM_PHOCACART_MINIMUM_ORDER_QUANTITY');
				$dPOQ['status']				= $stockStatus['min_quantity'];
				$dSO .= $layoutPOQ->render($dPOQ);
			}

			if($stockStatus['min_multiple_quantity']) {
				$dPOQ						= array();
				$dPOQ['s']	                = $this->s;
				$dPOQ['text']				=
JText::_('COM_PHOCACART_MINIMUM_MULTIPLE_ORDER_QUANTITY');
				$dPOQ['status']				=
$stockStatus['min_multiple_quantity'];
				$dSO .= $layoutPOQ->render($dPOQ);
			}
		}
		// END STOCK ================================================


		// ------------------------------------
		// BUTTONS + ICONS
		// ------------------------------------
		// Prepare data for Add to cart button
		// - Add To Cart Standard Button
		// - Add to Cart Icon Button
		// - Add to Cart Icon Only

		if ((int)$this->t['category_addtocart'] == 1 ||
(int)$this->t['category_addtocart'] == 4 ||
$this->t['display_addtocart_icon'] == 1) {


			// FORM DATA
			$dF['s']					= $this->s;
			$dF['linkch']				= $this->t['linkcheckout'];//
link to checkout (add to cart)
			$dF['id']					= (int)$v->id;
			// If in category even products from its subcategories can be displayed
then it means that
			// that current product does not have to be connected with with this
category view
			// so we don't set current category but category based on db
			$dF['catid']				=
$this->t['display_products_all_subcategories'] == 1 ?
$v->catid : $this->t['categoryid'];
			$dF['return']				= $this->t['actionbase64'];
			$dF['typeview']				= 'Category';
			$dA['addtocart']			=
$this->t['category_addtocart'];
			$dA['addtocart_icon']		=
$this->t['display_addtocart_icon'];


			// Both buttons + icon
			$dA['s']					= $this->s;
			$dA['id']					= (int)$v->id;
			$dA['link']					= $link;// link to item (product) view e.g.
when there are required attributes - we cannot add it to cart
			$dA['addtocart']			=
$this->t['category_addtocart'];
			$dA['method']				= $this->t['add_cart_method'];
			$dA['typeview']				= 'Category';

			// ATTRIBUTES, OPTIONS
			$dAb['s']						= $this->s;
			$dAb['attr_options']			= $attributesOptions;
			$dAb['hide_attributes']			=
$this->t['hide_attributes_category'];
			$dAb['dynamic_change_image'] 	=
$this->t['dynamic_change_image'];
			$dAb['remove_select_option_attribute']	=
$this->t['remove_select_option_attribute'];
			$dAb['zero_attribute_price']	=
$this->t['zero_attribute_price'];
			$dAb['pathitem']				= $this->t['pathitem'];

			$dAb['product_id']				= (int)$v->id;
			$dAb['gift_types']				= $v->gift_types;
			$dAb['image_size']				= $image['size'];
			$dAb['typeview']				= 'Category';
			$dAb['price']					= $price;
			$dAb['priceitems']					= $priceItems;

			// Attribute is required and we don't display it in category/items
view, se we need to redirect to detail view
			$dA['selectoptions']	= 0;
			if (isset($v->attribute_required) &&
$v->attribute_required == 1 &&
$this->t['hide_attributes_category'] == 1) {
				$dA['selectoptions']	= 1;
			}

			// Add To Cart as Icon
			if ($this->t['display_addtocart_icon'] == 1) {
				$icon['addtocart'] 	= $layoutAI->render($dA);

			}

		}

		// Different button or icons
		$addToCartHidden = 0;// Design parameter - if there is no button (add to
cart, paddle link, external link), used e.g. for displaying ask a question
button
		if ($v->type == 3 &&
(int)$this->t['category_addtocart'] != 104) {
			// PRODUCTTYPE - price on demand price cannot be added to cart
			$dA = array(); // Skip Standard Add to cart button
			$icon['addtocart'] = '';// Skip Add to cart icon
except Quick View Button
			$dF = array();// Skip form
			$addToCartHidden = 1;

		} else if ($this->t['hide_add_to_cart_zero_price'] == 1
&& $v->price == 0) {
			// Don't display Add to Cart in case the price is zero
			$dA = array(); // Skip Standard Add to cart button
			$icon['addtocart'] = '';// Skip Add to cart icon
			$dF = array();// Skip form
			$addToCartHidden = 1;

		} else if ((int)$this->t['category_addtocart'] == 1 ||
(int)$this->t['category_addtocart'] == 4) {
			// ADD TO CART BUTTONS - we have data yet
		} else if ((int)$this->t['category_addtocart'] == 102
&& (int)$v->external_id != '') {
			// EXTERNAL LINK PADDLE
			$dA2['t']				= $this->t;
			$dA2['s']				= $this->s;
			$dA2['external_id']		= (int)$v->external_id;
			$dA2['return']			= $this->t['actionbase64'];

			$dA = array(); // Skip Standard Add to cart button
			$icon['addtocart'] = '';// Skip Add to cart icon
			$dF = array();// Skip form

		} else if ((int)$this->t['category_addtocart'] == 103
&& $v->external_link != '') {
			// EXTERNAL LINK
			$dA3['t']				= $this->t;
			$dA3['s']				= $this->s;
			$dA3['external_link']	= $v->external_link;
			$dA3['external_text']	= $v->external_text;
			$dA3['return']			= $this->t['actionbase64'];

			$dA = array(); // Skip Standard Add to cart button
			$icon['addtocart'] = '';// Skip Add to cart icon
			$dF = array();// Skip form


		} else if ((int)$this->t['category_addtocart'] == 104) {
			// QUICK VIEW
			$dA4				= array();
			$dA4['s']			= $this->s;
			$dA4['linkqvb']		=
JRoute::_(PhocacartRoute::getItemRoute($v->id, $v->catid,
$v->alias, $v->catalias));
			$dA4['id']			= (int)$v->id;
			$dA4['catid']		= $this->t['categoryid'];
			$dA4['return']		= $this->t['actionbase64'];
			$dA4['button'] 		= 1;

			$dA = array(); // Skip Standard Add to cart button
			$icon['addtocart'] = '';// Skip Add to cart icon
			$dF = array();// Skip form

		} else {

			// ADD TO CART ICON ONLY (NO BUTTONS)
			$dA = array(); // Skip Standard Add to cart button
			// We remove the $dA completely, even for the icon, but the icon has the
data already stored in $icon['addtocart']
			// so no problem with removing the data completely
			// $dA for button will be rendered
			// $dA for icon was rendered already
			// Do not skip the form here
			$addToCartHidden = 1;
		}
		// ---------------------------- END BUTTONS

		$dQ	= array();
		if (((int)$this->t['category_askquestion'] == 1) ||
($this->t['category_askquestion'] == 2 &&
((int)$this->t['category_addtocart'] == 0 || $addToCartHidden
!= 0))) {

			$dQ['s']			= $this->s;
			$dQ['id']			= (int)$v->id;
			$dQ['catid']		= $this->t['categoryid'];;
			$dQ['popup']		= 0;
			$tmpl				= '';
			if ((int)$this->t['popup_askquestion'] > 0) {
				$dQ['popup']		=
(int)$this->t['popup_askquestion'];
				$popupAskAQuestion	= (int)$this->t['popup_askquestion'];
				$tmpl				= 'tmpl=component';
			}
			$dQ['link']			= 
JRoute::_(PhocacartRoute::getQuestionRoute($v->id, $v->catid,
$v->alias, $v->catalias, $tmpl));
			$dQ['return']		= $this->t['actionbase64'];

		}






		// ======
		// RENDER
		// ======
		$dL 					= array();
		$dL['t']				= $this->t;
		$dL['s']				= $this->s;
		$dL['col']				= $col;
		$dL['link'] 			= $link;
		$dL['lt']				= $lt;// Layout Type
		$dL['layout']['dI']		= $dI;// Image
		$dL['layout']['dP']		= $dP;// Price
		$dL['layout']['dSO']	= $dSO;// Stock Output
		$dL['layout']['dF']		= $dF;// Form
		$dL['layout']['dAb']	= $dAb;// Attributes
		$dL['layout']['dV']		= $dV;// Link to Product View
		$dL['layout']['dA']		= $dA;// Button Add to Cart
		$dL['layout']['dA2']	= $dA2;// Button Buy now
		$dL['layout']['dA3']	= $dA3;// Button external link
		$dL['layout']['dA4']	= $dA4;// Button external link
		$dL['layout']['dQ']		= $dQ;// Ask A Question

		$dL['icon']				= $icon;// Icons
		$dL['product_header']	=
PhocacartRenderFront::renderProductHeader($this->t['product_name_link'],
$v, 'item', '', $lt);

		//$dL['product_header'] .= '<div>SKU:
'.$v->sku.'</div>';
		//$dL['product_header'] .= '<div>EAN:
'.$v->ean.'</div>';

		// Events
		$results =
\JFactory::getApplication()->triggerEvent('PCVonCategoryItemAfterAddToCart',
array('com_phocacart.category', &$v, &$this->p));
		$dL['event']['onCategoryItemsItemAfterAddToCart'] =
trim(implode("\n", $results));

		// LABELS
		$dL['labels'] =  $label['new'] .
$label['hot'] . $label['feat'];
		$tagLabelsOutput = PhocacartTag::getTagsRendered((int)$v->id,
$this->t['category_display_labels']);
		if ($tagLabelsOutput != '') {
			$dL['labels'] .= $tagLabelsOutput;
		}

		// REVIEW - STAR RATING
		$dL['review'] = '';
		if ((int)$this->t['display_star_rating'] > 0) {
			$d							= array();
			$d['s']						= $this->s;
			$d['rating']				= isset($v->rating) &&
(int)$v->rating > 0 ? (int)$v->rating : 0;
			$d['size']					= 16;
			$d['display_star_rating']	=
(int)$this->t['display_star_rating'];
			$dL['review'] = $layoutR->render($d);
		}

		// DESCRIPTION
		$dL['description'] = '';
		if ($this->t['cv_display_description'] == 1 &&
$v->description != '') {
			$dL['description'] = '<div
class="ph-item-desc">' .
Joomla\CMS\HTML\HTMLHelper::_('content.prepare',
$v->description) . '</div>';
		}

		// TAGS
		$dL['tags'] =  '';
		$tagsOutput = PhocacartTag::getTagsRendered((int)$v->id,
$this->t['category_display_tags'], ', ');
		if ($tagsOutput != '') {
			$dL['tags'] .= $tagsOutput;
		}

		// MANUFACTURER
		$dL['manufacturer'] =  '';
		if ($this->t['category_display_manufacturer'] > 0
&& (int)$v->manufacturerid > 0 &&
$v->manufacturertitle != '') {
			$dL['manufacturer'] .=
PhocacartManufacturer::getManufacturerRendered((int)$v->manufacturerid,
$v->manufacturertitle, $v->manufactureralias,
$this->t['manufacturer_alias'],
$this->t['category_display_manufacturer'], 0, '');

		}

		if ($lt == 'list') {
			echo $layoutIL->render($dL);
		} else if ( $lt == 'gridlist') {
			echo $layoutIGL->render($dL);
		} else  {
			echo $layoutIG->render($dL);
		}
		// --------------- END RENDER





		if ($i%(int)$this->t['columns_cat'] == 0) {
			echo '<div class="ph-cb"></div>';
		}
		$i++;


	}

	echo '</div>';// end row (row-flex)
	echo '<div class="ph-cb"></div>';


	echo $this->loadTemplate('pagination');

	echo '</div>'. "\n"; // end items
}


// FOOTER - NOT AJAX
if (!$this->t['ajax']) {

	echo '</div>';// end #phItemsBox
	echo '</div>';// end #ph-pc-category-box

	echo '<div id="phContainer"></div>';

	if (isset($popupAskAQuestion) && $popupAskAQuestion == 2) {

		echo '<div id="phContainerPopup">';
		$d						= array();
		$d['id']				= 'phAskAQuestionPopup';
		$d['title']				=
JText::_('COM_PHOCACART_ASK_A_QUESTION');
		$d['icon']				=
$this->s['i']['question-sign'];
		$d['t']					= $this->t;
		$d['s']					= $this->s;
		echo $layoutAAQ->render($d);
		echo '</div>';// end phContainerPopup
	}

	echo '<div>&nbsp;</div>';
	echo PhocacartUtilsInfo::getInfo();
}
?>
views/category/tmpl/default.xml000064400000002675151167552070012663
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_PHOCACART_CATEGORY_LAYOUT">
		<message>
			<![CDATA[COM_PHOCACART_CATEGORY_LAYOUT_DESC]]>
		</message>
	</layout>
		<name>COM_PHOCACART_CATEGORY_LAYOUT</name>
		<description>COM_PHOCACART_CATEGORY_LAYOUT_DESC</description>
		<fields name="request">
		<fieldset name="request"
addfieldpath="/administrator/components/com_phocacart/models/fields">

			<field name="id" type="phocacartcategory"
section="com_phocacart" default="0"
label="COM_PHOCACART_FIELD_SELECT_CATEGORY_LABEL"
description="COM_PHOCACART_FIELD_SELECT_CATEGORY_DESC"
required="true" />
		</fieldset>
	</fields>
	
	<fields name="params">
<fieldset name="basic"
addfieldpath="/administrator/components/com_phocacart/models/fields"
>

		<field name="show_pagination" type="radio" 
class="btn-group btn-group-yesno" default="1"
label="COM_PHOCACART_FIELD_SHOW_PAGINATION_LABEL"
description="COM_PHOCACART_FIELD_SHOW_PAGINATION_DESC">
			<option value="0">COM_PHOCACART_HIDE</option>
			<option value="1">COM_PHOCACART_DISPLAY</option>
		</field>

		<field name="show_pagination_top" type="radio" 
class="btn-group btn-group-yesno" default="1"
label="COM_PHOCACART_FIELD_SHOW_PAGINATION_TOP_LABEL"
description="COM_PHOCACART_FIELD_SHOW_PAGINATION_TOP_DESC">
			<option value="0">COM_PHOCACART_HIDE</option>
			<option value="1">COM_PHOCACART_DISPLAY</option>
		</field>


		</fieldset>
</fields>
</metadata>views/category/tmpl/default_header.php000064400000003635151167552070014157
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

if (isset($this->category[0]->parentid) &&
($this->t['display_back'] == 1 ||
$this->t['display_back'] == 3)) {
	if ($this->category[0]->parentid == 0) {
		$linkUp = JRoute::_(PhocacartRoute::getCategoriesRoute());
		$linkUpText = JText::_('COM_PHOCACART_CATEGORIES');
	} else if ($this->category[0]->parentid > 0) {
		$linkUp =
JRoute::_(PhocacartRoute::getCategoryRoute($this->category[0]->parentid,
$this->category[0]->parentalias));
		$linkUpText = $this->category[0]->parenttitle;
	} else {
		$linkUp 	= false;
		$linkUpText = false;
	}

	if ($linkUp && $linkUpText) {
		echo '<div class="ph-top">'
		.'<a
class="'.$this->s['c']['btn.btn-success'].'"
title="'.$linkUpText.'" href="'.
$linkUp.'" >'
        .'<span
class="'.$this->s['i']['back-category'].'"></span>
'.JText::_($linkUpText).'</a>'
        .'</div>';
	}
}

echo $this->t['event']->onCategoryBeforeHeader;

$title = '';
if (isset($this->category[0]->title) &&
$this->category[0]->title != '') {
	$title = $this->category[0]->title;
}

// Image meta is used for open graph plugins
$imageMeta = '';
if (isset($this->category[0]->image) &&
$this->category[0]->image != '') {
	$pathItem	= $this->t['pathcat'];
	$imageMeta	= JURI::base(true) . '/'.
$pathItem['orig_rel_ds'] .$this->category[0]->image;
}

echo PhocacartRenderFront::renderHeader(array($title), '',
$imageMeta);

if ( isset($this->category[0]->description) &&
$this->category[0]->description != '') {
	echo '<div class="ph-desc">'.
Joomla\CMS\HTML\HTMLHelper::_('content.prepare',
$this->category[0]->description). '</div>';
}
?>
views/category/tmpl/default_pagination.php000064400000001246151167552070015054
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$this->t['action'] = str_replace('&amp;',
'&', $this->t['action']);
$this->t['action'] =
htmlspecialchars($this->t['action']);

$layout 			= new JLayoutFile('category_pagination', null,
array('component' => 'com_phocacart'));
$d					= array();
$d['t']				= $this->t;
$d['s']				= $this->s;
echo $layout->render($d);
?>
views/category/tmpl/default_pagination_top.php000064400000001252151167552070015733
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$this->t['action'] = str_replace('&amp;',
'&', $this->t['action']);
$this->t['action'] =
htmlspecialchars($this->t['action']);

$layout 			= new JLayoutFile('category_pagination_top', null,
array('component' => 'com_phocacart'));
$d					= array();
$d['t']				= $this->t;
$d['s']				= $this->s;
echo $layout->render($d);
?>
views/category/tmpl/default_subcategories.php000064400000005117151167552070015563
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$layoutI	= new JLayoutFile('category_image', null,
array('component' => 'com_phocacart'));

if (!empty($this->subcategories) &&
(int)$this->t['cv_display_subcategories'] > 0) {

	echo '<div
class="ph-subcategories">'.JText::_('COM_PHOCACART_SUBCATEGORIES')
. ':</div>';
	$j = 0;

	if ($this->t['cv_subcategories_layout'] == 2) {

		// IMAGE BOXES
		// Columns of subcategories = columns of products
		$col =
PhocacartRenderFront::getColumnClass((int)$this->t['columns_subcat_cat']);
		echo '<div
class="'.$this->s['c']['row.row-flex'].'
grid">';

		foreach($this->subcategories as $v) {

			if ($j == (int)$this->t['cv_display_subcategories']) {
				break;
			}
			echo ' <div
class="'.$this->s['c']["col.xs12.sm{$col}.md{$col}"].'
row-item-subcategory">';
			echo '  <div
class="ph-item-subcategory-box">';

			$image =
PhocacartImage::getThumbnailName($this->t['pathcat'],
$v->image, 'small');
			if (isset($image->rel) && $image->rel != '') {

				echo '<a
href="'.JRoute::_(PhocacartRoute::getCategoryRoute($v->id,
$v->alias)).'">';

				$dI	= array();
				$dI['t']			    = $this->t;
				$dI['s']			    = $this->s;
				$dI['image']['title']	= $v->title;
				$dI['image']['image']	= $image;
				echo $layoutI->render($dI);

				echo '</a>';
			} else {
				echo '<a
href="'.JRoute::_(PhocacartRoute::getCategoryRoute($v->id,
$v->alias)).'">'.$v->title.'</a>';
			}

			echo '<h3><a
href="'.JRoute::_(PhocacartRoute::getCategoryRoute($v->id,
$v->alias)).'">'.$v->title.'</a></h3>';

			echo '  </div>';
			echo ' </div>';

			$j++;
		}

		echo '</div>';

	} else {

		// LISTS

		echo '<ul>';
		foreach($this->subcategories as $v) {

			if ($j == (int)$this->t['cv_display_subcategories']) {
				break;
			}

		/*	$image =
PhocacartImage::getThumbnailName($this->t['pathcat'],
$v->image, 'small');
			if (isset($image->rel)) {
				echo '<a
href="'.JRoute::_(PhocacartRoute::getCategoryRoute($v->id,
$v->alias)).'"><img src="'.
JURI::base(true).'/'.$image->rel.'" alt=""
class="img-responsive ph-image" /></a>';
			}*/


			echo '<li><a
href="'.JRoute::_(PhocacartRoute::getCategoryRoute($v->id,
$v->alias)).'">'.$v->title.'</a></li>';
			$j++;
		}
		echo '</ul>';
	}

	echo '<div class="ph-hr"></div>';

}

?>
views/category/tmpl/index.html000064400000000054151167552070012477
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/category/view.html.php000064400000033101151167552070012153
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 *
 * Why Items View or why category view? Category view always has category
ID,
 * but items view is here for filtering and searching and this can be
without category ID
 */
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');
jimport( 'joomla.filesystem.folder' );
jimport( 'joomla.filesystem.file' );

class PhocaCartViewCategory extends JViewLegacy
{
	protected $category;
	protected $subcategories;
	protected $items;
	protected $t;
	protected $r;
	protected $p;
	protected $s;

	function display($tpl = null) {

		$app						= JFactory::getApplication();
		$this->p 					= $app->getParams();
		$this->s					= PhocacartRenderStyle::getStyles();
		$uri 						= \Joomla\CMS\Uri\Uri::getInstance();
		$model						= $this->getModel();
		$document					= JFactory::getDocument();
		$this->t['categoryid']		= $app->input->get(
'id', 0, 'int' );
		$this->t['limitstart']		= $app->input->get(
'limitstart', 0, 'int' );
		$this->t['ajax'] 			= 0;




		// PARAMS
		$this->t['view']					= 'category';
		$this->t['category_layout_plugin']	= $this->p->get(
'category_layout_plugin', '');
		$this->t['display_new']				= $this->p->get(
'display_new', 0 );
		$this->t['cart_metakey'] 			= $this->p->get(
'cart_metakey', '' );
		$this->t['cart_metadesc'] 			= $this->p->get(
'cart_metadesc', '' );
		//$this->t['description']			= $this->p->get(
'description', '' );
		$this->t['cv_display_description']	= $this->p->get(
'cv_display_description', 1 );
		$this->t['image_width_cat']			= $this->p->get(
'image_width_cat', '' );
		$this->t['image_height_cat']		= $this->p->get(
'image_height_cat', '' );
		//$this->t['image_link']			= $this->p->get(
'image_link', 0 );
		$this->t['columns_cat']				= $this->p->get(
'columns_cat', 3 );
		$this->t['columns_subcat_cat']		= $this->p->get(
'columns_subcat_cat', 3 );
		$this->t['enable_social']			= $this->p->get(
'enable_social', 0 );
		$this->t['cv_display_subcategories']= $this->p->get(
'cv_display_subcategories', 5 );
		$this->t['display_back']			= $this->p->get(
'display_back', 3 );


		$this->t['display_compare']			= $this->p->get(
'display_compare', 0 );
		$this->t['display_wishlist']		= $this->p->get(
'display_wishlist', 0 );
		$this->t['display_quickview']		= $this->p->get(
'display_quickview', 0 );
		$this->t['display_addtocart_icon']	= $this->p->get(
'display_addtocart_icon', 0 );
		$this->t['fade_in_action_icons']	= $this->p->get(
'fade_in_action_icons', 0 );

		// Hide action icon box if no icon displayed
		$this->t['display_action_icons'] = 1;
		if ($this->t['display_compare'] == 0 &&
$this->t['display_wishlist'] == 0 &&
$this->t['display_quickview'] == 0 &&
$this->t['display_addtocart_icon'] == 0) {
			$this->t['display_action_icons'] = 0;
		}


		$this->t['category_addtocart']		= $this->p->get(
'category_addtocart', 1 );

		$this->t['dynamic_change_image']	= $this->p->get(
'dynamic_change_image', 0);
		$this->t['dynamic_change_price']	= $this->p->get(
'dynamic_change_price', 0 );
		$this->t['dynamic_change_stock']	= $this->p->get(
'dynamic_change_stock', 0 );
		$this->t['dynamic_change_id']           =
$this->p->get('dynamic_change_id', 0);
		$this->t['remove_select_option_attribute']=
$this->p->get( 'remove_select_option_attribute', 1 );
		$this->t['add_compare_method']		= $this->p->get(
'add_compare_method', 0 );
        $this->t['display_addtocart']			= $this->p->get(
'display_addtocart', 1 );
		$this->t['add_wishlist_method']		= $this->p->get(
'add_wishlist_method', 0 );
		$this->t['display_star_rating']		= $this->p->get(
'display_star_rating', 0 );
		$this->t['add_cart_method']			= $this->p->get(
'add_cart_method', 0 );
		$this->t['hide_attributes_category']= $this->p->get(
'hide_attributes_category', 1 );
		$this->t['hide_attributes']			= $this->p->get(
'hide_attributes', 0 );
		$this->t['display_stock_status']	= $this->p->get(
'display_stock_status', 1 );
		$this->t['hide_add_to_cart_stock']	= $this->p->get(
'hide_add_to_cart_stock', 0 );
		$this->t['zero_attribute_price']	= $this->p->get(
'zero_attribute_price', 1 );
		$this->t['hide_add_to_cart_zero_price']	=
$this->p->get( 'hide_add_to_cart_zero_price', 0 );
		$this->t['cv_subcategories_layout']	= $this->p->get(
'cv_subcategories_layout', 1 );
		$this->t['category_askquestion']	 	= $this->p->get(
'category_askquestion', 0 );
		$this->t['popup_askquestion']		    = $this->p->get(
'popup_askquestion', 1 );
		$this->t['display_products_all_subcategories'] =
$this->p->get('display_products_all_subcategories', 0);


		// Rights or catalogue options --------------------------------
		$rights								= new PhocacartAccessRights();
		$this->t['can_display_price']		=
$rights->canDisplayPrice();
		$this->t['can_display_addtocart']	=
$rights->canDisplayAddtocart();
		$this->t['can_display_attributes']	=
$rights->canDisplayAttributes();

		if (!$this->t['can_display_addtocart']) {
			$this->t['category_addtocart']		= 0;
			$this->t['display_addtocart_icon'] 	= 0;
			//$this->t['hide_attributes_category']= 1; Should be
displayed or not?
		}
		if (!$this->t['can_display_attributes']) {
			$this->t['hide_attributes_category'] = 1;
		}
		// ------------------------------------------------------------

		$this->t['display_view_product_button']	=
$this->p->get( 'display_view_product_button', 1 );
		$this->t['product_name_link']			= $this->p->get(
'product_name_link', 0 );
		$this->t['switch_image_category_items']	=
$this->p->get( 'switch_image_category_items', 0 );


		$this->t['lazy_load_category_items']	= $this->p->get(
'lazy_load_category_items', 0 );// Products
		$this->t['lazy_load_categories']		= $this->p->get(
'lazy_load_categories', 0 );// Subcategories
		$this->t['medium_image_width']			= $this->p->get(
'medium_image_width', 300 );
		$this->t['medium_image_height']			= $this->p->get(
'medium_image_height', 200 );
		$this->t['display_webp_images']			= $this->p->get(
'display_webp_images', 0 );
		$this->t['category_display_labels']		= $this->p->get(
'category_display_labels', 2 );
		$this->t['category_display_tags']		= $this->p->get(
'category_display_tags', 0 );
		$this->t['category_display_manufacturer']		=
$this->p->get( 'category_display_manufacturer', 0 );
		$this->t['manufacturer_alias']			= $this->p->get(
'manufacturer_alias', 'manufacturer');
		$this->t['manufacturer_alias']			=
$this->t['manufacturer_alias'] != '' ?
trim(PhocacartText::filterValue($this->t['manufacturer_alias'],
'alphanumeric'))  : 'manufacturer';


		$this->t['show_pagination'] 			=
$this->p->get('show_pagination');
		$this->t['show_pagination_top'] 		=
$this->p->get('show_pagination_top', 1);
		$this->t['display_item_ordering'] 		=
$this->p->get('display_item_ordering');
		$this->t['display_item_ordering_top'] 	=
$this->p->get('display_item_ordering_top', 1);
		$this->t['show_pagination_limit'] 		=
$this->p->get('show_pagination_limit');
		$this->t['show_pagination_limit_top'] 	=
$this->p->get('show_pagination_limit_top', 1);
		$this->t['ajax_pagination_category'] 	=
$this->p->get('ajax_pagination_category', 0);
		$this->t['display_pagination_labels'] 	=
$this->p->get('display_pagination_labels', 1);
		$this->t['show_switch_layout_type'] 	=
$this->p->get('show_switch_layout_type', 1);


		$this->category						=
$model->getCategory($this->t['categoryid']);

		if (empty($this->category)) {
			header("HTTP/1.0 404
".JText::_('COM_PHOCACART_NO_CATEGORY_FOUND'));
			echo '<div class="alert
alert-error">'.JText::_('COM_PHOCACART_NO_CATEGORY_FOUND').'</div>';
		} else {
			$this->subcategories		=
$model->getSubcategories($this->t['categoryid']);
			$this->items				=
$model->getItemList($this->t['categoryid']);
			$this->t['pagination']		=
$model->getPagination($this->t['categoryid']);
			$this->t['ordering']		= $model->getOrdering();
			$this->t['layouttype']		= $model->getLayoutType();

			$this->t['layouttypeactive'] 	=
PhocacartRenderFront::setActiveLayoutType($this->t['layouttype']);
			$this->t['columns_cat'] 		=
$this->t['layouttype'] == 'grid' ?
$this->t['columns_cat'] : 1;
			$this->t['action']				= $uri->toString();
			//$this->t['actionbase64']		=
base64_encode(htmlspecialchars($this->t['action']));
			$this->t['actionbase64']		=
base64_encode($this->t['action']);
			$this->t['linkcheckout']		=
JRoute::_(PhocacartRoute::getCheckoutRoute(0,
(int)$this->t['categoryid']));
			$this->t['linkcomparison']		=
JRoute::_(PhocacartRoute::getComparisonRoute(0,
(int)$this->t['categoryid']));
			$this->t['linkwishlist']		=
JRoute::_(PhocacartRoute::getWishListRoute(0,
(int)$this->t['categoryid']));
			$this->t['limitstarturl'] 		=
$this->t['limitstart'] > 0 ?
'&start='.$this->t['limitstart'] :
'';


			$this->t['class_row_flex']              =
$this->p->get('equal_height', 1)  == 1 ?
'ph-row-flex' : '';
        	$this->t['class_fade_in_action_icons']  =
$this->p->get('fade_in_action_icons', 0)  == 1 ?
'b-thumbnail' : '';
        	$this->t['class_lazyload']       		=
$this->t['lazy_load_category_items']  == 1 ?
'ph-lazyload' : '';

			$media = PhocacartRenderMedia::getInstance('main');
			$media->loadBase();
			$media->loadChosen();
			$media->loadProductHover();

			PhocacartRenderJs::renderAjaxAddToCart();
			//PhocacartRenderJs::renderAjaxUpdateCart();// used only in POS
			PhocacartRenderJs::renderAjaxAddToCompare();
			PhocacartRenderJs::renderAjaxAddToWishList();
			// Moved to JS
PhocacartRenderJs::renderSubmitPaginationTopForm($this->t['action'],
'#phItemsBox');

			if((int)$this->t['category_askquestion'] > 0) {
				PhocacartRenderJs::renderAjaxAskAQuestion();
				if ($this->t['popup_askquestion'] == 1) {
					$media->loadWindowPopup();
				}
			}




			$touchSpinJs = $media->loadTouchSpin('quantity',
$this->s['i']);
			$media->loadPhocaSwapImage($this->t['dynamic_change_image']);


			if ($this->t['hide_attributes_category'] == 0) {
				$media->loadPhocaAttribute(1);
				$media->loadPhocaAttributeRequired(1); // Some of the attribute can
be required and can be a image checkbox
			}

			/*if ($this->t['dynamic_change_price'] == 1) {
				PhocacartRenderJs::renderAjaxChangeProductPriceByOptions(0,
'Category', 'ph-category-price-box');// We need to load
it here
			}
			if ($this->t['dynamic_change_stock'] == 1) {
				PhocacartRenderJs::renderAjaxChangeProductStockByOptions(0,
'Category', 'ph-item-stock-box');
			}*/

		/*	if ($this->t['dynamic_change_id'] == 1 ||
$this->t['dynamic_change_price'] == 1 ||
$this->t['dynamic_change_stock'] == 1) {
				PhocacartRenderJs::renderAjaxChangeProductDataByOptions((int)$this->item[0]->id,
'Category', 'ph-category-data-box');
			}*/

			// CHANGE PRICE FOR ITEM QUICK VIEW
			if ($this->t['display_quickview'] == 1 ||
$this->t['category_addtocart'] == 104) {
				PhocacartRenderJs::renderAjaxQuickViewBox();

				// CHANGE PRICE FOR ITEM QUICK VIEW
				/*if ($this->t['dynamic_change_price'] == 1) {
					PhocacartRenderJs::renderAjaxChangeProductPriceByOptions(0,
'ItemQuick', 'ph-item-price-box');// We need to load it
here
				}
				if ($this->t['dynamic_change_stock'] == 1) {
					PhocacartRenderJs::renderAjaxChangeProductStockByOptions(0,
'ItemQuick', 'ph-item-stock-box');
				}*/

			/*	if ($this->t['dynamic_change_id'] == 1 ||
$this->t['dynamic_change_price'] == 1 ||
$this->t['dynamic_change_stock'] == 1) {
					PhocacartRenderJs::renderAjaxChangeProductDataByOptions(0,
'ItemQuick', 'ph-item-data-box');
				}*/


				$media->loadPhocaAttribute(1);// We need to load it here
				$media->loadPhocaSwapImage($this->t['dynamic_change_image']);//
We need to load it here in ITEM (QUICK VIEW) VIEW
			}



			$media->loadPhocaMoveImage($this->t['switch_image_category_items']);//
Move (switch) images in CATEGORY, ITEMS VIEW

			$media->loadSpec();

			$this->_prepareDocument();
			$this->t['pathcat'] =
PhocacartPath::getPath('categoryimage');
			$this->t['pathitem'] =
PhocacartPath::getPath('productimage');

			$model->hit((int)$this->t['categoryid']);

			// Plugins ------------------------------------------
			JPluginHelper::importPlugin('pcv');
			//$this->t['dispatcher']	= J
EventDispatcher::getInstance();
			$this->t['event']		= new stdClass;
			$results =
\JFactory::getApplication()->triggerEvent('PCVonCategoryBeforeHeader',
array('com_phocacart.category', &$this->items,
&$this->p));
			$this->t['event']->onCategoryBeforeHeader =
trim(implode("\n", $results));
			// Foreach values are rendered in default foreaches

			// Layout plugins - completely new layout including foreach
			$this->t['pluginlayout']        = false;
			if ($this->t['category_layout_plugin'] != '') {
				$this->t['category_layout_plugin']     =
PhocacartText::filterValue($this->t['category_layout_plugin'],
'alphanumeric2');
				$this->t['pluginlayout'] 	        	=
JPluginHelper::importPlugin('pcl',
$this->t['category_layout_plugin']);
			}
			if ($this->t['pluginlayout']) {
				$this->t['show_switch_layout_type'] = 0;
			}
			// END Plugins --------------------------------------

			parent::display($tpl);


			echo $media->returnLazyLoad();// Render all bottom scripts // Must be
loaded bottom because of ignoring async in Firefox

		}
	}


	protected function _prepareDocument() {
		$category = false;
		if (isset($this->category[0]) &&
is_object($this->category[0])) {
			$category = $this->category[0];
		}
		PhocacartRenderFront::prepareDocument($this->document, $this->p,
$category);
	}
}
?>
views/category/view.raw.php000064400000024326151167552070012011
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');
jimport( 'joomla.filesystem.folder' );
jimport( 'joomla.filesystem.file' );

class PhocaCartViewCategory extends JViewLegacy
{
	protected $category;
	protected $subcategories;
	protected $items;
	protected $t;
	protected $r;
	protected $p;
	protected $s;

	function display($tpl = null) {

		$app						= JFactory::getApplication();
		$this->p 					= $app->getParams();
		$this->s					= PhocacartRenderStyle::getStyles();
		$uri 						= \Joomla\CMS\Uri\Uri::getInstance();
		$model						= $this->getModel();
		$document					= JFactory::getDocument();
		$this->t['categoryid']		= $app->input->get(
'id', 0, 'int' );
		$this->t['limitstart']		= $app->input->get(
'limitstart', 0, 'int' );
		$this->t['ajax'] 			= 1;



		// PARAMS
		$this->t['view']					= 'category';
		$this->t['category_layout_plugin']	= $this->p->get(
'category_layout_plugin', '');
		$this->t['display_new']				= $this->p->get(
'display_new', 0 );
		$this->t['cart_metakey'] 			= $this->p->get(
'cart_metakey', '' );
		$this->t['cart_metadesc'] 			= $this->p->get(
'cart_metadesc', '' );
		//$this->t['description']			= $this->p->get(
'description', '' );
		$this->t['cv_display_description']	= $this->p->get(
'cv_display_description', 1 );
		$this->t['image_width_cat']			= $this->p->get(
'image_width_cat', '' );
		$this->t['image_height_cat']		= $this->p->get(
'image_height_cat', '' );
		//$this->t['image_link']			= $this->p->get(
'image_link', 0 );
		$this->t['columns_cat']				= $this->p->get(
'columns_cat', 3 );
		$this->t['columns_subcat_cat']		= $this->p->get(
'columns_subcat_cat', 3 );
		$this->t['enable_social']			= $this->p->get(
'enable_social', 0 );
		$this->t['cv_display_subcategories']= $this->p->get(
'cv_display_subcategories', 5 );
		$this->t['display_back']			= $this->p->get(
'display_back', 3 );
		$this->t['display_compare']			= $this->p->get(
'display_compare', 0 );
		$this->t['display_wishlist']		= $this->p->get(
'display_wishlist', 0 );
		$this->t['display_quickview']		= $this->p->get(
'display_quickview', 0 );
		$this->t['display_addtocart_icon']	= $this->p->get(
'display_addtocart_icon', 0 );
		$this->t['fade_in_action_icons']	= $this->p->get(
'fade_in_action_icons', 0 );

		// Hide action icon box if no icon displayed
		$this->t['display_action_icons'] = 1;
		if ($this->t['display_compare'] == 0 &&
$this->t['display_wishlist'] == 0 &&
$this->t['display_quickview'] == 0 &&
$this->t['display_addtocart_icon'] == 0) {
			$this->t['display_action_icons'] = 0;
		}

		$this->t['category_addtocart']			= $this->p->get(
'category_addtocart', 1 );
		$this->t['dynamic_change_image']		= $this->p->get(
'dynamic_change_image', 0);
		$this->t['dynamic_change_price']		= $this->p->get(
'dynamic_change_price', 0 );
		$this->t['dynamic_change_stock']		= $this->p->get(
'dynamic_change_stock', 0 );
		$this->t['remove_select_option_attribute']=
$this->p->get( 'remove_select_option_attribute', 1 );
		$this->t['add_compare_method']			= $this->p->get(
'add_compare_method', 0 );
		$this->t['add_wishlist_method']			= $this->p->get(
'add_wishlist_method', 0 );
		$this->t['display_addtocart']			= $this->p->get(
'display_addtocart', 1 );
		$this->t['display_star_rating']			= $this->p->get(
'display_star_rating', 0 );
		$this->t['add_cart_method']				= $this->p->get(
'add_cart_method', 0 );
		$this->t['hide_attributes_category']	= $this->p->get(
'hide_attributes_category', 1 );
		$this->t['hide_attributes']				= $this->p->get(
'hide_attributes', 0 );
		$this->t['display_stock_status']		= $this->p->get(
'display_stock_status', 1 );
		$this->t['hide_add_to_cart_stock']		= $this->p->get(
'hide_add_to_cart_stock', 0 );
		$this->t['zero_attribute_price']		= $this->p->get(
'zero_attribute_price', 1 );
		$this->t['hide_add_to_cart_zero_price']	=
$this->p->get( 'hide_add_to_cart_zero_price', 0 );
		$this->t['cv_subcategories_layout']		= $this->p->get(
'cv_subcategories_layout', 1 );
		$this->t['category_askquestion']	 	= $this->p->get(
'category_askquestion', 0 );
		$this->t['popup_askquestion']		    = $this->p->get(
'popup_askquestion', 1 );
		$this->t['display_products_all_subcategories'] =
$this->p->get('display_products_all_subcategories', 0);


		// Rights or catalogue options --------------------------------
		$rights								= new PhocacartAccessRights();
		$this->t['can_display_price']		=
$rights->canDisplayPrice();
		$this->t['can_display_addtocart']	=
$rights->canDisplayAddtocart();
		$this->t['can_display_attributes']	=
$rights->canDisplayAttributes();

		if (!$this->t['can_display_addtocart']) {
			$this->t['category_addtocart']		= 0;
			$this->t['display_addtocart_icon'] 	= 0;
			//$this->t['hide_attributes_category']= 1; Should be
displayed or not?
		}
		if (!$this->t['can_display_attributes']) {
			$this->t['hide_attributes_category'] = 1;
		}
		// ------------------------------------------------------------

		$this->t['display_view_product_button']	=
$this->p->get( 'display_view_product_button', 1 );
		$this->t['product_name_link']			= $this->p->get(
'product_name_link', 0 );
		$this->t['switch_image_category_items']	=
$this->p->get( 'switch_image_category_items', 0 );

		$this->t['lazy_load_category_items']	= $this->p->get(
'lazy_load_category_items', 0 );
		$this->t['lazy_load_categories']		= $this->p->get(
'lazy_load_categories', 0 );// Subcategories
		$this->t['medium_image_width']			= $this->p->get(
'medium_image_width', 300 );
		$this->t['medium_image_height']			= $this->p->get(
'medium_image_height', 200 );
		$this->t['display_webp_images']			= $this->p->get(
'display_webp_images', 0 );
		$this->t['category_display_labels']		= $this->p->get(
'category_display_labels', 2 );
		$this->t['category_display_tags']		= $this->p->get(
'category_display_tags', 0 );
		$this->t['category_display_manufacturer']		=
$this->p->get( 'category_display_manufacturer', 0 );
		$this->t['manufacturer_alias']			= $this->p->get(
'manufacturer_alias', 'manufacturer');
		$this->t['manufacturer_alias']			=
$this->t['manufacturer_alias'] != '' ?
trim(PhocacartText::filterValue($this->t['manufacturer_alias'],
'alphanumeric'))  : 'manufacturer';

		$this->t['show_pagination'] 			=
$this->p->get('show_pagination');
		$this->t['show_pagination_top'] 		=
$this->p->get('show_pagination_top', 1);
		$this->t['display_item_ordering'] 		=
$this->p->get('display_item_ordering');
		$this->t['display_item_ordering_top'] 	=
$this->p->get('display_item_ordering_top', 1);
		$this->t['show_pagination_limit'] 		=
$this->p->get('show_pagination_limit');
		$this->t['show_pagination_limit_top'] 	=
$this->p->get('show_pagination_limit_top', 1);
		$this->t['ajax_pagination_category'] 	=
$this->p->get('ajax_pagination_category', 0);
		$this->t['display_pagination_labels'] 	=
$this->p->get('display_pagination_labels', 1);
		$this->t['show_switch_layout_type'] 	=
$this->p->get('show_switch_layout_type', 1);

		$this->category						=
$model->getCategory($this->t['categoryid']);

		if (empty($this->category)) {
			echo '<div class="alert
alert-error">'.JText::_('COM_PHOCACART_NO_CATEGORY_FOUND').'</div>';
		} else {
			$this->subcategories		=
$model->getSubcategories($this->t['categoryid']);
			$this->items				=
$model->getItemList($this->t['categoryid']);
			$this->t['pagination']		=
$model->getPagination($this->t['categoryid']);
			$this->t['ordering']		= $model->getOrdering();
			$this->t['layouttype']		= $model->getLayoutType();

			$this->t['layouttypeactive'] 	=
PhocacartRenderFront::setActiveLayoutType($this->t['layouttype']);
			$this->t['columns_cat'] 		=
$this->t['layouttype'] == 'grid' ?
$this->t['columns_cat'] : 1;


			$uri->delVar('format');// !!! REMOVE format parameter
because return url needs to go to standard html
			$this->t['action']			= $uri->toString();
			//$this->t['actionbase64']	=
base64_encode(htmlspecialchars($this->t['action']));
			$this->t['actionbase64']	=
base64_encode($this->t['action']);
			$this->t['linkcheckout']	=
JRoute::_(PhocacartRoute::getCheckoutRoute(0,
(int)$this->t['categoryid']));
			$this->t['linkcomparison']	=
JRoute::_(PhocacartRoute::getComparisonRoute(0,
(int)$this->t['categoryid']));
			$this->t['linkwishlist']	=
JRoute::_(PhocacartRoute::getWishListRoute(0,
(int)$this->t['categoryid']));
			$this->t['limitstarturl'] 	=
$this->t['limitstart'] > 0 ?
'&start='.$this->t['limitstart'] :
'';
			$this->t['pathcat'] 		=
PhocacartPath::getPath('categoryimage');
			$this->t['pathitem'] 		=
PhocacartPath::getPath('productimage');


			$this->t['class_row_flex']              =
$this->p->get('equal_height', 1)  == 1 ?
'ph-row-flex' : '';
        	$this->t['class_fade_in_action_icons']  =
$this->p->get('fade_in_action_icons', 0)  == 1 ?
'b-thumbnail' : '';
        	$this->t['class_lazyload']       		=
$this->t['lazy_load_category_items']  == 1 ?
'ph-lazyload' : '';


			$model->hit((int)$this->t['categoryid']);

			// Plugins ------------------------------------------
			JPluginHelper::importPlugin('pcv');
			//$this->t['dispatcher']	= J
EventDispatcher::getInstance();
			$this->t['event']		= new stdClass;
			$results =
\JFactory::getApplication()->triggerEvent('PCVonCategoryBeforeHeader',
array('com_phocacart.category', &$this->items,
&$this->p));
			$this->t['event']->onCategoryBeforeHeader =
trim(implode("\n", $results));
			// Foreach values are rendered in default foreaches

			// Layout plugins - completely new layout including foreach
			$this->t['pluginlayout']        = false;
			if ($this->t['category_layout_plugin'] != '') {
				$this->t['category_layout_plugin']     =
PhocacartText::filterValue($this->t['category_layout_plugin'],
'alphanumeric2');
				$this->t['pluginlayout'] 	        	=
JPluginHelper::importPlugin('pcl',
$this->t['category_layout_plugin']);
			}
			if ($this->t['pluginlayout']) {
				$this->t['show_switch_layout_type'] = 0;
			}
			// END Plugins --------------------------------------

			parent::display($tpl);
		}

	}
}
?>
views/checkout/index.html000064400000000054151167552070011513
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/checkout/metadata.xml000064400000000275151167552070012025
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view title="COM_PHOCACART_CHECKOUT_GROUP">
		<message>
			<![CDATA[COM_PHOCACART_CHECKOUT_GROUP_DESC]]>
		</message>
	</view>
</metadata>views/checkout/tmpl/default.php000064400000005161151167552070012633
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
echo '<div id="ph-pc-checkout-box"
class="pc-checkout-view'.$this->p->get(
'pageclass_sfx' ).'">';

echo
PhocacartRenderFront::renderHeader(array(JText::_('COM_PHOCACART_CHECKOUT')));

if ( isset($this->t['checkout_desc']) &&
$this->t['checkout_desc'] != '') {
	// Checkout description
	echo '<div class="ph-desc">'.
$this->t['checkout_desc']. '</div>';
}



echo $this->loadTemplate('cart');
echo $this->t['event']->onCheckoutAfterCart;

// Coupon form before login
if ($this->t['enable_coupons'] > 0 &&
$this->t['display_apply_coupon_form'] == 2) {
	if ($this->t['enable_coupons'] == 1) {
		// Display for all
		echo $this->loadTemplate('coupon');
	} else if ($this->t['enable_coupons'] == 2 &&
($this->a->login == 1 || $this->a->login == 2)){
		// Display for logged in user or guest checkout started
		echo $this->loadTemplate('coupon');
	}
}

// Reward points form before login
if ($this->t['enable_rewards'] > 0 &&
$this->t['display_apply_reward_points_form'] == 2) {
	echo $this->loadTemplate('rewardpoints');
}

echo $this->loadTemplate('login');
echo $this->t['event']->onCheckoutAfterLogin;

// Coupon form after login or
// Coupon form after login but user needs to be logged in or guest checkout
is on
if ($this->t['enable_coupons'] > 0 &&
$this->t['display_apply_coupon_form'] == 3) {
	if ($this->t['enable_coupons'] == 1) {
		// Display for all
		echo $this->loadTemplate('coupon');
	} else if ($this->t['enable_coupons'] == 2 &&
($this->a->login == 1 || $this->a->login == 2)){
		// Display for logged in user or guest checkout started
		echo $this->loadTemplate('coupon');
	}
}

// Reward points form after login
if ($this->t['enable_rewards'] > 0 &&
$this->t['display_apply_reward_points_form'] == 3) {
	echo $this->loadTemplate('rewardpoints');
}

echo $this->loadTemplate('address');
echo $this->t['event']->onCheckoutAfterAddress;
echo $this->loadTemplate('shipping');
echo $this->t['event']->onCheckoutAfterShipping;
echo $this->loadTemplate('payment');
echo $this->t['event']->onCheckoutAfterPayment;
echo $this->loadTemplate('confirm');
echo $this->t['event']->onCheckoutAfterConfirm;



echo '</div>';// end ph-pc-checkout-box

echo '<div id="phContainer"></div>';

echo '<div>&nbsp;</div>';
echo PhocacartUtilsInfo::getInfo();
?>
views/checkout/tmpl/default.xml000064400000000724151167552070012644
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_PHOCACART_CHECKOUT_LAYOUT">
		<message>
			<![CDATA[COM_PHOCACART_CHECKOUT_LAYOUT_DESC]]>
		</message>
	</layout>
	
	<name>COM_PHOCACART_CHECKOUT_LAYOUT</name>
		<description>COM_PHOCACART_CHECKOUT_LAYOUT_DESC</description>
	<fields name="request">
		<fieldset name="request"
addfieldpath="/administrator/components/com_phocacart/models/fields">
		</fieldset>
	</fields>

</metadata>views/checkout/tmpl/default_address.php000064400000014672151167552070014347
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

$layoutI 		= new JLayoutFile('icon_checkout_status', null,
array('component' => 'com_phocacart'));
$d				= array();
$d['s']			= $this->s;
$d['suffix']	= $this->t['icon_suffix'];
$d['number']	= $this->t['na'];
$d['type']		= $this->t['checkout_icon_status'];

if ($this->a->addressedit == 1) {

	$d['status']	= 'pending';


	echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-row">';

	// Header
	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-checkout-box-header"
id="phcheckoutaddressedit">'.$layoutI->render($d).'<h3>'.$this->t['na'].'.
'.JText::_('COM_PHOCACART_BILLING_AND_SHIPPING_ADDRESS').'</h3></div>';
	echo '</div>';

	echo '<form
action="'.$this->t['linkcheckout'].'"
method="post"
class="'.$this->s['c']['form-horizontal.form-validate'].'"
role="form" id="phCheckoutAddress">';
	echo '<div id="ph-request-message"
style="display:none"></div>';

	// Body
	echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-action">';

	echo '<div
class="'.$this->s['c']['col.xs12.sm6.md6'].'
ph-checkout-billing-row" id="phBillingAddress" >';
	if ($this->t['dataaddressform']['b'] !=
'') {
		echo '<div
class="ph-box-header">'.JText::_('COM_PHOCACART_BILLING_ADDRESS').'</div>';
		echo $this->t['dataaddressform']['b'];
	}
	echo '</div>';// end row

	echo '<div
class="'.$this->s['c']['col.xs12.sm6.md6'].'
ph-checkout-shipping-row" id="phShippingAddress"
>';
	if ($this->t['dataaddressform']['s'] !=
'') {
		echo '<div
class="ph-box-header">'.JText::_('COM_PHOCACART_SHIPPING_ADDRESS').'</div>';
		echo $this->t['dataaddressform']['s'];
	}
	echo '</div>';// end row

	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'">';
	echo '<div
class="'.$this->s['c']['pull-right'].'
ph-checkout-check-box">';
	if ($this->t['dataaddressform']['s'] !=
'' &&
$this->t['$delivery_billing_same_enabled'] != -1) {
		echo '<div class="checkbox">';
		echo '<label><input type="checkbox"
id="phCheckoutBillingSameAsShipping"
name="phcheckoutbsas"
'.$this->t['dataaddressform']['bsch'].'
>
'.JText::_('COM_PHOCACART_DELIVERY_AND_BILLING_ADDRESSES_ARE_THE_SAME').'</label>';
		echo '</div>';
	}
	echo '</div>';
	echo '</div>';


	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'">';
	echo '<div
class="'.$this->s['c']['pull-right'].'
ph-checkout-address-save">';
	echo '<button
class="'.$this->s['c']['btn.btn-primary.btn-sm'].'"><span
class="'.$this->s['i']['save'].'"></span>
'.JText::_('COM_PHOCACART_SAVE').'</button>';
	//echo '<input type="submit" value="submit"
/>';
	echo '</div>';
	echo '</div>';


	echo '</div>'."\n";// end
ph-checkout-box-action


	echo '<input type="hidden" name="tmpl"
value="component" />'. "\n";
	echo '<input type="hidden" name="option"
value="com_phocacart" />'. "\n";
	echo '<input type="hidden" name="task"
value="checkout.saveaddress" />'. "\n";
	echo '<input type="hidden" name="return"
value="'.$this->t['actionbase64'].'"
/>'. "\n";
	echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
	echo '</form>'. "\n";

} else if ($this->a->addressview == 1){

	$d['status']	= 'finished';
	// User completed all items in the form

	// Header
	echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-row">';

	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-checkout-box-header" 
id="phcheckoutaddressview">'.$layoutI->render($d).'<h3>'.$this->t['na'].'.
'.JText::_('COM_PHOCACART_BILLING_AND_SHIPPING_ADDRESS').'</h3></div>';
	echo '</div>';
	// end Header

	echo '<form
action="'.$this->t['linkcheckout'].'"
method="post"
class="'.$this->s['c']['form-horizontal.form-validate'].'"
role="form" id="phCheckoutAddress">';
	echo '<div id="ph-request-message"
style="display:none"></div>';

	// Body
	echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-action">';
	if (isset($this->t['dataaddressoutput']['bsch'])
&& $this->t['dataaddressoutput']['bsch'] ==
1) {

		echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-checkout-billing-row"  >';
		echo '<div
class="ph-box-header">'.JText::_('COM_PHOCACART_BILLING_AND_SHIPPING_ADDRESS').'</div>';
		echo $this->t['dataaddressoutput']['b'];
		echo '</div>';// end row

		//echo '<div class="col-sm-6 col-md-6
ph-checkout-shipping-row" >';
		//echo '<div
class="ph-box-header">'.JText::_('COM_PHOCACART_SHIPPING_ADDRESS').'</div>';
		//echo
JText::_('COM_PHOCACART_BILLING_AND_SHIPPING_ADDRESS_IS_THE_SAME');
		//echo '</div>';

	} else {

		echo '<div
class="'.$this->s['c']['col.xs12.sm6.md6'].'
ph-checkout-billing-row"  >';
		if ($this->t['dataaddressoutput']['b'] !=
'') {
			echo '<div
class="ph-box-header">'.JText::_('COM_PHOCACART_BILLING_ADDRESS').'</div>';
			echo $this->t['dataaddressoutput']['b'];
		}
		echo '</div>';// end row

		echo '<div
class="'.$this->s['c']['col.xs12.sm6.md6'].'
ph-checkout-shipping-row" >';
		if ($this->t['dataaddressoutput']['s'] !=
'') {
			echo '<div
class="ph-box-header">'.JText::_('COM_PHOCACART_SHIPPING_ADDRESS').'</div>';
			echo $this->t['dataaddressoutput']['s'];
		}
		echo '</div>';
	}


	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'">';
	echo '<div
class="'.$this->s['c']['pull-right'].'
ph-checkout-address-edit">';
	echo '<button
class="'.$this->s['c']['btn.btn-success.btn-sm'].'
ph-btn"><span
class="'.$this->s['i']['edit'].'"></span>
'.JText::_('COM_PHOCACART_EDIT_ADDRESS').'</button>';
	echo '</div>';
	echo '</div>';


	echo '</div>'; // end ph-checkout-box-action




	echo '<input type="hidden" name="addressedit"
value="1" />';
	echo '<input type="hidden" name="option"
value="com_phocacart" />'. "\n";
	//echo '<input type="hidden" name="task"
value="checkout.editaddress" />'. "\n";
	//echo '<input type="hidden" name="return"
value="'.$this->t['actionbase64'].'"
/>'. "\n";
	echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
	echo '</form>'. "\n";

} else {

	$d['status']	= 'pending';

	echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-row">';
	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-checkout-box-header-pas">'.$layoutI->render($d).'<h3>'.$this->t['na'].'.
'.JText::_('COM_PHOCACART_BILLING_AND_SHIPPING_ADDRESS').'</h3></div>';
	echo '</div>';
}
?>
views/checkout/tmpl/default_cart.php000064400000000720151167552070013640
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

echo '<div class="phCheckoutCartBox"
id="phCheckoutCartBox">';
echo $this->t['cartoutput'];
echo '</div>';
?>views/checkout/tmpl/default_confirm.php000064400000013133151167552070014346
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

$layoutPC 	= new JLayoutFile('form_privacy_checkbox', null,
array('component' => 'com_phocacart'));
$layoutNC 	= new JLayoutFile('form_newsletter_checkbox', null,
array('component' => 'com_phocacart'));

if ($this->a->confirm == 1) {


	if ($this->t['stock_checking'] == 1 &&
$this->t['stock_checkout'] == 1 &&
$this->t['stockvalid'] == 0) {
		// Header
		echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-row" id="phcheckoutconfirmedit" >';
		echo '<div class="alert
alert-error">'.JText::_('COM_PHOCACART_PRODUCTS_NOT_AVAILABLE_IN_QUANTITY_OR_NOT_IN_STOCK_UPDATE_QUANTITY_BEFORE_ORDERING').'</div>';
		echo '</div>';

	} else if ($this->t['minqtyvalid'] == 0 ||
$this->t['minmultipleqtyvalid'] == 0) {
		// Header
		if ($this->t['minqtyvalid'] == 0) {
			echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-row" >';
			echo '<div class="alert
alert-error">'.JText::_('COM_PHOCACART_MINIMUM_ORDER_QUANTITY_OF_ONE_OR_MORE_PRODUCTS_NOT_MET_UPDATE_QUANTITY_BEFORE_ORDERING').'</div>';
			echo '</div>';
		}

		if ($this->t['minmultipleqtyvalid'] == 0) {
			echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-row" >';
			echo '<div class="alert
alert-error">'.JText::_('COM_PHOCACART_MINIMUM_MULTIPLE_ORDER_QUANTITY_OF_ONE_OR_MORE_PRODUCTS_NOT_MET_UPDATE_QUANTITY_BEFORE_ORDERING').'</div>';
			echo '</div>';
		}

	} else {
		// Header
		echo '<div
class="ph-checkout-confirm-box-row">';


		echo '<form
action="'.$this->t['linkcheckout'].'"
method="post"
class="'.$this->s['c']['form-horizontal.form-validate'].'"
role="form" id="phCheckoutAddress">';

		echo '<div
class="ph-checkout-box-action-raw">';

		echo '<div id="ph-request-message"
style="display:none"></div>';

		echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-row" >';
		echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-checkout-confirm-row" id="phConfirm" >';
		echo '<div
class="ph-box-header">'.JText::_('COM_PHOCACART_NOTES_AND_REQUESTS_ABOUT_ORDER').'</div>';
		echo '<textarea class="form-control"
name="phcomment" rows="3"></textarea>';
		echo '</div>';
		echo '</div>';


		echo '<div class="ph-cb"></div>';

		if ($this->t['enable_captcha_checkout']) {
			echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-row">';

			echo '<div class="control-group">';

			echo '<div class="control-label">';
			echo '<label id="jform_question_captcha-lbl"
for="jform_question_captcha" class="hasPopover
required" title=""
data-content="'.JText::_('COM_PHOCACART_PLEASE_PROVE_THAT_YOU_ARE_HUMAN').'"
data-original-title="'.JText::_('COM_PHOCACART_SECURITY_CHECK').'">'.JText::_('COM_PHOCACART_SECURITY_CHECK').'<span
class="star">&nbsp;*</span></label>';
			echo '</div>';

			echo '<div
class="controls">'.PhocacartCaptchaRecaptcha::render().'</div>';

			echo '</div>';// end group

			echo '</div>';// end col

			echo '<div class="ph-cb"></div>';
		}


		echo '<div
class="ph-checkout-confirm-box-row-checkboxes">';

		if ($this->t['display_checkout_toc_checkbox'] > 0) {

			$d					= array();
			$d['s']			    = $this->s;
			$d['label_text']	=
$this->t['terms_conditions_label_text'];
			$d['id']			= 'phCheckoutConfirmTermsConditions';
			$d['name']			= 'phcheckouttac';
			$d['class']			= 'ph-pull-right checkbox
ph-checkout-checkbox-confirm';
			$d['display']		=
$this->t['display_checkout_toc_checkbox'];

			echo '<div class="ph-cb"></div>';
			echo $layoutPC->render($d);
		}


		if ($this->t['display_checkout_privacy_checkbox'] > 0) {

			$d					= array();
			$d['s']			    = $this->s;
			$d['label_text']	=
$this->t['checkout_privacy_checkbox_label_text'];
			$d['id']			= 'phCheckoutPrivacyCheckbox';
			$d['name']			= 'privacy';
			$d['class']			= 'ph-pull-right checkbox
ph-checkout-checkbox-confirm';
			$d['display']		=
$this->t['display_checkout_privacy_checkbox'];

			echo '<div class="ph-cb"></div>';
			echo $layoutPC->render($d);
		}

		if ($this->t['display_checkout_newsletter_checkbox'] > 0)
{

			$d					= array();
			$d['s']			    = $this->s;
			$d['label_text']	=
$this->t['checkout_newsletter_checkbox_label_text'];
			$d['id']			= 'phCheckoutNewsletterCheckbox';
			$d['name']			= 'newsletter';
			$d['class']			= 'ph-pull-right checkbox
ph-checkout-checkbox-confirm';
			$d['display']		=
$this->t['display_checkout_newsletter_checkbox'];

			echo '<div class="ph-cb"></div>';
			echo $layoutNC->render($d);
		}

		echo '<div class="ph-cb"></div>';

		echo '<div
class="'.$this->s['c']['pull-right'].'
ph-checkout-confirm">';
		echo '<button
class="'.$this->s['c']['btn.btn-default.btn-sm'].'
ph-btn"><span
class="'.$this->s['i']['ok'].'"></span>
'.$this->t['confirm_order_text'].'</button>';
		echo '</div>';

		echo '<div class="ph-cb"></div>';


		echo '</div>';// end

		echo '</div>'."\n";// end
ph-checkout-box-action-raw

		echo '<input type="hidden" name="task"
value="checkout.order" />'. "\n";
		echo '<input type="hidden" name="tmpl"
value="component" />';
		echo '<input type="hidden" name="option"
value="com_phocacart" />'. "\n";
		echo '<input type="hidden" name="return"
value="'.$this->t['actionbase64'].'"
/>'. "\n";
		echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
		echo '</form>'. "\n";


		echo '</div>';// end ph-checkout-confirm-box-row


	}

} else {

}
?>
views/checkout/tmpl/default_coupon.php000064400000004727151167552070014225
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

if ($this->t['enable_coupons'] > 0 &&
!$this->t['cartempty']) {


	echo '<div id="ph-request-message"
style="display:none"></div>';

	echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-apply-coupon">';

	echo '<div class="' .
$this->s['c']['col.xs12.sm12.md12'] .
'">';

	echo '<form
action="'.$this->t['linkcheckout'].'"
method="post" class="form-inline
'.$this->s['c']['form-horizontal.form-validate'].'"
role="form" id="phCheckoutCoupon">';
	echo '<div class="' .
$this->s['c']['form-group'] .
'">';

	if ($this->t['couponcodevalue'] != '') {
		// REMOVE COUPON
		echo '<input type="hidden" name="phcoupon"
value="" />'. "\n";
		// Make the following input only a design input without name and value -
the value for removing is set as empty in hidden field
		// name="phcouponremove" is abstract - not used, named to be
ignored when saving form but displayed including the coupon code
		echo '<input
class="'.$this->s['c']['form-control'].'
ph-input-sm ph-input-apply-coupon" type="text"
name="phcouponremove" id="phcoupon" value="'
. $this->t['couponcodevalue'] . '" >';
		echo '<button class="' .
$this->s['c']['btn.btn-primary'] . '
ph-btn"><span class="' .
$this->s['i']['remove'] .
'"></span> ' .
JText::_('COM_PHOCACART_REMOVE_COUPON') .
'</button>';
	} else {
		// ADD COUPON
		echo '<input
class="'.$this->s['c']['form-control'].'
ph-input-sm ph-input-apply-coupon" type="text"
name="phcoupon" id="phcoupon" value="' .
$this->t['couponcodevalue'] . '" >';
		echo '<button class="' .
$this->s['c']['btn.btn-primary'] . '
ph-btn"><span class="' .
$this->s['i']['save'] .
'"></span> ' .
JText::_('COM_PHOCACART_APPLY_COUPON') .
'</button>';
	}

	echo '<input type="hidden" name="task"
value="checkout.savecoupon" />'. "\n";
	echo '<input type="hidden" name="tmpl"
value="component" />';
	echo '<input type="hidden" name="option"
value="com_phocacart" />'. "\n";
	echo '<input type="hidden" name="return"
value="'.$this->t['actionbase64'].'"
/>'. "\n";
	echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
	echo '</form>'. "\n";

	echo '</div>';
	echo '</div>';

	echo '</div>' . "\n";// end box action



}

?>
views/checkout/tmpl/default_login.php000064400000012331151167552070014020
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

$layoutI 		= new JLayoutFile('icon_checkout_status', null,
array('component' => 'com_phocacart'));
$layoutUL 		= new JLayoutFile('user_login', null,
array('component' => 'com_phocacart'));
$layoutUR 		= new JLayoutFile('user_register', null,
array('component' => 'com_phocacart'));
$d				= array();
$d['s']			= $this->s;
$d['suffix']	= $this->t['icon_suffix'];
$d['number']	= $this->t['nl'];
$d['type']		= $this->t['checkout_icon_status'];

if($this->a->login == 0) {

	$d['status']	= 'pending';

	/*require_once
JPATH_SITE.'/components/com_users/helpers/route.php';
	jimport( 'joomla.application.module.helper' );
	$module = JModuleHelper::getModule('mod_login');
	$mP 	= new JRegistry();
	$mP->loadString($module->params);*/

	$lang = JFactory::getLanguage();
	$lang->load('mod_login');

	echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-row" >';
	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-checkout-box-header"
id="phcheckoutloginedit">'.$layoutI->render($d).'<h3>'.$this->t['nl'].'.
'.JText::_('COM_PHOCACART_LOGIN_REGISTER').'</h3></div>';
	echo '</div>';


	echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-action">';

	echo '<div
class="'.$this->s['c']['col.xs12.sm8.md8'].'
ph-right-border">';

	$d = array();
	$d['s'] = $this->s;
	$d['t'] = $this->t;
	echo $layoutUL->render($d);

	echo '</div>'. "\n";// end
checkout_login_row_item_login


	echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'
ph-left-border">';

	$d = array();
	$d['s'] = $this->s;
	$d['t'] = $this->t;
	echo $layoutUR->render($d);



	if ($this->t['guest_checkout'] == 1) {
		echo '<div
class="ph-box-header">'.JText::_('COM_PHOCACART_GUEST_CHECKOUT').'</div>'.
"\n";

		echo '<form
action="'.$this->t['linkcheckout'].'"
method="post"
class="'.$this->s['c']['form-horizontal.form-validate'].'"
role="form" id="phCheckoutAddGuest">';
		echo '<button type="submit" tabindex="0"
name="Submit"
class="'.$this->s['c']['btn.btn-primary.btn-sm'].'
ph-btn ph-checkout-btn-login"><span
class="'.$this->s['i']['user'].'"></span>
'. JText::_('COM_PHOCACART_GUEST_CHECKOUT')
.'</button>'. "\n";

		echo '<input type="hidden" name="option"
value="com_phocacart" />'. "\n";
		echo '<input type="hidden" name="task"
value="checkout.setguest" />'. "\n";
		echo '<input type="hidden" name="id"
value="1" />'. "\n";
		echo '<input type="hidden" name="return"
value="'.$this->t['actionbase64'].'"
/>'. "\n";
		echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
		echo '</form>';

	}


	echo '</div>'. "\n";// end
checkout_login_row_item_register

	echo '</div>'. "\n";// ph-checkout-box-action


} else if($this->a->login == 1) {

	$d['status']	= 'finished';

	echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-row" >';
	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-checkout-box-header"
id="phcheckoutloginview">'.$layoutI->render($d).'<h3>'.$this->t['nl'].'.
'.JText::_('COM_PHOCACART_LOGIN_REGISTER').'</h3></div>';
	echo '</div>';


	echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-action">';
	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'">';
	echo
'<div>'.JText::_('COM_PHOCACART_YOU_ARE_LOGGED_IN_AS').'
<b>'.$this->u->name.'</b></div>';
	echo '</div>';
	echo '</div>';

} else if($this->a->login == 2) {

	$d['status']	= 'finished';

	echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-row" >';
	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-checkout-box-header">'.$layoutI->render($d).'<h3>'.$this->t['nl'].'.
'.JText::_('COM_PHOCACART_GUEST_CHECKOUT').'</h3></div>';
	echo '</div>';


	echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-action">';
	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'">';

	echo '<form
action="'.$this->t['linkcheckout'].'"
method="post"
class="'.$this->s['c']['form-horizontal.form-validate'].'"
role="form" id="phCheckoutAddGuest">';

	echo
'<div>'.JText::_('COM_PHOCACART_GUEST_CHECKOUT')
. '</div>';


	if ($this->t['guest_checkout'] == 1 &&
$this->t['guest_checkout_auto_enable'] == 1) {
		// Automatic guest checkout cannot be cancelled
	} else {
		echo '<div
class="'.$this->s['c']['pull-right'].'">';
		echo '<button type="submit" tabindex="0"
name="Submit"
class="'.$this->s['c']['btn.btn-primary.btn-sm'].'
ph-btn ph-checkout-btn-login"><span
class="'.$this->s['i']['user'].'"></span>
'. JText::_('COM_PHOCACART_CANCEL_GUEST_CHECKOUT')
.'</button>';
		echo '</div>'. "\n";
	}



	//echo '<div class="ph-cb"></div>';

	echo '<input type="hidden" name="option"
value="com_phocacart" />'. "\n";
	echo '<input type="hidden" name="task"
value="checkout.setguest" />'. "\n";
	echo '<input type="hidden" name="id"
value="0" />'. "\n";
	echo '<input type="hidden" name="return"
value="'.$this->t['actionbase64'].'"
/>'. "\n";
	echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
	echo '</form>';

	echo '</div>';
	echo '</div>';
}
?>
views/checkout/tmpl/default_payment.php000064400000024310151167552070014365
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

$layoutI 		= new JLayoutFile('icon_checkout_status', null,
array('component' => 'com_phocacart'));
$d				= array();
$d['s']			= $this->s;
$d['suffix']	= $this->t['icon_suffix'];
$d['number']	= $this->t['np'];
$d['type']		= $this->t['checkout_icon_status'];

if ($this->a->paymentnotused == 1) {

	// Payment not used

// PAYMENT ADDED
} else if ($this->a->paymentview == 1) {

	$d['status']	= 'finished';
	// Payment is added and goes to confirm
	// ONLY DISPLAY - pamyent method was added and user don't want to
edit it

	// Header
	echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-row" >';

	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-checkout-box-header"
id="phcheckoutpaymentview">'.$layoutI->render($d).'<h3>'.$this->t['np'].'.
'.JText::_('COM_PHOCACART_PAYMENT_OPTIONS').'</h3></div>';
	echo '</div>';


	echo '<form
action="'.$this->t['linkcheckout'].'"
method="post"
class="'.$this->s['c']['form-horizontal.form-validate'].'"
role="form" id="phCheckoutAddress">';
	echo '<div id="ph-request-message"
style="display:none"></div>';

	// Body
	echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-action">';

	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-checkout-payment-row" id="phPaymentMethods" >';
	echo '<div
class="ph-box-header">'.JText::_('COM_PHOCACART_PAYMENT_METHODS').'</div>';
	echo '</div>';

	if (isset($this->t['paymentmethod']) &&
isset($this->t['paymentmethod']['title']) &&
$this->t['paymentmethod']['title'] != '')
{

		//echo '<div
class="'.$this->s['c']['row'].'">';
		echo '<div
class="'.$this->s['c']['col.xs12.sm8.md8'].'">';

		if (isset($this->t['paymentmethod']['image'])
&& $this->t['paymentmethod']['image'] !=
'') {
			echo '<div class="ph-payment-image"><img
src="'.JURI::base(true) .'/'.
$this->t['paymentmethod']['image'].'"
alt="'.htmlspecialchars(strip_tags($this->t['paymentmethod']['title'])).'"
/></div>';
		}

		echo '<div
class="ph-payment-title">'.$this->t['paymentmethod']['title'].'</div>';

		if ($this->t['display_payment_desc'] &&
$this->t['paymentmethod']['description'] !=
'') {
			echo '<div
class="ph-checkout-payment-desc">'.Joomla\CMS\HTML\HTMLHelper::_('content.prepare',
$this->t['paymentmethod']['description']).'</div>';
		}

		echo '</div>';

		echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'">';
		if ($this->a->paymentdisplayeditbutton) {
            echo '<div
class="'.$this->s['c']['pull-right'].'
ph-checkout-payment-edit">';
            echo '<button
class="'.$this->s['c']['btn.btn-success.btn-sm'].'
ph-btn"><span class="' .
$this->s['i']['edit'] .
'"></span> ' .
JText::_('COM_PHOCACART_EDIT_PAYMENT') .
'</button>';
            echo '</div>';
        }
		echo '</div>';
		//echo '</div>'; // end checkout_payment_row_display

	}
	//echo '<div class="ph-cb"></div>';
	echo '</div>';// end Body
	//echo '<div
class="ph-cb"></div>'."\n";// end row
action

	//echo '</div>'."\n";// end box action

	echo '<input type="hidden" name="paymentedit"
value="1" />';
	//echo '<input type="hidden" name="tmpl"
value="component" />';
	echo '<input type="hidden" name="option"
value="com_phocacart" />'. "\n";
	echo '<input type="hidden" name="return"
value="'.$this->t['actionbase64'].'"
/>'. "\n";
	echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
	echo '</form>'. "\n";
    //echo '</div>';// end checkout box row

// PAYMENT EDIT
} else if ($this->a->paymentedit == 1) {

	$d['status']	= 'pending';
	$total			= $this->cart->getTotal();
	$price			= new PhocacartPrice();

	// Paymnet is not added or we edit it but payment is added, we can edit
	echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-row" >';

	// Header
	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-checkout-box-header"
id="phcheckoutpaymentedit">'.$layoutI->render($d).'<h3>'.$this->t['np'].'.
'.JText::_('COM_PHOCACART_PAYMENT_OPTIONS').'</h3></div>';
	echo '</div>';

	echo '<form
action="'.$this->t['linkcheckout'].'"
method="post"
class="'.$this->s['c']['form-horizontal.form-validate'].'"
role="form" id="phCheckoutPayment">';
	echo '<div id="ph-request-message"
style="display:none"></div>';


	echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-action">';

	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-checkout-payment-row" id="phPaymentMethods" >';
	echo '<div
class="ph-box-header">'.JText::_('COM_PHOCACART_PAYMENT_METHODS').'</div>';
	echo '</div>';

	//echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-shipping-cost-box">';

	foreach($this->t['paymentmethods'] as $k => $v) {


		$checked = '';
		if (isset($v->selected) && $v->selected == 1 ) {
			$checked = 'checked="checked"';
		}

		$priceI = $price->getPriceItemsPayment($v->cost,
$v->cost_additional, $v->calculation_type, $total[0], $v->taxid,
$v->taxrate, $v->taxcalculationtype, $v->taxtitle, 0, 1);

		echo '<div
class="'.$this->s['c']['col.xs12.sm6.md6'].'">';
		echo '<div class="radio">';
		echo '<label><input type="radio"
name="phpaymentopt"
id="phpaymentopt'.$v->id.'"
value="'.$v->id.'" '.$checked.'
>';


		if ($v->image != '') {
			echo '<span class="ph-payment-image"><img
src="'.JURI::base(true) .'/'. $v->image.'"
alt="'.htmlspecialchars(strip_tags($v->title)).'"
/></span>';
		}

		echo '<span
class="ph-payment-title">'.$v->title.'</span>';
		echo '</label>';
		echo '</div>';



		if ($this->t['display_payment_desc'] &&
$v->description != '') {
			echo '<div
class="ph-checkout-payment-desc">'.Joomla\CMS\HTML\HTMLHelper::_('content.prepare',
$v->description).'</div>';
		}

		echo '</div>';

		echo '<div
class="'.$this->s['c']['col.xs12.sm6.md6'].'">';
		echo '<div class="radio">';

		echo '<div
class="'.$this->s['c']['row'].'">';
		if ($this->t['zero_payment_price'] == 0 &&
$priceI['zero'] == 1) {
			// Display blank price field
		} else if ($this->t['zero_payment_price'] == 2 &&
$priceI['zero'] == 1) {
			// Display free text
			echo '<div
class="'.$this->s['c']['col.xs12.sm8.md8'].'
ph-checkout-payment-free-txt"></div>';
			echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'
ph-checkout-payment-free">'.JText::_('COM_PHOCACART_FREE').'</div>';
		} else {

			if ($priceI['nettoformat'] ==
$priceI['bruttoformat']) {

			} else if ($priceI['nettoformat'] != '') {
				echo '<div
class="'.$this->s['c']['col.xs12.sm8.md8'].'
ph-checkout-payment-netto-txt">'.$priceI['nettotxt'].'</div>';
				echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'
ph-checkout-payment-netto">'.$priceI['nettoformat'].'</div>';
			}

			if ($priceI['taxformat'] != '') {
				echo '<div
class="'.$this->s['c']['col.xs12.sm8.md8'].'
ph-checkout-payment-tax-txt">'.$priceI['taxtxt'].'</div>';
				echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'
ph-checkout-payment-tax">'.$priceI['taxformat'].'</div>';
			}

			if ($priceI['bruttoformat'] != '') {
				echo '<div
class="'.$this->s['c']['col.xs12.sm8.md8'].'
ph-checkout-payment-brutto-txt">'.$priceI['bruttotxt'].'</div>';
				echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'
ph-checkout-payment-brutto">'.$priceI['bruttoformat'].'</div>';
			}

			if ($priceI['costinfo'] != '') {
				// Possible variables:
				// $priceI['costinfoprice'] ... raw price without price
additional
				// $priceI['costinfopriceadditional'] ... raw additional
price
				echo '<div
class="'.$this->s['c']['col.xs12.sm8.md8'].'
ph-checkout-payment-cost-info-txt"></div>';
				echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'
ph-right
ph-checkout-payment-cost-info">'.$priceI['costinfo'].'</div>';

			}
		}

		echo '</div>';// end row

		echo '</div>';// end radio

		echo '</div>';// end row second column
		echo '<div class="ph-cb"></div>';

	}

	//echo '<div class="ph-cb"></div>';

	// COUPON CODE
	if ($this->t['enable_coupons'] > 0 &&
$this->t['display_apply_coupon_form'] == 1) {
		echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'">';
		echo
'<label>'.JText::_('COM_PHOCACART_COUPON_CODE').
'
<small>('.JText::_('COM_PHOCACART_APPLY_COUPON_CODE').')</small><br
/><input type="text" name="phcoupon"
id="phcoupon"
value="'.$this->t['couponcodevalue'].'"
></label>';
		echo '</div>';
		//echo '<div class="ph-cb"></div>';
	}

	// REWARD POINTS
	if ($this->t['rewards']['apply'] &&
$this->t['display_apply_reward_points_form'] == 1) {

		echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'">';
		echo
'<label>'.JText::_('COM_PHOCACART_REWARD_POINTS').'
'.$this->t['rewards']['text'].'<br
/><input type="text" name="phreward"
id="phreward"
value="'.$this->t['rewards']['usedvalue'].'"
></label>';
		echo '</div>';
		//echo '<div class="ph-cb"></div>';
	}

	//echo '</div>';// end payment cost box
	//echo '</div>';// end payment row

	//echo '<div class="ph-cb"></div>';

	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'">';
	echo '<div
class="'.$this->s['c']['pull-right'].'
ph-checkout-payment-save">';
	echo '<button
class="'.$this->s['c']['btn.btn-primary.btn-sm'].'
ph-btn"><span
class="'.$this->s['i']['save'].'"></span>
'.JText::_('COM_PHOCACART_SAVE').'</button>';
	echo '</div>';
	echo '</div>';

	//echo '<div class="ph-cb"></div>';
	echo '</div>'."\n";// end box action

	echo '<input type="hidden" name="task"
value="checkout.savepayment" />'. "\n";
	echo '<input type="hidden" name="tmpl"
value="component" />';
	echo '<input type="hidden" name="option"
value="com_phocacart" />'. "\n";
	echo '<input type="hidden" name="return"
value="'.$this->t['actionbase64'].'"
/>'. "\n";
	echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
	echo '</form>'. "\n";

// PAYMENT NOT ADDED OR SHIPPING IS EDITED OR ADDRESS IS EDITED
} else {

	$d['status']	= 'pending';

	echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-row">';
	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-checkout-box-header-pas">'.$layoutI->render($d).'<h3>'.$this->t['np'].'.
'.JText::_('COM_PHOCACART_PAYMENT_OPTIONS').'</h3></div>';
	echo '</div>';
}
?>
views/checkout/tmpl/default_proceedpayment.php000064400000000674151167552070015736
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */ 
defined('_JEXEC') or die();
if ($this->a->proceedpayment == 1) {
	
	echo "proceed payment";
	
// PAYMENT ADDED
}
?>views/checkout/tmpl/default_rewardpoints.php000064400000004124151167552070015432
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

if ($this->t['rewards']['apply'] &&
!$this->t['cartempty']) {


	echo '<div id="ph-request-message"
style="display:none"></div>';

	echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-reward-points">';

	echo '<div class="' .
$this->s['c']['col.xs12.sm12.md12'] .
'">';

	echo '<form
action="'.$this->t['linkcheckout'].'"
method="post" class="form-inline
'.$this->s['c']['form-horizontal.form-validate'].'"
role="form" id="phCheckoutRewardPoints">';
	echo '<div class="' .
$this->s['c']['form-group'] .
'">';

	echo '<input
class="'.$this->s['c']['form-control'].'
ph-input-sm ph-input-apply-reward-points" type="text"
name="phreward" id="phreward"
value="'.$this->t['rewards']['usedvalue'].'"
>';

	if ($this->t['rewards']['usedvalue'] !=
'') {
		echo '<button class="' .
$this->s['c']['btn.btn-primary'] . '
ph-btn"><span class="' .
$this->s['i']['edit'] .
'"></span> ' .
JText::_('COM_PHOCACART_CHANGE_REWARD_POINTS') .
'</button>';
	} else {
		echo '<button class="' .
$this->s['c']['btn.btn-primary'] . '
ph-btn"><span class="' .
$this->s['i']['save'] .
'"></span> ' .
JText::_('COM_PHOCACART_APPLY_REWARD_POINTS') .
'</button>';
	}


	echo '<input type="hidden" name="task"
value="checkout.saverewardpoints" />'. "\n";
	echo '<input type="hidden" name="tmpl"
value="component" />';
	echo '<input type="hidden" name="option"
value="com_phocacart" />'. "\n";
	echo '<input type="hidden" name="return"
value="'.$this->t['actionbase64'].'"
/>'. "\n";
	echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
	echo '</form>'. "\n";

	echo '</div>';

	echo '<div class="' .
$this->s['c']['col.xs12.sm12.md12'] .
'">';
	echo $this->t['rewards']['text'];
	echo '</div>';

	echo '</div>';

	echo '</div>' . "\n";// end box action



}

?>
views/checkout/tmpl/default_shipping.php000064400000030500151167552070014527
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */

use Joomla\CMS\Factory;

defined('_JEXEC') or die();

$layoutI 		= new JLayoutFile('icon_checkout_status', null,
array('component' => 'com_phocacart'));
$d				= array();
$d['s']			= $this->s;
$d['suffix']	= $this->t['icon_suffix'];
$d['number']	= $this->t['ns'];
$d['type']		= $this->t['checkout_icon_status'];

$price	= new PhocacartPrice();

if ($this->a->shippingnotused == 1) {

	// Shipping not used

// ONLY DISPLAY - shipping method was added and user don't want to
edit it
} else if ($this->a->shippingview) {

	$d['status']	= 'finished';

	// Header
	echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-row" >';
	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-checkout-box-header"
id="phcheckoutshippingview">'.$layoutI->render($d).'<h3>'.$this->t['ns'].'.
'.JText::_('COM_PHOCACART_SHIPPING_OPTIONS').'</h3></div>';
	echo '</div>';


	echo '<form
action="'.$this->t['linkcheckout'].'"
method="post"
class="'.$this->s['c']['form-horizontal.form-validate'].'"
role="form" id="phCheckoutAddress">';
	echo '<div id="ph-request-message"
style="display:none"></div>';

	// Body
	echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-action">';

	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-checkout-shipping-row" id="phShippingMethods"
>';
	echo '<div
class="ph-box-header">'.JText::_('COM_PHOCACART_SHIPPING_METHODS').'</div>';
	echo '</div>';


	/*foreach($this->t['shippingmethods'] as $k => $v) {

		// Display the current one selected
		if (isset($this->t['cartitems']['shipping'])
&& (int)$this->t['cartitems']['shipping'] ==
(int)$v->id) {

			//$priceI = $price->getPriceItems($v->cost, $v->taxid,
$v->taxrate, $v->taxcalculationtype, $v->taxtitle, 1, 1);

			echo '<div class="col-sm-8 col-md-8
">'.$v->title.'</div>';

			echo '<div class="col-sm-4 col-md-4">';
		/*
			if (isset($priceI['netto']) &&
$priceI['netto'] != '' &&
isset($priceI['nettotxt']) &&
$priceI['nettotxt'] != '') {
				//echo '<div class="col-sm-6
col-md-6"></div>';
				echo '<div class="col-sm-8
col-md-8">'.$priceI['nettotxt'].'</div>';
				echo '<div class="col-sm-4 col-md-4
ph-checkout-shipping-netto">'.$priceI['netto'].'</div>';
			}

			if (isset($priceI['tax']) && $priceI['tax']
!= '' && isset($priceI['taxtxt']) &&
$priceI['taxtxt'] != '') {
				//echo '<div class="col-sm-6
col-md-6"></div>';
				echo '<div class="col-sm-8
col-md-8">'.$priceI['taxtxt'].'</div>';
				echo '<div class="col-sm-4 col-md-4
ph-checkout-shipping-tax">'.$priceI['tax'].'</div>';
			}

			if (isset($priceI['brutto']) &&
$priceI['brutto'] != '' &&
isset($priceI['bruttotxt']) &&
$priceI['bruttotxt'] != '') {
				//echo '<div class="col-sm-6
col-md-6"></div>';
				echo '<div class="col-sm-8
col-md-8">'.$priceI['bruttotxt'].'</div>';
				echo '<div class="col-sm-4 col-md-4
ph-checkout-shipping-brutto">'.$priceI['brutto'].'</div>';
			}*/
			/*echo '</div>';
			echo '<div
class="ph-cb">&nbsp;</div>';
		}
	}
	echo '</div>';// end shipping cost box
	echo '<div class="ph-cb"></div>';*/



	if (isset($this->t['shippingmethod']) &&
isset($this->t['shippingmethod']['title'])
&& $this->t['shippingmethod']['title'] !=
'') {

		//echo '<div
class="'.$this->s['c']['row'].'">';
		echo '<div
class="'.$this->s['c']['col.xs12.sm8.md8'].'">';

		if (isset($this->t['shippingmethod']['image'])
&& $this->t['shippingmethod']['image'] !=
'') {
			echo '<div class="ph-shipping-image"><img
src="'.JURI::base(true) .'/'.
$this->t['shippingmethod']['image'].'"
alt="'.htmlspecialchars(strip_tags($this->t['shippingmethod']['title'])).'"
/></div>';
		}

		echo '<div
class="ph-shipping-title">'.$this->t['shippingmethod']['title'].'</div>';

		// Event
		if (isset($this->t['shippingmethod']['method'])
&& $this->t['shippingmethod']['method'] !=
'') {

			JPluginHelper::importPlugin('pcs',
htmlspecialchars(strip_tags($this->t['shippingmethod']['method'])));
			$eventData 					= array();
			$eventData['pluginname'] 	=
htmlspecialchars(strip_tags($this->t['shippingmethod']['method']));


			$results =
Factory::getApplication()->triggerEvent('PCSgetShippingBrancheInfo',
array('com_phocacart.checkout',
$this->t['shippingmethod'], $eventData));

			if (!empty($results)) {
				echo trim(implode("\n", $results));
			}
			/*
			// INSTRUCTINS: test the plugin in event this way:

			protected $name 	= 'plugin_name';

			function PCSgetShippingBrancheInfo($context, $shippingMethod,
$eventData) {
				if (!isset($eventData['pluginname']) ||
isset($eventData['pluginname']) &&
$eventData['pluginname'] != $this->name) {
					return false;
				}
			}
			*/

		}


		if ($this->t['display_shipping_desc'] &&
$this->t['shippingmethod']['description'] !=
'') {
			echo '<div
class="ph-checkout-shipping-desc">'.Joomla\CMS\HTML\HTMLHelper::_('content.prepare',
$this->t['shippingmethod']['description']).'</div>';
		}

		echo '</div>';

		echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'">';
        if ($this->a->shippingdisplayeditbutton) {
            echo '<div
class="'.$this->s['c']['pull-right'].'
ph-checkout-shipping-edit">';
            echo '<button
class="'.$this->s['c']['btn.btn-success.btn-sm'].'
ph-btn"><span class="' .
$this->s['i']['edit'] .
'"></span> ' .
JText::_('COM_PHOCACART_EDIT_SHIPPING') .
'</button>';
            echo '</div>';
        }
		echo '</div>';
        //echo '</div>'; // end
checkout_shipping_row_display

	}
	//echo '<div class="ph-cb"></div>';
	echo '</div>';// end Body
	//echo '<div
class="ph-cb"></div>'."\n";// end row
action

	//echo '</div>'."\n";// end box action

	echo '<input type="hidden" name="shippingedit"
value="1" />';
	//echo '<input type="hidden" name="tmpl"
value="component" />';
	echo '<input type="hidden" name="option"
value="com_phocacart" />'. "\n";
	echo '<input type="hidden" name="return"
value="'.$this->t['actionbase64'].'"
/>'. "\n";
	echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
	echo '</form>'. "\n";
	//echo '</div>';// end checkout box row

// ADD OR EDIT - user didn't add the shipping yet or user wants to
edit it now
} else if ($this->a->shippingedit == 1)  {

	$d['status']	= 'pending';
	$total			= $this->cart->getTotal();
	$price			= new PhocacartPrice();


	echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-row" >';

	// Header
	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-checkout-box-header"
id="phcheckoutshippingedit">'.$layoutI->render($d).'<h3>'.$this->t['ns'].'.
'.JText::_('COM_PHOCACART_SHIPPING_OPTIONS').'</h3></div>';
	echo '</div>';


	echo '<form
action="'.$this->t['linkcheckout'].'"
method="post"
class="'.$this->s['c']['form-horizontal.form-validate'].'"
role="form" id="phCheckoutAddress">';
	echo '<div id="ph-request-message"
style="display:none"></div>';


	echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-action">';

	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-checkout-shipping-row" id="phShippingMethods"
>';
	echo '<div
class="ph-box-header">'.JText::_('COM_PHOCACART_SHIPPING_METHODS').'</div>';
	echo '</div>';


	//echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-shipping-cost-box">';

	foreach($this->t['shippingmethods'] as $k => $v) {


		$checked = '';
		if (isset($v->selected) && $v->selected == 1 ) {
			$checked = 'checked="checked"';
		}

		$priceI = $price->getPriceItemsShipping($v->cost,
$v->cost_additional, $v->calculation_type, $total[0], $v->taxid,
$v->taxrate, $v->taxcalculationtype, $v->taxtitle, 0, 1);

		echo '<div
class="'.$this->s['c']['col.xs12.sm6.md6'].'">';

		echo '<div class="radio">';
		echo '<label><input type="radio"
name="phshippingopt"
id="phshippingopt'.$v->id.'"
value="'.$v->id.'" '.$checked.'
>';


		if ($v->image != '') {
			echo '<span class="ph-shipping-image"><img
src="'.JURI::base(true) .'/'. $v->image.'"
alt="'.htmlspecialchars(strip_tags($v->title)).'"
/></span>';
		}

		echo '<span
class="ph-shipping-title">'.$v->title.'</span>';
		echo '</label>';
		echo '</div>';

		// Event
		if (isset($v->method) && $v->method != '') {

			JPluginHelper::importPlugin('pcs',
htmlspecialchars(strip_tags($v->method)));
			$eventData 					= array();
			$eventData['pluginname'] 	=
htmlspecialchars(strip_tags($v->method));

			$results =
Factory::getApplication()->triggerEvent('PCSgetShippingBranches',
array('com_phocacart.checkout', $v, $eventData));

			if (!empty($results)) {
				echo trim(implode("\n", $results));
			}
		}

		if ($this->t['display_shipping_desc'] &&
$v->description != '') {
			echo '<div
class="ph-checkout-shipping-desc">'.Joomla\CMS\HTML\HTMLHelper::_('content.prepare',
$v->description).'</div>';
		}
		echo '</div>';

		echo '<div
class="'.$this->s['c']['col.xs12.sm6.md6'].'">';
		echo '<div class="radio">';

		echo '<div
class="'.$this->s['c']['row'].'">';
		if ($this->t['zero_shipping_price'] == 0 &&
$priceI['zero'] == 1) {
			// Display blank price field
		} else if ($this->t['zero_shipping_price'] == 2 &&
$priceI['zero'] == 1) {
			// Display free text
			echo '<div
class="'.$this->s['c']['col.xs12.sm8.md8'].'
ph-checkout-shipping-free-txt"></div>';
			echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'
ph-checkout-shipping-free">'.JText::_('COM_PHOCACART_FREE').'</div>';
		} else {
			if ($priceI['nettoformat'] ==
$priceI['bruttoformat']) {

			} else if ($priceI['nettoformat'] != '') {
				echo '<div
class="'.$this->s['c']['col.xs12.sm8.md8'].'
ph-checkout-shipping-netto-txt">'.$priceI['nettotxt'].'</div>';
				echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'
ph-checkout-shipping-netto">'.$priceI['nettoformat'].'</div>';
			}

			if ($priceI['taxformat'] != '') {
				echo '<div
class="'.$this->s['c']['col.xs12.sm8.md8'].'
ph-checkout-shipping-tax-txt">'.$priceI['taxtxt'].'</div>';
				echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'
ph-checkout-shipping-tax">'.$priceI['taxformat'].'</div>';
			}

			if ($priceI['bruttoformat'] != '') {
				echo '<div
class="'.$this->s['c']['col.xs12.sm8.md8'].'
ph-checkout-shipping-brutto-txt">'.$priceI['bruttotxt'].'</div>';
				echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'
ph-checkout-shipping-brutto">'.$priceI['bruttoformat'].'</div>';
			}

			if ($priceI['costinfo'] != '') {
				// Possible variables:
				// $priceI['costinfoprice'] ... raw price without price
additional
				// $priceI['costinfopriceadditional'] ... raw additional
price
				echo '<div
class="'.$this->s['c']['col.xs12.sm8.md8'].'
ph-checkout-payment-cost-info-txt"></div>';
				echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'
ph-right
ph-checkout-payment-cost-info">'.$priceI['costinfo'].'</div>';

			}
		}

		echo '</div>';// end row

		echo '</div>';// end radio

		echo '</div>';// end row second column
		echo '<div class="ph-cb"></div>';

	}

	//echo '<div class="ph-cb"></div>';

	//echo '</div>';// end shipping cost box
	//echo '</div>';// end shipping row

	//echo '<div class="ph-cb"></div>';

	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'">';
	echo '<div
class="'.$this->s['c']['pull-right'].'
ph-checkout-shipping-save">';
	echo '<button
class="'.$this->s['c']['btn.btn-primary.btn-sm'].'
ph-btn"><span
class="'.$this->s['i']['save'].'"></span>
'.JText::_('COM_PHOCACART_SAVE').'</button>';
	echo '</div>';
	echo '</div>';

	//echo '<div class="ph-cb"></div>';

	echo '</div>'."\n";// end box action

	echo '<input type="hidden" name="task"
value="checkout.saveshipping" />'. "\n";
	echo '<input type="hidden" name="tmpl"
value="component" />';
	echo '<input type="hidden" name="option"
value="com_phocacart" />'. "\n";
	echo '<input type="hidden" name="return"
value="'.$this->t['actionbase64'].'"
/>'. "\n";
	echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
	echo '</form>'. "\n";


}  else {



	$d['status']	= 'pending';

	echo '<div
class="'.$this->s['c']['row'].'
ph-checkout-box-row" >';
	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-checkout-box-header-pas">'.$layoutI->render($d).'<h3>'.$this->t['ns'].'.
'.JText::_('COM_PHOCACART_SHIPPING_OPTIONS').'</h3></div>';
	echo '</div>';
}



?>
views/checkout/tmpl/index.html000064400000000054151167552070012467
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/checkout/view.html.php000064400000101730151167552070012147
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license   http://www.gnu.org/copyleft/gpl.html GNU/GPL, see
LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license   http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport('joomla.application.component.view');

class PhocaCartViewCheckout extends JViewLegacy
{
    protected $t;
    protected $r;
    protected $p;
    protected $u;
    protected $gu;
    protected $item;
    protected $data;  // address data for output
    protected $form;  // address data for form
    protected $fields;// fields loaded for data and form to check if
required fields are filled out
    protected $cart;
    protected $s;
    protected $a;

    function display($tpl = null) {


        $document = JFactory::getDocument();
        $app      = JFactory::getApplication();
        $uri      = \Joomla\CMS\Uri\Uri::getInstance();
        $this->u  = PhocacartUser::getUser();
        $this->p  = $app->getParams();
        $this->a  = new PhocacartAccess();
        $this->s  = PhocacartRenderStyle::getStyles();
        $guest    = PhocacartUserGuestuser::getGuestUser();
        $reward   = new PhocacartReward();

        $this->t['action']       = $uri->toString();
        $this->t['actionbase64'] =
base64_encode($this->t['action']);
        $this->t['linkcheckout'] =
JRoute::_(PhocacartRoute::getCheckoutRoute());

        $this->t['checkout_desc']              =
$this->p->get('checkout_desc', '');
        $this->t['checkout_desc']              =
PhocacartRenderFront::renderArticle($this->t['checkout_desc']);
        $this->t['stock_checkout']             =
$this->p->get('stock_checkout', 0);
        $this->t['stock_checking']             =
$this->p->get('stock_checking', 0);
        $this->t['guest_checkout']             =
$this->p->get('guest_checkout', 0);
        $this->t['guest_checkout_auto_enable'] =
$this->p->get('guest_checkout_auto_enable', 0);
        $this->t['icon_suffix']                =
$this->p->get('icon_suffix', '-circle');
        $this->t['display_shipping_desc']      =
$this->p->get('display_shipping_desc', 0);
        $this->t['display_payment_desc']       =
$this->p->get('display_payment_desc', 0);
        $this->t['zero_shipping_price']        =
$this->p->get('zero_shipping_price', 1);
        $this->t['zero_payment_price']         =
$this->p->get('zero_payment_price', 1);
        $this->t['checkout_scroll']            =
$this->p->get('checkout_scroll', 1);
        $this->t['enable_coupons']             =
$this->p->get('enable_coupons', 2);
        $this->t['enable_rewards']             =
$this->p->get('enable_rewards', 1);
        $this->t['checkout_icon_status']       =
$this->p->get('checkout_icon_status', 1);
        $this->t['display_webp_images']        =
$this->p->get('display_webp_images', 0);

        $this->t['skip_shipping_method']              =
$this->p->get('skip_shipping_method', 0);
        $this->t['skip_payment_method']               =
$this->p->get('skip_payment_method', 0);
        $this->t['automatic_shipping_method_setting'] =
$this->p->get('automatic_shipping_method_setting', 0);
        $this->t['automatic_payment_method_setting']  =
$this->p->get('automatic_payment_method_setting', 0);
        $this->t['display_apply_coupon_form']         =
$this->p->get('display_apply_coupon_form', 1);
        $this->t['display_apply_reward_points_form']  =
$this->p->get('display_apply_reward_points_form', 1);

        $this->t['$delivery_billing_same_enabled']     =
$this->p->get('delivery_billing_same_enabled', 0);


        // Message set in Openting Times class
        PhocacartTime::checkOpeningTimes();

        // Enable guest checkout automatically
        if ($this->t['guest_checkout'] == 1 &&
$this->t['guest_checkout_auto_enable'] == 1) {
            //$guest	= new PhocacartUserGuestuser();
            //$guest->setGuestUser(1);
            $guest = PhocacartUserGuestuser::setGuestUser(1);
        }


        // Terms and Conditions
        $this->t['display_checkout_toc_checkbox'] =
$this->p->get('display_checkout_toc_checkbox', 2);
        if ($this->t['display_checkout_toc_checkbox'] > 0)
{
            $this->t['terms_conditions_custom_label_text'] =
$this->p->get('terms_conditions_custom_label_text', 0);
            $linkTerms                                     =
JRoute::_(PhocacartRoute::getTermsRoute(0, 0,
'tmpl=component'));
            $defaultText                                   =
JText::_('COM_PHOCACART_I_HAVE_READ_AND_AGREE_TO_THE') . '
<a href="' . $linkTerms . '"
onclick="phWindowPopup(this.href, \'phWindowPopupTerms\', 2,
1.6);return false;" >' .
JText::_('COM_PHOCACART_TERMS_AND_CONDITIONS') .
'</a>';
            $this->t['terms_conditions_label_text']        =
PhocacartRenderFront::renderArticle((int)$this->t['terms_conditions_custom_label_text'],
'html', $defaultText);
        }

        // Checkout Privacy checkbox
        $this->t['display_checkout_privacy_checkbox'] =
$this->p->get('display_checkout_privacy_checkbox', 0);
        if ($this->t['display_checkout_privacy_checkbox'] >
0) {
            $this->t['checkout_privacy_checkbox_label_text'] =
$this->p->get('checkout_privacy_checkbox_label_text', 0);
            $this->t['checkout_privacy_checkbox_label_text'] =
PhocacartRenderFront::renderArticle((int)$this->t['checkout_privacy_checkbox_label_text'],
'html', '');
        }

        // Newsletter
        $this->t['display_checkout_newsletter_checkbox'] =
$this->p->get('display_checkout_newsletter_checkbox', 0);
        if ($this->t['display_checkout_newsletter_checkbox']
> 0) {
           
$this->t['checkout_newsletter_checkbox_label_text'] =
$this->p->get('checkout_newsletter_checkbox_label_text',
0);
           
$this->t['checkout_newsletter_checkbox_label_text'] =
PhocacartRenderFront::renderArticle((int)$this->t['checkout_newsletter_checkbox_label_text'],
'html', '');
        }

        $this->t['enable_captcha_checkout'] =
PhocacartCaptcha::enableCaptchaCheckout();

        $scrollTo = '';


        // Not ready yet
        // Checkout cart can be changed by ajax
        // But not module cart, no shipping, no payment is refreshed, no
plus/minus (touchspin.js) refreshed
        //PhocacartRenderJs::renderAjaxUpdateCart();// used only in POS


        // Cart
        $this->cart = new PhocacartCartRendercheckout();
        $this->cart->setFullItems();


        if ((int)$this->u->id > 0) {
            $this->a->login = 1;
        } else if ($guest) {
            $this->a->login = 2;
        }


        // Shipping and Payment rules will be checked including rounding
        $this->cart->roundTotalAmount();

        // Is there even a shipping or payment (or is active based on
criterias)
        $total = $this->cart->getTotal();
        $sOCh  = array();// Shipping Options Checkout
        // PRODUCTTYPE
        $sOCh['all_digital_products'] =
isset($total[0]['countdigitalproducts']) &&
isset($total[0]['countallproducts']) &&
(int)$total[0]['countdigitalproducts'] ==
$total[0]['countallproducts'] ? 1 : 0;
        $pOCh                         = array();// Payment Options
Checkout

        $pOCh['order_amount_zero'] = 1;
        $pOCh['order_amount_zero'] =
$total[0]['brutto'] == 0 && $total[0]['netto']
== 0 ? 1 : 0;


        $this->a->shippingnotused =
PhocacartShipping::isShippingNotUsed($sOCh);
        $this->a->paymentnotused  =
PhocacartPayment::isPaymentNotUsed($pOCh);


        // COUPONS - Coupon can be added in payment method or below
calculation
        $this->t['couponcodevalue'] = '';
        if ($this->cart->getCouponCode() != '') {
            $this->t['couponcodevalue'] =
$this->cart->getCouponCode();

        }

        // REWARD POINTS - reward points can be added in payment method or
below the calculation
        $this->t['rewards']          = array();
        $this->t['rewards']['apply'] = false;
        if ($this->t['enable_rewards']) {
            if ($this->u->id > 0) {
                $this->t['rewards']['needed']    =
$this->cart->getRewardPointsNeeded();
                $this->t['rewards']['usertotal'] =
$reward->getTotalPointsByUserId($this->u->id);

                $this->t['rewards']['usedvalue'] =
'';
                if ($this->cart->getRewardPointsUsed() !=
'' && (int)$this->cart->getRewardPointsUsed() >
0) {
                    $this->t['rewards']['usedvalue']
= $this->cart->getRewardPointsUsed();
                }

                if ($this->t['rewards']['usertotal']
> 0) {
                    $this->t['rewards']['text']  =
'<small>(' .
JText::_('COM_PHOCACART_AVAILABLE_REWARD_POINTS') . ':
' . (int)$this->t['rewards']['usertotal'] .
', ' .
JText::_('COM_PHOCACART_MAXIMUM_REWARD_POINTS_TO_USE') . ':
' . (int)$this->t['rewards']['needed'] .
')</small>';
                    $this->t['rewards']['apply'] =
true;
                }
            }
        }

        // Numbers
        $this->t['nl'] = 1;                     // Login
        $this->t['na'] = 2;                     // Address
        $this->t['ns'] = 3;                     // Shipping
        $this->t['np'] = 4;                     // Payment
        if ($this->a->shippingnotused == 1) {
            $this->t['np'] = 3;
        }

        if ($this->a->login == 1 || $this->a->login == 2) {

            // =======
            // ADDRESS
            // =======
            $this->t['dataaddressoutput'] = array();

            $this->a->addressedit =
$app->input->get('addressedit', 0, 'int'); //
Edit Address

            // GUEST
            if ($this->a->login == 2) {
                // Check if all form items are filled out by user, if yes,
don't load the form and save some queries
                $this->fields = $this->get('FieldsGuest');
// Fields will be loaded in every case
                if ($this->a->addressedit == 0) {
                    $this->data                   =
$this->get('DataGuest');
                    $this->t['dataaddressoutput'] =
PhocacartUser::getAddressDataOutput($this->data,
$this->fields['array'], $this->u, 1);
                }
                //Some required field is not filled out
                if
(isset($this->t['dataaddressoutput']['filled'])
&& $this->t['dataaddressoutput']['filled']
== 1) {
                    $this->a->addressadded = 1;
                } else {
                    $this->a->addressadded = 0;
                }
                // Load form and fields to edit address
                if ($this->a->addressadded == 0 ||
$this->a->addressedit == 1) {
                    $this->a->addressview       = 0;
                    $this->a->addressedit       = 1;
                    $scrollTo                   =
'phcheckoutaddressedit';
                    $this->form                 =
$this->get('FormGuest');
                    $this->t['dataaddressform'] =
PhocacartUser::getAddressDataForm($this->form,
$this->fields['array'], '', '',
'_phs', 1);
                }
                // REGISTERED
            } else {
                // Check if all form items are filled out by user, if yes,
don't load the form and save some queries
                $this->fields = $this->get('Fields'); //
Fields will be loaded in every case


                if ($this->a->addressedit == 0) {
                    $this->data = $this->get('Data');

                    $this->t['dataaddressoutput'] =
PhocacartUser::getAddressDataOutput($this->data,
$this->fields['array'], $this->u);

                }

                //Some required field is not filled out
                if
(isset($this->t['dataaddressoutput']['filled'])
&& $this->t['dataaddressoutput']['filled']
== 1) {
                    $this->a->addressadded = 1;
                } else {
                    $this->a->addressadded = 0;
                }
                // Load form and fields to edit address
                if ($this->a->addressadded == 0 ||
$this->a->addressedit == 1) {
                    $this->a->addressview       = 0;
                    $this->a->addressedit       = 1;
                    $this->form                 =
$this->get('Form');
                    $this->t['dataaddressform'] =
PhocacartUser::getAddressDataForm($this->form,
$this->fields['array'], $this->u);
                    $scrollTo                   =
'phcheckoutaddressedit';
                }
            }

            if ($this->a->addressadded == 1 &&
$this->a->addressedit == 0) {
                $this->a->addressview = 1;
                $scrollTo             = 'phcheckoutaddressview';
            }


            // ====================
            // SHIPPING
            // ====================
            $shipping              = new PhocacartShipping();
            $country               =
$shipping->getUserCountryShipping($this->t['dataaddressoutput']);
            $region                =
$shipping->getUserRegionShipping($this->t['dataaddressoutput']);
            $zip 	                =
$shipping->getUserZipShipping($this->t['dataaddressoutput']);
            $this->a->shippingadded = 0;
            $this->a->shippingedit =
$app->input->get('shippingedit', 0, 'int'); //
Edit Shipping
            $shippingId            = $this->cart->getShippingId();   
           // Shipping stored in cart or not?


            if (isset($shippingId) && (int)$shippingId > 0
&& $this->a->shippingedit == 0) {
                // Shipping method is stored in cart, we can update the
cart (add shipping costs to whole cart)
                $this->a->shippingadded = 1;
                $this->a->shippingview  = 1;
                $scrollTo               =
'phcheckoutshippingview';
                $this->cart->addShippingCosts($shippingId);
                $this->t['shippingmethod'] =
$this->cart->getShippingCosts();

                // If "automatic_shipping_method_setting" is set
to yes, this means that the shipping method will be set automatically in
case:
                // - there is only one shipping method available or only
one meets the criteria
                // - and the parameter is set to yes
                // It is not possible to edit the method because when
switching to edit, the method will be set automatically as wished by
enabling the parameter
                // and redirect outside the editing mode
                if
($this->t['automatic_shipping_method_setting'] == 1) {
                    //- $shipping					= new PhocacartShipping();
                    $this->t['shippingmethods'] =
$shipping->getPossibleShippingMethods($total[0]['netto'],
$total[0]['brutto'], $total[0]['quantity'], $country,
$region, $zip, $total[0]['weight'],
$total[0]['length'], $total[0]['width'],
$total[0]['height'], 0, $shippingId);
                    if (!empty($this->t['shippingmethods'])
&& count($this->t['shippingmethods']) == 1) {
                        $this->a->shippingdisplayeditbutton = 0;
                    }
                }


                // Shipping method which was selected is not more active -
display edit again
                if ($this->t['shippingmethod'] == 0) {
                    $this->a->shippingadded = 0;
                    $this->a->shippingedit = 1;
                    $shippingId = 0;
                }

            }

            if (($this->a->shippingedit == 1 ||
$this->a->shippingadded == 0) && $this->a->addressadded
== 1 && $this->a->addressedit == 0 &&
$this->a->paymentedit == 0) {
                // Shipping cost is not stored in cart, display possible
shipping methods
                // We ask for total of cart because of amount rule
                $this->a->shippingadded = 0;
                $this->a->shippingview  = 0;
                $this->a->shippingedit  = 1;
                $scrollTo               =
'phcheckoutshippingedit';
                //- $shipping					= new PhocacartShipping();
                //$shipping->setType();
                $total = $this->cart->getTotal();


                $this->t['shippingmethods'] =
$shipping->getPossibleShippingMethods($total[0]['netto'],
$total[0]['brutto'], $total[0]['quantity'], $country,
$region, $zip, $total[0]['weight'],
$total[0]['length'], $total[0]['width'],
$total[0]['height'], 0, $shippingId);//$shippingId = 0 so all
possible shipping methods will be listed


                // If there is only one valid shipping method and it is set
in parameter we can directly store this method so user does not need to add
it
                // When setting the shipping method then the cart needs to
be "refreshed", shipping costs needs to be added and info about
shpping id
                // must be updated because of payment rules (one of payment
rule is shipping)
                if (!empty($this->t['shippingmethods'])
&& count($this->t['shippingmethods']) == 1 &&
$this->t['automatic_shipping_method_setting'] == 1) {
                    if
(isset($this->t['shippingmethods'][0]->id) &&
(int)$this->t['shippingmethods'][0]->id > 0) {

                        $shippingStored = 0;
                        if ($this->a->login == 1 &&
isset($this->u->id) && $this->u->id > 0) {
                            if
($shipping->storeShippingRegistered($this->t['shippingmethods'][0]->id,
$this->u->id)) {
                                $shippingStored = 1;
                            }
                        } else if ($this->a->login == 2) {
                            if
(PhocacartUserGuestuser::storeShipping((int)$this->t['shippingmethods'][0]->id))
{
                                $shippingStored = 1;
                            }
                        }

                        if ($shippingStored == 1) {
                            $shippingId =
(int)$this->t['shippingmethods'][0]->id;// will be used for
payment - updated now
                           
$this->cart->addShippingCosts($shippingId);           // add the
costs to cart so it has updated information

                            $this->t['shippingmethod'] =
$this->cart->getShippingCosts();

                            $this->a->shippingadded             = 1;
                            $this->a->shippingview              = 1;
                            $this->a->shippingedit              = 0;
                            $this->a->shippingdisplayeditbutton = 0;
                            $scrollTo                           =
'phcheckoutpaymentedit';


                        }
                    }
                }


                // No shipping method found even all rules were applied and
shipping methods were searched
                // THIS CASE CAN BE VENDOR ERROR (wrong setting of shipping
methods) OR PURPOSE - be aware when using $skip_shipping_method = 3
                // Skip adding/selecting shipping method and allow customer
proceeding the order? (depends on parameter:
$this->t['skip_shipping_method'])
                // Must be implemented here because now we know information
about total, shipping and address we need for deciding about shipping
method
                // Must cooperate with
administrator/components/com_phocacart/libraries/phocacart/order/order.php
cca 402
                // In this case
$this->t['shippingmethod']['id'] is even null, so we
don't need to ask $shipping->getPossibleShippingMethods for
outcomes with not selected shipping method

                if (empty($this->t['shippingmethods'])
&& $this->t['skip_shipping_method'] == 3) {
                    $this->a->shippingnotused = 1;
                };

            }
            //- }

            // =================
            // PAYMENT (VOUCHER)
            // =================


            $payment = new PhocacartPayment();
            $country =
$payment->getUserCountryPayment($this->t['dataaddressoutput']);
            $region  =
$payment->getUserRegionPayment($this->t['dataaddressoutput']);
            $this->a->paymentadded    = 0;
            $this->a->paymentedit     =
$app->input->get('paymentedit', 0, 'int'); //
Edit Shipping
            $this->t['paymentmethod'] =
$this->cart->getPaymentMethod();
            $paymentMethodId            =
isset($this->t['paymentmethod']['id']) &&
(int)$this->t['paymentmethod']['id'] > 0 ?
(int)$this->t['paymentmethod']['id']: 0;


            if ((int)$paymentMethodId  > 0 &&
$this->a->paymentedit == 0) {
                $this->cart->addPaymentCosts($paymentMethodId);//
validity of payment will be checked
                $this->t['paymentmethod'] =
$this->cart->getPaymentCosts();
                $this->a->paymentadded    = 1;
                $this->a->paymentview     = 1;
                $scrollTo                 =
'phcheckoutpaymentview';


                // If "automatic_payment_method_setting" is set
to yes, this means that the payment method will be set automatically in
case:
                // - there is only one payment method available or only one
meets the criteria
                // - and the parameter is set to yes
                // It is not possible to edit the method because when
switching to edit, the method will be set automatically as wished by
enabling the parameter
                // and redirect outside the editing mode
                if
($this->t['automatic_payment_method_setting'] == 1) {
                    //$payment					= new PhocacartPayment();
                    $shippingId                =
$this->cart->getShippingId();// Shipping stored in cart or not?
                    $this->t['paymentmethods'] =
$payment->getPossiblePaymentMethods($total[0]['netto'],
$total[0]['brutto'], $country, $region, $shippingId, 0,
$paymentMethodId);
                    if (!empty($this->t['paymentmethods'])
&& count($this->t['paymentmethods']) == 1) {
                        $this->a->paymentdisplayeditbutton = 0;
                    }
                }

                // Payment method which was selected is not more active -
display edit again
                if ($this->t['paymentmethod'] == 0) {
                    $paymentMethodId = 0;
                    $this->a->paymentadded  = 0;
                    $this->a->paymentedit = 1;
                }
            }

            if (($this->a->paymentedit == 1 ||
$this->a->paymentadded == 0) && $this->a->addressadded
== 1 && $this->a->addressedit == 0 &&
(($this->a->shippingadded == 1 &&
$this->a->shippingedit == 0) || $this->a->shippingnotused ==
1)) {


                // Payment cost is not stored in cart, display possible
payment methods
                // We ask for total of cart because of amount rule
                $this->a->paymentadded = 0;
                $this->a->paymentview  = 0;
                $this->a->paymentedit  = 1;
                $scrollTo              =
'phcheckoutpaymentedit';
                //$payment					= new PhocacartPayment();
                $shippingId = $this->cart->getShippingId();//
Shipping stored in cart or not?

                $total = $this->cart->getTotal();


                $this->t['paymentmethods'] =
$payment->getPossiblePaymentMethods($total[0]['netto'],
$total[0]['brutto'], $country, $region, $shippingId, 0,
$paymentMethodId);


                // If there is only one valid payment method and it is set
in parameter we can directly store this method so user does not need to add
it
                // When setting the payment method then the cart needs to
be "refreshed", payment costs needs to be added and info about
shpping id
                // must be updated because of payment rules (one of payment
rule is payment)
                if (!empty($this->t['paymentmethods'])
&& count($this->t['paymentmethods']) == 1 &&
$this->t['automatic_payment_method_setting'] == 1) {
                    if
(isset($this->t['paymentmethods'][0]->id) &&
(int)$this->t['paymentmethods'][0]->id > 0) {

                        $paymentStored = 0;
                        if ($this->a->login == 1 &&
isset($this->u->id) && $this->u->id > 0) {
                            if
($payment->storePaymentRegistered($this->t['paymentmethods'][0]->id,
$this->u->id)) {
                                $paymentStored = 1;
                            }
                        } else if ($this->a->login == 2) {
                            if
(PhocacartUserGuestuser::storePayment((int)$this->t['paymentmethods'][0]->id))
{
                                $paymentStored = 1;
                            }
                        }

                        if ($paymentStored == 1) {
                            $paymentId =
(int)$this->t['paymentmethods'][0]->id;// will be used for
payment - updated now
                            $this->cart->addPaymentCosts($paymentId);
          // add the costs to cart so it has updated information //
validity of payment will be checked
                            $this->t['paymentmethod'] =
$this->cart->getPaymentCosts();

                            $this->a->paymentadded             = 1;
                            $this->a->paymentview              = 1;
                            $this->a->paymentedit              = 0;
                            $this->a->paymentdisplayeditbutton = 0;
                            $scrollTo                          =
'phcheckoutpaymentview';
                        }
                    }
                }

                // No payment method found even all rules were applied and
payment methods were searched
                // THIS CASE CAN BE VENDOR ERROR (wrong setting of shipping
methods) OR PURPOSE - be aware when using $skip_shipping_method = 3
                // Skip adding/selecting payment method and allow customer
proceeding the order? (depends on parameter:
$this->t['skip_shipping_method'])
                // Must be implemented here because now we know information
about total, shipping and address we need for deciding about payment
method
                // Must cooperate with
administrator/components/com_phocacart/libraries/phocacart/order/order.php
cca 402
                // In this case
$this->t['paymentmethod']['id'] is even null, so we
don't need to ask $payment->getPossiblePaymentMethods for outcomes
with not selected payment method

                if (empty($this->t['paymentmethods'])
&& $this->t['skip_payment_method'] == 3) {
                    $this->a->paymentnotused = true;
                };


                /*	BOTH COUPON OR REWARD POINTS CAN BE SET BEFORE PAYMENT
                    // COUPON
                    $this->t['couponcodevalue'] =
'';
                    if ($this->cart->getCouponCode() != '')
{
                        $this->t['couponcodevalue'] =
$this->cart->getCouponCode();
                    }

                    // REWARD POINTS
                    $this->t['rewards'] 			= array();
                    $this->t['rewards']['apply'] 	=
false;
                    if ($this->t['enable_rewards']) {
                        if ($this->u->id > 0) {
                           
$this->t['rewards']['needed'] =
$this->cart->getRewardPointsNeeded();
                           
$this->t['rewards']['usertotal'] =
$reward->getTotalPointsByUserId($this->u->id);

                           
$this->t['rewards']['usedvalue'] = '';
                            if ($this->cart->getRewardPointsUsed() !=
'' && (int)$this->cart->getRewardPointsUsed() >
0) {
                               
$this->t['rewards']['usedvalue'] =
$this->cart->getRewardPointsUsed();
                            }

                            if
($this->t['rewards']['usertotal'] > 0) {
                               
$this->t['rewards']['text'] =
'<small>('.JText::_('COM_PHOCACART_AVAILABLE_REWARD_POINTS').':
'.(int)$this->t['rewards']['usertotal'].',
'.JText::_('COM_PHOCACART_MAXIMUM_REWARD_POINTS_TO_USE').':
'.(int)$this->t['rewards']['needed'].')</small>';
                               
$this->t['rewards']['apply'] 	= true;
                            }
                        }
                    }
                */
            }
            //- }

            //- PhocacartRenderJs::renderBillingAndShippingSame();
        }

        //  Rounding set before checking shipping and payment method
        //	$this->cart->roundTotalAmount();


        // CART IS EMPTY - MUST BE CHECKED BEFOR CONFIRM
        // Don't allow to add or edit payment or shipping method,
don't allow to confirm the order
        if (empty($this->cart->getItems())) {
            $this->a->shippingnotused = 1;
            $this->a->paymentnotused  = 1;
            $this->a->confirm         = 0;
        }

        if ($this->a->shippingnotused == 1) {
            $this->a->shippingview = 1;
            if ($scrollTo == 'phcheckoutshippingedit') {
                $scrollTo = '';
            }
        }
        if ($this->a->paymentnotused == 1) {
            $this->a->paymentview = 1;
            if ($scrollTo == 'phcheckoutpaymentedit') {
                $scrollTo = '';
            }
        }


        // VIEW - CONFIRM - all items added
        if (($this->a->login == 1 || $this->a->login == 2)
&& $this->a->addressview == 1 &&
$this->a->shippingview == 1 && $this->a->paymentview ==
1) {
            $this->a->confirm = 1;

            // Custom "Confirm Order" Text
            $total                         =
$this->cart->getTotal();
            $totalBrutto                   =
isset($total[0]['brutto']) ? $total[0]['brutto'] : 0;
            $this->t['confirm_order_text'] =
PhocacartRenderFront::getConfirmOrderText($totalBrutto);
        }


        $media = PhocacartRenderMedia::getInstance('main');
        $media->loadBase();
        $media->loadChosen();
        $media->loadWindowPopup();

        $media->loadTouchSpin('quantity',
$this->s['i']);
        //PhocacartRenderJs::renderAjaxUpdateCart(); used only in POS

        //Scroll to
        if ($this->t['checkout_scroll'] == 0) {
            $scrollTo = '';
        }
        if ($scrollTo == '') {
        } else if ($scrollTo == 'phcheckoutaddressedit' ||
$scrollTo == 'phcheckoutshippingedit' || $scrollTo ==
'phcheckoutpaymentedit') {
            PhocacartRenderJs::renderJsScrollTo($scrollTo, 2);
        } else if ($scrollTo == 'phcheckoutpaymentview') {
            // last view - in fact phcheckoutconfirmedit
            PhocacartRenderJs::renderJsScrollTo($scrollTo, 1);
        } else {
            PhocacartRenderJs::renderJsScrollTo('', 2);
        }


        // Render the cart (here because it can be changed above - shipping
can be added)
        //$total				= $this->cart->getTotal();
        $this->t['cartoutput'] = $this->cart->render();

        $this->t['cartempty'] =
$this->cart->getCartCountItems() > 0 ? false : true;

        $this->t['stockvalid']          =
$this->cart->getStockValid();
        $this->t['minqtyvalid']         =
$this->cart->getMinimumQuantityValid();
        $this->t['minmultipleqtyvalid'] =
$this->cart->getMinimumMultipleQuantityValid();

        $media->loadSpec();

        $this->_prepareDocument();

        // Plugins ------------------------------------------
        $this->t['total'] = $total;
        JPluginHelper::importPlugin('pcv');
        //$this->t['dispatcher']	= J
EventDispatcher::getInstance();
        $this->t['event'] = new stdClass;

        $results                               =
\JFactory::getApplication()->triggerEvent('PCVonCheckoutAfterCart',
array('com_phocacart.checkout', $this->a, &$this->p,
$this->t['total']));
        $this->t['event']->onCheckoutAfterCart =
trim(implode("\n", $results));

        $results                                =
\JFactory::getApplication()->triggerEvent('PCVonCheckoutAfterLogin',
array('com_phocacart.checkout', $this->a, &$this->p,
$this->t['total']));
        $this->t['event']->onCheckoutAfterLogin =
trim(implode("\n", $results));

        $results                                  =
\JFactory::getApplication()->triggerEvent('PCVonCheckoutAfterAddress',
array('com_phocacart.checkout', $this->a, &$this->p,
$this->t['total']));
        $this->t['event']->onCheckoutAfterAddress =
trim(implode("\n", $results));

        $results                                   =
\JFactory::getApplication()->triggerEvent('PCVonCheckoutAfterShipping',
array('com_phocacart.checkout', $this->a, &$this->p,
$this->t['total']));
        $this->t['event']->onCheckoutAfterShipping =
trim(implode("\n", $results));

        $results                                  =
\JFactory::getApplication()->triggerEvent('PCVonCheckoutAfterPayment',
array('com_phocacart.checkout', $this->a, &$this->p,
$this->t['total']));
        $this->t['event']->onCheckoutAfterPayment =
trim(implode("\n", $results));

        $results                                  =
\JFactory::getApplication()->triggerEvent('PCVonCheckoutAfterConfirm',
array('com_phocacart.checkout', $this->a, &$this->p,
$this->t['total']));
        $this->t['event']->onCheckoutAfterConfirm =
trim(implode("\n", $results));

        // END Plugins --------------------------------------

        $media->loadSpec();


        parent::display($tpl);


    }

    protected function _prepareDocument() {
        PhocacartRenderFront::prepareDocument($this->document,
$this->p, false, false, JText::_('COM_PHOCACART_CHECKOUT'));
    }
}

?>
views/comparison/index.html000064400000000054151167552070012060
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/comparison/metadata.xml000064400000000277151167552070012374
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view title="COM_PHOCACART_COMPARISON_GROUP">
		<message><![CDATA[COM_PHOCACART_COMPARISON_GROUP_DESC]]></message>
	</view>
</metadata>views/comparison/tmpl/default.php000064400000023643151167552070013205
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

$layoutP	= new JLayoutFile('product_price', null,
array('component' => 'com_phocacart'));
$layoutI	= new JLayoutFile('image', null,
array('component' => 'com_phocacart'));

echo '<div id="ph-pc-comparison-box"
class="pc-comparison-view'.$this->p->get(
'pageclass_sfx' ).'">';


echo
PhocacartRenderFront::renderHeader(array(JText::_('COM_PHOCACART_COMPARISON')));


if (!empty($this->t['items'])) {

	$c = array();
	$c['title']		= '<tr><td
class="ph-middle"><b>'.JText::_('COM_PHOCACART_PRODUCT').'</b></td>';

	if ($this->t['can_display_price']) {
		$c['price']		= '<tr><td
class="ph-middle"><b>'.JText::_('COM_PHOCACART_PRICE').'</b></td>';
	}
	$c['remove'] 	= '<tr><td
class="ph-middle"></td>';
	$c['desc']		= '<tr><td
class="ph-middle"><b>'.JText::_('COM_PHOCACART_DESCRIPTION').'</b></td>';
	$c['man'] 		= '<tr><td
class="ph-middle"><b>'.JText::_('COM_PHOCACART_MANUFACTURER').'</b></td>';
	$c2['link'] 	= '<tr><td></td>';

	if ($this->t['value']['stock'] == 1)	{
$c['stock'] 	= '<tr><td
class="ph-middle"><b>'.JText::_('COM_PHOCACART_AVAILABILITY').'</b></td>';}

	if ($this->t['value']['length'] == 1)	{
$c['length'] 	= '<tr><td
class="ph-middle"><b>'.JText::_('COM_PHOCACART_LENGTH').'</b></td>';}
	if ($this->t['value']['width'] == 1)	{
$c['width'] 	= '<tr><td
class="ph-middle"><b>'.JText::_('COM_PHOCACART_WIDTH').'</b></td>';}
	if ($this->t['value']['height'] == 1) 	{
$c['height'] 	= '<tr><td
class="ph-middle"><b>'.JText::_('COM_PHOCACART_HEIGHT').'</b></td>';}
	if ($this->t['value']['weight'] == 1) 	{
$c['weight'] 	= '<tr><td
class="ph-middle"><b>'.JText::_('COM_PHOCACART_WEIGHT').'</b></td>';}
	if ($this->t['value']['volume'] == 1) 	{
$c['volume'] 	= '<tr><td
class="ph-middle"><b>'.JText::_('COM_PHOCACART_VOLUME').'</b></td>';}


	if ($this->t['value']['attrib'] == 1) 	{
$c['attrib'] 	= '<tr><td
class="ph-middle"><b>'.JText::_('COM_PHOCACART_ATTRIBUTES').'</b></td>';}


	$count = count($this->t['items']);
	$price = new PhocacartPrice();

	foreach($this->t['items'] as $k => $v) {


		$c['title'] .=
'<td><h3>'.$v['title'].'</h3>';
		$image 	=
PhocacartImage::getThumbnailName($this->t['pathitem'],
$v['image'], 'small');

		if (isset($v['catid2']) && (int)$v['catid2']
> 0 && isset($v['catalias2']) &&
$v['catalias2'] != '') {
			$link 	= JRoute::_(PhocacartRoute::getItemRoute($v['id'],
$v['catid2'], $v['alias'],
$v['catalias2']));
		} else {
			$link 	= JRoute::_(PhocacartRoute::getItemRoute($v['id'],
$v['catid'], $v['alias'], $v['catalias']));
		}


		if (isset($image->rel) && $image->rel != '') {
			$c['title'] .= '<div class="ph-center"
>';
			$c['title'] .= '<a
href="'.$link.'">';

            $d						= array();
            $d['t']					= $this->t;
            $d['s']			        = $this->s;
            $d['src']				=
JURI::base(true).'/'.$image->rel;
            $d['srcset-webp']		=
JURI::base(true).'/'.$image->rel_webp;
            $d['alt-value']			=
PhocaCartImage::getAltTitle($v['title'], $image->rel);
            $d['class']				=
$this->s['c']['img-responsive'];

            $c['title'] .= $layoutI->render($d);


			$c['title'] .= '</a>';
			$c['title'] .= '</div>';
		}
		$c['title'] .= '</td>';

		if ($this->t['can_display_price']) {


			$price 				= new PhocacartPrice;
			$d					= array();
			$d['s']			    = $this->s;
			$d['type']			= $v['type'];// PRODUCTTYPE

			$d['priceitems']	=
$price->getPriceItems($v['price'], $v['taxid'],
$v['taxrate'], $v['taxcalculationtype'],
$v['taxtitle'], $v['unit_amount'],
$v['unit_unit'], 1, 1, $v['group_price']);
			$d['priceitemsorig']= array();
			if ($v['price_original'] != '' &&
$v['price_original'] > 0) {
				$d['priceitemsorig'] =
$price->getPriceItems($v['price_original'],
$v['taxid'], $v['taxrate'],
$v['taxcalculationtype']);
			}
			$d['class']			= 'ph-category-price-box';// we need
the same class as category or items view
			$d['product_id']	= (int)$v['id'];
			$d['typeview']		= 'Module';

			// Display discount price
			// Move standard prices to new variable (product price -> product
discount)
			$d['priceitemsdiscount']		= $d['priceitems'];
			$d['discount'] 					=
PhocacartDiscountProduct::getProductDiscountPrice($v['id'],
$d['priceitemsdiscount']);

			// Display cart discount (global discount) in product views - under
specific conditions only
			// Move product discount prices to new variable (product price ->
product discount -> product discount cart)
			$d['priceitemsdiscountcart']	=
$d['priceitemsdiscount'];
			$d['discountcart']				=
PhocacartDiscountCart::getCartDiscountPriceForProduct($v['id'],
$v['catid'], $d['priceitemsdiscountcart']);
			$priceOutput = $layoutP->render($d);

			$c['price'] .= '<td
class="ph-right">'.$priceOutput.'</td>';

			$d['zero_price']		= 1;// Apply zero price if possible
		}

		$c['remove'] .= '<td>';
		$c['remove'] .= '<form
action="'.$this->t['linkcomparison'].'"
method="post">';
		$c['remove'] .= '<input type="hidden"
name="id"
value="'.(int)$v['id'].'">';
		$c['remove'] .= '<input type="hidden"
name="task" value="comparison.remove">';
		$c['remove'] .= '<input type="hidden"
name="tmpl" value="component" />';
		$c['remove'] .= '<input type="hidden"
name="option" value="com_phocacart" />';
		$c['remove'] .= '<input type="hidden"
name="return"
value="'.$this->t['actionbase64'].'"
/>';
		$c['remove'] .= '<div
class="ph-center">';
		$c['remove'] .= '<button type="submit"
class="'.$this->s['c']['btn.btn-danger'].'
ph-btn"><span
class="'.$this->s['i']['remove'].'"></span>
'.JText::_('COM_PHOCACART_REMOVE').'</button>';
		$c['remove'] .= '</div>';
		$c['remove'] .=
Joomla\CMS\HTML\HTMLHelper::_('form.token');
		$c['remove'] .= '</form>';
		$c['remove'] .= '</td>';

		$c['desc'] .=
'<td>'.Joomla\CMS\HTML\HTMLHelper::_('content.prepare',
$v['description']).'</td>';
		$c['man'] .= '<td
class="ph-center">'.$v['manufacturer_title'].'</td>';

		if ($this->t['value']['stock'] == 1)	{
$c['stock'] 	.= '<td
class="ph-center">'.JText::_($v['stock']).'</td>';}

		if ($this->t['value']['length'] == 1)	{
$c['length'] 	.= '<td
class="ph-center">'.PhocacartUtils::round($v['length']).'
'.$this->t['unit_size'].'</td>';}
		if ($this->t['value']['width'] == 1)	{
$c['width'] 	.= '<td
class="ph-center">'.PhocacartUtils::round($v['width']).'
'.$this->t['unit_size'].'</td>';}
		if ($this->t['value']['height'] == 1)	{
$c['height'] 	.= '<td
class="ph-center">'.PhocacartUtils::round($v['height']).'
'.$this->t['unit_size'].'</td>';}
		if ($this->t['value']['weight'] == 1)	{
$c['weight'] 	.= '<td
class="ph-center">'.PhocacartUtils::round($v['weight']).'
'.$this->t['unit_weight'].'</td>';}
		if ($this->t['value']['volume'] == 1)	{
$c['volume'] 	.= '<td
class="ph-center">'.PhocacartUtils::round($v['volume']).'
'.$this->t['unit_volume'].'</td>';}

		if ($this->t['value']['attrib'] == 1) 	{
			$c['attrib'] 	.= '<td>';
			if(!empty($v['attr_options'])) {
				foreach ($v['attr_options'] as $k2 => $v2) {
					$c['attrib'] 	.=
'<div>'.$v2->title.'</div>';
					if(!empty($v2->options)) {
						$c['attrib'] 	.= '<ul>';
						foreach ($v2->options as $k3 => $v3) {
							$c['attrib'] 	.=
'<li>'.$v3->title.'</li>';
						}
						$c['attrib'] 	.= '</ul>';
					}
				}

			}
			$c['attrib'] 	.= '</td>';
		}

		$c2['link'] .= '<td
class="ph-center">';
		$c2['link'] .= '<a href="'.$link.'"
class="'.$this->s['c']['btn.btn-primary.btn-sm'].
' ph-btn" role="button"><span
class="'.$this->s['i']['search'].'"></span>
'.JText::_('COM_PHOCACART_VIEW_PRODUCT').'</a>';
		$c2['link'] .= '</td>';

	}

	$c['title'] 	.= '</tr>';
	if ($this->t['can_display_price']) {
		$c['price'] 	.= '</tr>';
	}
	$c['desc'] 		.= '</tr>';
	$c['man'] 		.= '</tr>';
	$c['remove'] 	.= '</tr>';
	$c2['link']		.= '</tr>';

	if ($this->t['value']['stock'] == 1)	{
$c['stock'] 	.= '</tr>';}

	if ($this->t['value']['length'] == 1)	{
$c['length'] 	.= '</tr>';}
	if ($this->t['value']['width'] == 1)	{
$c['width'] 	.= '</tr>';}
	if ($this->t['value']['height'] == 1) 	{
$c['height'] 	.= '</tr>';}
	if ($this->t['value']['weight'] == 1) 	{
$c['weight'] 	.= '</tr>';}
	if ($this->t['value']['volume'] == 1) 	{
$c['volume'] 	.= '</tr>';}

	if ($this->t['value']['attrib'] == 1) 	{
$c['attrib'] 	.= '</tr>';}


	echo '<div class="ph-comparison-items">';
	echo '<table class="ph-comparison-table">';
	foreach($c as $k => $v) {
		echo $v;
	}
	foreach($this->t['spec'] as $k => $v) {
		if($k != '') {
			echo
'<tr><td><b><u>'.$k.'</u></b></td><td
colspan="'.$count.'"></td></tr>';
			if (!empty($v)) {
				foreach($v as $k2 => $v2) {
					echo
'<tr><td><b>'.$k2.'</b></td>';

					if ($count == 1) {
						if (isset($v2[0])) { echo '<td
class="ph-center">'.$v2[0].'</td>';} else
{echo '<td></td>';}
					} else if ($count == 2) {
						if (isset($v2[0])) { echo '<td
class="ph-center">'.$v2[0].'</td>';} else
{echo '<td></td>';}
						if (isset($v2[1])) { echo '<td
class="ph-center">'.$v2[1].'</td>';} else
{echo '<td></td>';}
					} else {
						if (isset($v2[0])) { echo '<td
class="ph-center">'.$v2[0].'</td>';} else
{echo '<td></td>';}
						if (isset($v2[1])) { echo '<td
class="ph-center">'.$v2[1].'</td>';} else
{echo '<td></td>';}
						if (isset($v2[2])) { echo '<td
class="ph-center">'.$v2[2].'</td>';} else
{echo '<td></td>';}
					}

					echo'</tr>';
				}
			}
		}
	}

	// Link to product
	foreach($c2 as $k => $v) {
		echo $v;
	}

	echo '</table>';
	echo '</div>';// end comparison items
} else {
	echo '<div class="alert alert-error
alert-danger">'.JText::_('COM_PHOCACART_THERE_ARE_NO_PRODUCTS_IN_COMPARISON_LIST').'</div>';
}



echo '</div>';// end comparison box
echo '<div>&nbsp;</div>';
echo PhocacartUtilsInfo::getInfo();
?>
views/comparison/tmpl/default.xml000064400000000751151167552070013211
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_PHOCACART_COMPARISON_LAYOUT">
		<message>
			<![CDATA[COM_PHOCACART_COMPARISON_LAYOUT_DESC]]>
		</message>
	</layout>
	
		<name>COM_PHOCACART_COMPARISON_LAYOUT</name>
		<description>COM_PHOCACART_COMPARISON_LAYOUT_DESC</description>
		
		<fields name="params">
<fieldset name="basic"
addfieldpath="/administrator/components/com_phocacart/models/fields"
>

			
			
		</fieldset>
</fields>

</metadata>views/comparison/tmpl/index.html000064400000000054151167552070013034
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/comparison/view.html.php000064400000010016151167552070012510
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');

class PhocaCartViewComparison extends JViewLegacy
{
	protected $t;
	protected $r;
	protected $p;
	protected $s;

	function display($tpl = null)
	{
		$app								= JFactory::getApplication();
		//$model								= $this->getModel();
		//$document							= JFactory::getDocument();
		$this->s                            =
PhocacartRenderStyle::getStyles();
		$this->p 							= $app->getParams();

		//$this->t['categories']				=
$model->getCategoriesList();

		$this->t['cart_metakey'] 			= $this->p->get(
'cart_metakey', '' );
		$this->t['cart_metadesc'] 			= $this->p->get(
'cart_metadesc', '' );
		$this->t['unit_size']			    = $this->p->get(
'unit_size', 0 );
		$this->t['unit_weight']			    = $this->p->get(
'unit_weight', 0 );
		$this->t['unit_volume']			    = $this->p->get(
'unit_volume', 0 );
        $this->t['display_webp_images']		=
$this->p->get( 'display_webp_images', 0 );

		$rights							= new PhocacartAccessRights();
		$this->t['can_display_price']	=
$rights->canDisplayPrice();

		$uri 						= \Joomla\CMS\Uri\Uri::getInstance();
		$this->t['action']			= $uri->toString();
		$this->t['actionbase64']	=
base64_encode($this->t['action']);
		$this->t['linkcomparison']	=
JRoute::_(PhocacartRoute::getComparisonRoute());

		$compare = new PhocacartCompare();
		$this->t['items'] = $compare->getFullItems();

		// Will the values be displayed or not - if the value exists at least by
one product, display it
		$this->t['value']['length'] = 0;
		$this->t['value']['width'] = 0;
		$this->t['value']['height'] = 0;
		$this->t['value']['weight'] = 0;
		$this->t['value']['volume'] = 0;
		$this->t['value']['attrib'] = 0;
		$this->t['value']['stock'] = 0;

		$this->t['spec'] = array();

		if (!empty($this->t['items'])) {

			foreach ($this->t['items'] as $k => $v) {

				if($v['length'] > 0)
{$this->t['value']['length'] = 1;}
				if($v['width'] > 0)
{$this->t['value']['width'] = 1;}
				if($v['height'] > 0)
{$this->t['value']['height'] = 1;}
				if($v['weight'] > 0)
{$this->t['value']['weight'] = 1;}
				if($v['volume'] > 0)
{$this->t['value']['volume'] = 1;}

				$this->t['items'][$k]['attr_options']=
PhocacartAttribute::getAttributesAndOptions((int)$v['id']);
				if
(!empty($this->t['items'][$k]['attr_options'])) {
					$this->t['value']['attrib'] = 1;
				}

				$this->t['items'][$k]['specifications']=
PhocacartSpecification::getSpecificationGroupsAndSpecifications((int)$v['id']);
				if
(!empty($this->t['items'][$k]['specifications'])) {
					foreach($this->t['items'][$k]['specifications']
as $k2 => $v2) {
						//$this->t['spec'][$k2] = $v2[0];
						$newV2 = $v2;
						unset($newV2[0]);
						if (!empty($newV2)) {
							foreach($newV2 as $k3 => $v3) {
								$this->t['spec'][$v2[0]][$v3['title']][$k] =
$v3['value'];
								//$this->t['spec'][$k2][$k3][$k3] =
$v3['value'];
							}
						}

					}
				}

				$stockStatus =
PhocacartStock::getStockStatus((int)$v['stock'],
(int)$v['min_quantity'],
(int)$v['min_multiple_quantity'],
(int)$v['stockstatus_a_id'], 
(int)$v['stockstatus_n_id']);
				$this->t['items'][$k]['stock'] =
PhocacartStock::getStockStatusOutput($stockStatus);
				if ($this->t['items'][$k]['stock'] !=
'') {
					$this->t['value']['stock'] = 1;
				}
			}
		}

		$media = PhocacartRenderMedia::getInstance('main');
		$media->loadBase();
		$media->loadSpec();

		$this->t['pathitem'] =
PhocacartPath::getPath('productimage');
		$this->_prepareDocument();
		parent::display($tpl);

	}

	protected function _prepareDocument() {
		PhocacartRenderFront::prepareDocument($this->document, $this->p,
false, false, JText::_('COM_PHOCACART_COMPARISON'));
	}
}
?>
views/download/index.html000064400000000054151167552070011515
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/download/metadata.xml000064400000000273151167552070012025
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view title="COM_PHOCACART_DOWNLOAD_GROUP">
		<message><![CDATA[COM_PHOCACART_DOWNLOAD_GROUP_DESC]]></message>
	</view>
</metadata>views/download/tmpl/default.php000064400000012244151167552070012635
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();


echo '<div id="ph-pc-download-box"
class="pc-download-view'.$this->p->get(
'pageclass_sfx' ).'">';


echo
PhocacartRenderFront::renderHeader(array(JText::_('COM_PHOCACART_DOWNLOAD')));

if ($this->u->id > 0 || ($this->t['token_download']
!= '' && $this->t['token_order'] !=
'')) {
	if (!empty($this->t['files'])) {

		//echo '<div class="ph-download-files">';

		echo '<div
class="'.$this->s['c']['row'].'
ph-download-header-box-row ph-vertical-align">';
		echo '<div
class="'.$this->s['c']['col.xs12.sm3.md3'].'">'.JText::_('COM_PHOCACART_TITLE').'</div>';
		echo '<div
class="'.$this->s['c']['col.xs12.sm3.md3'].'">'.JText::_('COM_PHOCACART_FILENAME').'</div>';
		echo '<div
class="'.$this->s['c']['col.xs12.sm3.md3'].'">'.JText::_('COM_PHOCACART_STATUS').'</div>';
		echo '<div
class="'.$this->s['c']['col.xs12.sm3.md3'].'
ph-center">'.JText::_('COM_PHOCACART_DOWNLOAD').'</div>';
		echo '<div class="ph-cb"></div>';
		echo '</div>';


		foreach ($this->t['files'] as $k => $v) {


			echo '<div
class="'.$this->s['c']['row'].'
ph-download-item-box-row ph-vertical-align">';

			echo '<div
class="'.$this->s['c']['col.xs12.sm3.md3'].'">'.$v->title;

			echo '<br /><span
class="'.$this->s['c']['label.label-info'].'">'.PhocacartOrder::getOrderNumber($v->order_id,
$v->order_date, $v->order_number).'</span>';
			echo '</div>';

			$fileA = explode('/', $v->download_file);
			$fileACount = count($fileA);
			$fileACount--;
			$file = $fileA[$fileACount];
			echo '<div
class="'.$this->s['c']['col.xs12.sm3.md3'].'">'.$file.'</div>';


			$downloadPossible = 0;
			$status = '';
			if((int)$this->t['download_count'] > 0 &&
((int)$this->t['download_count'] == (int)$v->download_hits
|| (int)$this->t['download_count'] <
(int)$v->download_hits)) {
				$status .= '<span
class="'.$this->s['c']['label.label-danger'].'">'.JText::_('COM_PHOCACART_MAXIMUM_DOWNLOADS_REACHED').
'</span><br />';

			}

			$downloadDays = (int)$this->t['download_days'];
			if (isset($v->download_days) && (int)$v->download_days
> -1) {
				$downloadDays = (int)$v->download_days;
			}

			if($downloadDays != 0 &&
!PhocacartDownload::isActive($v->date, $downloadDays)) {
				$status .= '<span
class="'.$this->s['c']['label.label-danger'].'">'.JText::_('COM_PHOCACART_DOWNLOAD_DATE_EXPIRED').
'</span><br />';

			}

			if ($status == '') {
				$status = '<span
class="'.$this->s['c']['label.label-success'].'">'.JText::_('COM_PHOCACART_ACTIVE').
'</span><br />';

				$rem	= (int)$this->t['download_count'] -
(int)$v->download_hits;
				if ((int)$rem > 0) {
					$status .= ' <span
class="ph-small"><b>'.$rem. '</b>
';
					if ($rem == 1) {
						$status .= JText::_('COM_PHOCACART_DOWNLOAD'). '
';
					} else {
						$status .= JText::_('COM_PHOCACART_DOWNLOADS'). '
';
					}
					$status .= JText::_('COM_PHOCACART_REMAINING').
'</span>';
				}

				$dateValid = PhocacartDownload::validUntil($v->date,
$downloadDays);
				if ($dateValid) {
					$status .= '<br /> <span
class="ph-small">'.JText::_('COM_PHOCACART_DOWNLOAD_VALID_UNTIL').
': ';
					$status .= ' '.$dateValid.'<span>';
				}

				$downloadPossible = 1;
			}

			echo '<div
class="'.$this->s['c']['col.xs12.sm3.md3'].'">'.$status.'</div>';

			if($downloadPossible ==1) {
				echo '<div
class="'.$this->s['c']['col.xs12.sm3.md3'].'
ph-center">';

				echo '<form
action="'.$this->t['linkdownload'].'"
method="post">';
				echo '<input type="hidden" name="id"
value="'.(int)$v->id.'">';
				echo '<input type="hidden" name="task"
value="download.download">';
				echo '<input type="hidden" name="tmpl"
value="component" />';
				echo '<input type="hidden" name="option"
value="com_phocacart" />';
				echo '<input type="hidden" name="return"
value="'.$this->t['actionbase64'].'"
/>';
				echo '<input type="hidden" name="d"
value="'.$this->t['token_download'].'"
/>';
				echo '<input type="hidden" name="o"
value="'.$this->t['token_order'].'"
/>';
				echo '<button type="submit" class="btn
btn-primary ph-btn"><span
class="'.$this->s['i']['download'].'"></span>
'.JText::_('COM_PHOCACART_DOWNLOAD').'</button>';
				echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
				echo '</form>';

				echo '</div>';

			} else {
				echo '<div
class="'.$this->s['c']['col.xs12.sm3.md3'].'
ph-center"><span
class="'.$this->s['i']['ban'].'
ph-red"></span></div>';
			}

			echo '</div>';// end row
		}
		echo '<div class="ph-cb
ph-download-item-box-row-line"></div>';

		//echo '</div>';// end download files
	} else {
		echo '<div class="alert alert-error
alert-danger">'.JText::_('COM_PHOCACART_THERE_ARE_NO_FILES_TO_DOWNLOAD').'</div>';
	}

} else {
	echo '<div class="alert alert-error
alert-danger">'.JText::_('COM_PHOCACART_NOT_LOGGED_IN_PLEASE_LOGIN').'</div>';
}



echo '</div>';// end comparison box
echo '<div>&nbsp;</div>';
echo PhocacartUtilsInfo::getInfo();
?>
views/download/tmpl/default.xml000064400000000741151167552070012645
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_PHOCACART_DOWNLOAD_LAYOUT">
		<message>
			<![CDATA[COM_PHOCACART_DOWNLOAD_LAYOUT_DESC]]>
		</message>
	</layout>
	
		<name>COM_PHOCACART_DOWNLOAD_LAYOUT</name>
		<description>COM_PHOCACART_DOWNLOAD_LAYOUT_DESC</description>
		
		<fields name="params">
<fieldset name="basic"
addfieldpath="/administrator/components/com_phocacart/models/fields"
>

			
			
		</fieldset>
</fields>

</metadata>views/download/tmpl/index.html000064400000000054151167552070012471
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/download/view.html.php000064400000004346151167552070012156
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');

class PhocaCartViewDownload extends JViewLegacy
{
	protected $t;
	protected $r;
	protected $p;
	protected $u;
	protected $s;

	function display($tpl = null)
	{
		$app								= JFactory::getApplication();
		//$model								= $this->getModel();
		//$document							= JFactory::getDocument();
		$this->s                            =
PhocacartRenderStyle::getStyles();
		$this->p 							= $app->getParams();
		$this->u							= PhocacartUser::getUser();
		$this->t['token_download']			=
$app->input->get('d', '', 'string');
		$this->t['token_order']				=
$app->input->get('o', '', 'string');
		$this->t['download_guest_access']	= $this->p->get(
'download_guest_access', 0 );
		if ($this->t['download_guest_access'] == 0) {
			$this->t['token_download'] = '';
			$this->t['token_order'] = '';
		}
		$this->t['files']					=
PhocacartDownload::getDownloadFiles($this->u->id,
$this->t['token_download'],
$this->t['token_order'] );

		$this->t['cart_metakey'] 			= $this->p->get(
'cart_metakey', '' );
		$this->t['cart_metadesc'] 			= $this->p->get(
'cart_metadesc', '' );
		$this->t['download_days']			= $this->p->get(
'download_days', 0 );
		$this->t['download_count']			= $this->p->get(
'download_count', 0 );

		$uri 						= \Joomla\CMS\Uri\Uri::getInstance();
		$this->t['action']			= $uri->toString();
		$this->t['actionbase64']	=
base64_encode($this->t['action']);
		$this->t['linkdownload']	=
JRoute::_(PhocacartRoute::getDownloadRoute());

		$media = PhocacartRenderMedia::getInstance('main');
		$media->loadBase();
		$media->loadSpec();

		$this->t['pathfile'] =
PhocacartPath::getPath('productfile');
		$this->_prepareDocument();
		parent::display($tpl);

	}

	protected function _prepareDocument() {
		PhocacartRenderFront::prepareDocument($this->document, $this->p,
false, false, JText::_('COM_PHOCACART_DOWNLOAD'));
	}
}
?>
views/feed/index.html000064400000000054151167552070010611
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/feed/metadata.xml000064400000000273151167552070011121
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view title="COM_PHOCACART_XML_FEED_GROUP">
		<message><![CDATA[COM_PHOCACART_XML_FEED_GROUP_DESC]]></message>
	</view>
</metadata>views/feed/tmpl/default.php000064400000054407151167552070011740
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

$o		= array();
$l		= '<';
$r		= '>';
$e		= '</';


// HEADER
if (isset($this->t['feed']['header']) &&
$this->t['feed']['header'] != '') {
    $o['header'] =
$this->t['feed']['header'];
} else {
    $o['header'] = '<?xml version="1.0"
encoding="utf-8"?>';
}

// ROOT START
if (isset($this->t['feed']['root']) &&
$this->t['feed']['root'] != '') {
    $o['rootstart'] =
$l.$this->t['feed']['root'].$r;
}


// PREPARE FUNCTIONS BEFORE FOREACH, so we save memory
// E.g. currency - to get info about default currency we need to ask sql
but we should to it only
// one time, not in foreach. Of course currency class is singleton so we
don't run sql query many time
// but we don't need to run the function many times too.
$cur = '';
//if ($this->p['item_currency'] != '') {
$cur	= PhocacartCurrency::getDefaultCurrencyCode();
//}

// START FOREACH OF PRODUCTS
$o['items'] = '';
$o['params'] = '';
if (!empty($this->t['products'])) {
    foreach ($this->t['products'] as $k => $v) {


        // PRODUCT - Specific FEED plugin
         $paramsFeedA = array();
        if (isset($v->params_feed) && $v->params_feed !=
'') {

            $registry = new JRegistry;
            $registry->loadString($v->params_feed);
            $paramsFeedA = $registry->toArray();

            $feedName =
trim($this->t['feed']['feed_plugin']);

            if
(isset($paramsFeedA[$feedName]['pcf_param_published']) &&
$paramsFeedA[$feedName]['pcf_param_published'] == 0) {
                // The product is unpublished from feed
                continue;
            }
        }
        $oI     = array();
        // PRODUCT START
        if (isset($this->t['feed']['item'])
&& $this->t['feed']['item'] != '')
{
            $oI['itemstart'] =
$l.$this->t['feed']['item'].$r;
        }

        if ($this->p['item_id'] != '' &&
isset($v->id) && $v->id != '') {
            $oI['item_id'] =
$l.$this->p['item_id'].$r.$v->id.$e.$this->p['item_id'].$r;
        }

        if ($this->p['item_title'] != '' &&
isset($v->title) && $v->title != '') {
            $oI['item_article'] =
$l.$this->p['item_title'].$r.htmlspecialchars($v->title).$e.$this->p['item_title'].$r;
        }

        if ($this->p['item_title_extended'] != ''
&& isset($v->title) && $v->title != '') {
            $oI['item_title_extended'] =
$l.$this->p['item_title_extended'].$r.htmlspecialchars($v->title).$e.$this->p['item_title_extended'].$r;
        }

        if ($this->p['item_description_short'] != ''
&& isset($v->description) && $v->description !=
'') {

            if ($this->p['strip_html_tags_desc'] == 1) {
                $v->description = strip_tags($v->description);
            }
            $oI['item_description_short'] =
$l.$this->p['item_description_short'].$r.'<![CDATA['.$v->description.']]>'.$e.$this->p['item_description_short'].$r;
        }

        if ($this->p['item_description_long'] != ''
&& isset($v->description_long) &&
$v->description_long != '') {

            if ($this->p['strip_html_tags_desc'] == 1) {
                $v->description_long =
strip_tags($v->description_long);
            }

            $oI['item_description_long'] =
$l.$this->p['item_description_long'].$r.'<![CDATA['.$v->description_long.']]>'.$e.$this->p['item_description_long'].$r;
        }

        if ($this->p['item_sku'] != '' &&
isset($v->sku) && $v->sku != '') {
            $oI['item_sku'] =
$l.$this->p['item_sku'].$r.$v->sku.$e.$this->p['item_sku'].$r;
        }

        if ($this->p['item_ean'] != '' &&
isset($v->ean) && $v->ean != '') {
            $oI['item_ean'] =
$l.$this->p['item_ean'].$r.$v->ean.$e.$this->p['item_ean'].$r;
        }


        // PRICE ORIGINAL
        if ($this->p['item_original_price_with_vat'] !=
'' || $this->p['item_original_price_without_vat'] !=
''
            && isset($v->price_original) &&
isset($v->taxrate) && isset($v->taxcalculationtype)) {

            $priceOc 	= new PhocacartPrice;
            $priceO		= $priceOc->getPriceItems($v->price_original,
$v->taxid, $v->taxrate, $v->taxcalculationtype);

            if ($this->p['price_decimals'] != '') {
                $priceO['netto'] =
number_format($priceO['netto'],
(int)$this->p['price_decimals']);
                $priceO['brutto'] =
number_format($priceO['brutto'],
(int)$this->p['price_decimals']);
            }

            if ($this->p['price_including_currency'] == 1){
                $priceO['netto'] = $cur != '' ?
$priceO['netto'] . ' ' . $cur :
$priceO['netto'];
                $priceO['brutto'] = $cur != '' ?
$priceO['brutto'] . ' ' . $cur :
$priceO['brutto'];
            }

            if ($this->p['item_original_price_without_vat'] !=
'' && isset($priceO['netto']) &&
(int)$priceO['netto'] > 0) {
                $oI['item_original_price_without_vat'] =
$l.$this->p['item_original_price_without_vat'].$r.$priceO['netto'].$e.$this->p['item_original_price_without_vat'].$r;
            }
            if ($this->p['item_original_price_with_vat'] !=
'' && isset($priceO['brutto']) &&
(int)$priceO['brutto'] > 0) {
                $oI['item_original_price_with_vat'] =
$l.$this->p['item_original_price_with_vat'].$r.$priceO['brutto'].$e.$this->p['item_original_price_with_vat'].$r;
            }
        }

        // PRICE FINAL
        if ($this->p['item_final_price_with_vat'] !=
'' || $this->p['item_final_price_without_vat'] !=
''
            && isset($v->price) && isset($v->taxrate)
&& isset($v->taxcalculationtype)) {

            $priceFc = new PhocacartPrice;
            $priceF = $priceFc->getPriceItems($v->price,
$v->taxid, $v->taxrate, $v->taxcalculationtype);


            if ($this->p['price_decimals'] != '') {
                $priceF['netto'] =
number_format($priceF['netto'],
(int)$this->p['price_decimals']);
                $priceF['brutto'] =
number_format($priceF['brutto'],
(int)$this->p['price_decimals']);
                $priceF['tax'] =
number_format($priceF['tax'],
(int)$this->p['price_decimals']);
            }

            if ($this->p['price_including_currency'] == 1){

                $priceF['netto'] = $cur != '' ?
$priceF['netto'] . ' ' . $cur :
$priceF['netto'];
                $priceF['brutto'] = $cur != '' ?
$priceF['brutto'] . ' ' . $cur :
$priceF['brutto'];
                $priceF['tax'] = $cur != '' ?
$priceF['tax'] . ' ' . $cur :
$priceF['tax'];
            }

            if ($this->p['item_final_price_without_vat'] !=
'' && isset($priceF['netto']) &&
(int)$priceF['netto'] > 0) {
                $oI['item_final_price_without_vat'] =
$l.$this->p['item_final_price_without_vat'].$r.$priceF['netto'].$e.$this->p['item_final_price_without_vat'].$r;
            }
            if ($this->p['item_final_price_with_vat'] !=
'' && isset($priceF['brutto']) &&
(int)$priceF['brutto'] > 0) {
                $oI['item_final_price_with_vat'] =
$l.$this->p['item_final_price_with_vat'].$r.$priceF['brutto'].$e.$this->p['item_final_price_with_vat'].$r;
            }

            if ($this->p['item_vat'] != ''
&& isset($priceF['tax']) &&
(int)$priceF['tax'] > 0) {
                $oI['item_vat'] =
$l.$this->p['item_vat'].$r.$priceF['tax'].$e.$this->p['item_vat'].$r;
            }
        }

        // PRODUCT CURRENCY (DEFAULT)
        if ($this->p['item_currency'] != ''
&& $cur != '') {
            $oI['item_currency'] =
$l.$this->p['item_currency'].$r.htmlspecialchars($cur).$e.$this->p['item_currency'].$r;
        }


        // PRODUCT URL
        if ($this->p['item_url'] != '' &&
isset($v->id) && $v->id > 0 && isset($v->catid)
&& $v->catid > 0 && isset($v->alias) &&
isset($v->catalias)) {

            $itemUrl 	= PhocacartRoute::getItemRoute($v->id,
$v->catid, $v->alias, $v->catalias);
            $itemUrl	= PhocacartRoute::getFullUrl($itemUrl);
            $oI['item_url'] =
$l.$this->p['item_url'].$r.$itemUrl.$e.$this->p['item_url'].$r;
        }

        // IMAGE URL
        if ($this->p['item_url_image'] != ''
&& isset($v->image) && $v->image != '') {
            $image 	=
PhocacartImage::getThumbnailName($this->t['pathitem'],
$v->image, 'large');
            if (isset($image->rel) && $image->rel !=
'') {
                $imageUrl	= PhocacartRoute::getFullUrl($image->rel);
                $oI['item_url_image'] =
$l.$this->p['item_url_image'].$r.$imageUrl.$e.$this->p['item_url_image'].$r;
            }
        }

        // VIDEO URL
        if ($this->p['item_url_video'] != ''
&& isset($v->video) && $v->video != '') {
            if (PhocacartUtils::isURLAddress($v->video)) {
                $oI['item_url_video'] =
$l.$this->p['item_url_video'].$r.$v->video.$e.$this->p['item_url_video'].$r;
            }
        }

        // CATEGORY
        if ($this->p['item_category'] != ''
&& isset($v->cattitle) && $v->cattitle !=
'') {
            $oI['item_category'] =
$l.$this->p['item_category'].$r.htmlspecialchars($v->cattitle).$e.$this->p['item_category'].$r;
        }

        // CATEGORIES
        if ($this->p['item_categories'] != ''
&& isset($v->categories) && $v->categories !=
'') {

            if ($this->p['category_separator'] ==
'') {
                $this->p['category_separator'] = '
';
            }
            $categories = str_replace('|',
$this->p['category_separator'], $v->categories);
            $oI['item_categories'] =
$l.$this->p['item_categories'].$r.htmlspecialchars($categories).$e.$this->p['item_categories'].$r;
        }

        // CATEGORY FEED
        if ($this->p['feed_category'] != ''
&& isset($v->cattitlefeed) && $v->cattitlefeed !=
'') {
            $oI['feed_category'] =
$l.$this->p['feed_category'].$r.htmlspecialchars($v->cattitlefeed).$e.$this->p['feed_category'].$r;
        }

        // CATEGORY TYPE OR PRODUCT CATEGORY TYPE
        if ($this->p['item_category_type_feed'] !=
'') {


            if (isset($v->type_category_feed) &&
$v->type_category_feed != '') {

                // 1) Product - the one you can set in product edit in
first tab
                $oI['item_category_type_feed'] =
$l.$this->p['item_category_type_feed'].$r.htmlspecialchars($v->type_category_feed).$e.$this->p['item_category_type_feed'].$r;

            } else if (isset($v->feedcategories ) &&
$v->feedcategories  != '') {

                // 2) Categories - loaded by db - generated by categories
set in Phoca Cart
                $v->feedcategories = str_replace('|',
$this->p['category_separator'],
htmlspecialchars($v->feedcategories));
                $oI['item_category_type_feed'] =
$l.$this->p['item_category_type_feed'].$r.htmlspecialchars($v->feedcategories).$e.$this->p['item_category_type_feed'].$r;

                // Only one category possible e.g. in Google Products, so
this can be customized
                //$this->t['feed']categories =
explode('|', $v->feedcategories);
                //if (isset($this->t['feed']categories[0])
&& $this->t['feed']categories[0] != '') {
                //	$oI['item_category_type_feed'] =
$l.$this->p['item_category_type_feed'].$r.htmlspecialchars($this->t['feed']categories[0]).$e.$this->p['item_category_type_feed'].$r;
                //}

            } else if (isset($v->cattypefeed) &&
$v->cattypefeed != '') {
                // 3) Category - if not 2) loaded - the one you can set in
category
                $oI['item_category_type_feed'] =
$l.$this->p['item_category_type_feed'].$r.htmlspecialchars($v->cattypefeed).$e.$this->p['item_category_type_feed'].$r;
            }
        }

        // MANUFACTURER
        if ($this->p['item_manufacturer'] != ''
&& isset($v->manufacturertitle) &&
$v->manufacturertitle != '') {
            $oI['item_manufacturer'] =
$l.$this->p['item_manufacturer'].$r.htmlspecialchars($v->manufacturertitle).$e.$this->p['item_manufacturer'].$r;
        }

        // STOCK (Product edit - Stock Options - In Stock)
        if ($this->p['item_stock'] != '' &&
isset($v->stock) && $v->stock != '') {
            $oI['item_stock'] =
$l.$this->p['item_stock'].$r.$v->stock.$e.$this->p['item_stock'].$r;
        }

        // STOCK DELIVERY_DATE (Product edit - Stock Options - Stock
Status)
        if ($this->p['item_delivery_date'] != ''
&& isset($v->stock) && isset($v->min_quantity)
&& isset($v->min_multiple_quantity) &&
isset($v->stockstatus_a_id) && isset($v->stockstatus_n_id) )
{


            $stockStatus 	=
PhocacartStock::getStockStatus((int)$v->stock, (int)$v->min_quantity,
(int)$v->min_multiple_quantity, (int)$v->stockstatus_a_id, 
(int)$v->stockstatus_n_id);

            //$stockText		=
PhocacartStock::getStockStatusOutput($stockStatus);
            if (isset($stockStatus['stock_status']) &&
$stockStatus['stock_status'] != '') {
                $oI['item_delivery_date'] =
$l.$this->p['item_delivery_date'].$r.htmlspecialchars($stockStatus['stock_status']).$e.$this->p['item_delivery_date'].$r;
            }
        }

        // STOCK DELIVERY_DATE - REAL DATE (Product edit - Stock Options -
Product Delivery Date)
        if ($this->p['item_delivery_date_date'] !=
'' && isset($v->delivery_date) &&
$v->delivery_date != '' && $v->delivery_date !=
'0000-00-00 00:00:00') {
            $oI['item_delivery_date_date'] =
$l.$this->p['item_delivery_date_date'].$r.$v->delivery_date.$e.$this->p['item_delivery_date_date'].$r;
        }

        // STOCK DELIVERY_DATE FEED (Stock Status Edit - Title (XML Feed))
        if ($this->p['feed_delivery_date'] != ''
&& isset($v->stock) && isset($v->min_quantity)
&& isset($v->min_multiple_quantity) &&
isset($v->stockstatus_a_id) && isset($v->stockstatus_n_id) )
{
            $stockStatus 	=
PhocacartStock::getStockStatus((int)$v->stock, (int)$v->min_quantity,
(int)$v->min_multiple_quantity, (int)$v->stockstatus_a_id, 
(int)$v->stockstatus_n_id);


            if (isset($stockStatus['stock_status_feed'])
&& $stockStatus['stock_status_feed'] != '') {
                $oI['stock_status_feed'] =
$l.$this->p['feed_delivery_date'].$r.htmlspecialchars($stockStatus['stock_status_feed']).$e.$this->p['feed_delivery_date'].$r;
            }
        }

        //
        // NEEDS TO BE CUSTOMIZED FOR EACH XML FEED
        //
        if ($this->p['display_attributes'] == 1 &&
$this->p['item_attribute'] != '' &&
$this->p['item_attribute_name'] != '' &&
$this->p['item_attribute_value'] != '') {
            // ATTRIBUTES - BE AWARE TO USER ATTRIBUTES
            // RENDERING can take a lot of memory
            // THE FORMAT can be not correct
            $attributes =
PhocacartAttribute::getAttributesAndOptions((int)$v->id);
            $oIA = array();
            if (!empty($attributes)) {
                foreach ($attributes as $k2 => $v2) {
                    if (isset($v2->title) && $v2->title !=
'') {

                        $oIA[] =
$l.$this->p['item_attribute'].$r;
                        $oIA[] =
$l.$this->p['item_attribute_name'].$r.htmlspecialchars($v2->title).$e.$this->p['item_attribute_name'].$r;

                        if (!empty($v2->options)) {
                            $opt = array();
                            foreach ($v2->options as $k3 => $v3) {
                                $opt[] = $v3->title;
                            }
                            $optText = implode(';', $opt);
                            $oIA[] =
$l.$this->p['item_attribute_value'].$r.htmlspecialchars($optText).$e.$this->p['item_attribute_value'].$r;
                        }
                        $oIA[] =
$e.$this->p['item_attribute'].$r;
                    }

                }
            }
            $oI['attributes'] = implode("\n", $oIA);
        }


        // SPECIFICATION
        if (!empty($this->p['specification_groups_id'])
&& $this->p['item_specification'] != ''
/*&& $this->p['item_specification_group_name']*/
&& $this->p['item_specification_name'] != ''
&& $this->p['item_specification_value'] !=
'') {

            $specifications =
PhocacartSpecification::getSpecificationGroupsAndSpecifications((int)$v->id);


            $oIS = array();
            if (!empty($specifications)) {

                foreach ($specifications as $k2 => $v2) {

                    if (!empty($v2)) {
                        $specGroup = array_slice($v2, 0, 1);
                        $specItems = array_slice($v2, 1);

                        if (!in_array((int)$k2,
$this->p['specification_groups_id'])) {
                            // The specification is not selected
                            continue;
                        }

                        /*
                         * Possible feature move the parameter from feed to
product/feed

                        if
(isset($paramsFeedA[$feedName]['pcf_param_specification_group_id'])
&&
!empty($paramsFeedA[$feedName]['pcf_param_specification_group_id']))
{

                            if (!in_array((int)$k2,
$paramsFeedA[$feedName]['pcf_param_specification_group_id'])) {
                                // The specification is not selected
                                continue;
                            }
                        }
                        */

                        if (!empty($specGroup) &&
!empty($specItems)) {

                            //$oIS[] = $l .
$this->p['item_specification'] . $r;
                            //$oIS[] = $l .
$this->p['item_specification_group_name'] . $r .
htmlspecialchars($v2[0]) . $e .
$this->p['item_specification_group_name'] . $r;

                            foreach ($specItems as $k3 => $v3) {

                                $oIS[] = $l .
$this->p['item_specification'] . $r;

                                if (isset($v3['title'])
&& $v3['title'] != '') {
                                    $oIS[] = $l .
$this->p['item_specification_name'] . $r .
htmlspecialchars($v3['title']) . $e .
$this->p['item_specification_name'] . $r;
                                }
                                if (isset($v3['value'])
&& $v3['value'] != '') {
                                    $oIS[] = $l .
$this->p['item_specification_value'] . $r .
htmlspecialchars($v3['value']) . $e .
$this->p['item_specification_value'] . $r;
                                }

                                $oIS[] = $e .
$this->p['item_specification'] . $r;
                            }

                            //$oIS[] = $e .
$this->p['item_specification'] . $r;
                        }

                    }
                }
            }
            $oI['specifications'] = implode("\n",
$oIS);
        }



        // PRODUCT CONDITION
        if ($this->p['item_condition'] != ''
&& isset($v->condition)) {
            $condition =
PhocacartUtilsSettings::getProductConditionValues($v->condition);
            $oI['item_condition'] =
$l.$this->p['item_condition'].$r.htmlspecialchars($condition).$e.$this->p['item_condition'].$r;

        }

        // PRODUCT REWARD POINTS
        if ($this->p['item_reward_points'] != ''
&& isset($v->points_received) &&
(int)$v->points_received > 0) {

            $oIRP = array();
            if ($this->p['item_reward_points_name'] !=
'' && $this->p['item_reward_points_value']
!= '') {
                $oIRP[] =
$l.$this->p['item_reward_points'].$r;

                $oIRP[] =
$l.$this->p['item_reward_points_name'].$r.JText::_('COM_PHOCACART_FEED_TXT_PRODUCT_REWARD_POINTS').$e.$this->p['item_reward_points_name'].$r;
                $oIRP[] =
$l.$this->p['item_reward_points_value'].$r.(int)$v->points_received.$e.$this->p['item_reward_points_value'].$r;
                // Possible RATION value

                $oIRP[] =
$e.$this->p['item_reward_points'].$r;
            } else {
                $oIRP[] =
$l.$this->p['item_reward_points'].$r.(int)$v->points_received.$e.$this->p['item_reward_points'].$r;
            }
            $oI['reward_points'] = implode("\n",
$oIRP);
        }

        // PRODUCT TYPE FEED
        if ($this->p['item_type_feed'] != ''
&& isset($v->type_feed) && $v->type_feed !=
'') {
            $oI['item_type_feed'] =
$l.$this->p['item_type_feed'].$r.htmlspecialchars($v->type_feed).$e.$this->p['item_type_feed'].$r;
        }


        // PRODUCT - Specific FEED plugin
        $oIP = array();
        if (!empty($paramsFeedA)) {

            foreach ($paramsFeedA as $k => $v) {


                if (trim($k) ==
trim($this->t['feed']['feed_plugin'])) {


                    if (!empty($v)) {
                        foreach ($v as $k2 => $v2) {

                            // display items except the parameter items
                            $pos = strpos($k2, 'pcf_param');
                            if ($pos !== false) {
                                continue;
                            }


                            if (trim($v2) != '') {

                                // Some feeds have the same parameters but
we cannot store them under the same name
                                // so internaly they are stored as e.g.:
EXTRA_MESSAGE{1}, EXTRA_MESSAGE{2}
                                // in XML the {1} and {2} are removed and
there is only one parameter EXTRA_MESSAGE on different places
                                $k2 =
preg_replace("/\{[^}]+\}/","",$k2);
                                $oIP[] =
$l.$k2.$r.htmlspecialchars($v2).$e.$k2.$r;
                            }
                        }
                    }
                }
            }

        }


        $oI['params'] .= implode("\n", $oIP);





        // PRODUCT - Fixed XML Elements
        if ($this->p['item_fixed_elements'] != '')
{
            $oI['item_fixed_elements'] =
$this->p['item_fixed_elements'];
        }



        // PRODUCT END
        if (isset($this->t['feed']['item'])
&& $this->t['feed']['item'] != '')
{
            $oI['itemend'] =
$e.$this->t['feed']['item'].$r;
        }


        $o['items'] .= implode("\n", $oI) .
"\n";

    }

}


// ROOT END
if (isset($this->t['feed']['root']) &&
$this->t['feed']['root'] != '') {
    $o['rootend'] =
$e.$this->t['feed']['root'].$r;
}


// FOOTER
if (isset($this->t['feed']['footer']) &&
$this->t['feed']['footer'] != '') {
    $o['footer'] =
$this->t['feed']['footer'];
}



echo implode( "\n", $o );



?>
views/feed/tmpl/default.xml000064400000001730151167552070011740
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_PHOCACART_XML_FEED_LAYOUT">
		<message>
			<![CDATA[COM_PHOCACART_XML_FEED_LAYOUT_DESC]]>
		</message>
	</layout>
	
		<name>COM_PHOCACART_XML_FEED_LAYOUT</name>
		<description>COM_PHOCACART_XML_FEED_LAYOUT_DESC</description>
		
		<fields name="request">
<fieldset name="request"
addfieldpath="/administrator/components/com_phocacart/models/fields"
>
		
		<field name="format" section="com_phocacart"
default="xml" type="hidden" />
		
		<field name="id" type="phocacartfeed"
section="com_phocacart" default="0"
label="COM_PHOCACART_FIELD_SELECT_XML_FEED_LABEL"
description="COM_PHOCACART_FIELD_SELECT_XML_FEED_DESC"
required="true" />
		
		<!-- <field name="format" type="text"
section="com_phocacart" default="xml"
label="COM_PHOCACART_FIELD_SELECT_XML_FEED_LABEL"
description="COM_PHOCACART_FIELD_SELECT_XML_FEED_DESC"
required="true" /> -->
		
		
			
		</fieldset>
</fields>

</metadata>views/feed/tmpl/index.html000064400000000054151167552070011565
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/feed/view.xml.php000064400000016600151167552070011102
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license   http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license   http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();

jimport('joomla.application.component.view');

class PhocaCartViewFeed extends JViewLegacy
{

    protected $t;
    protected $r;
    protected $p;

    function display($tpl = null) {

        $app  = JFactory::getApplication();
        $id   = $app->input->get('id', 0, 'int');
        $this->t['feed'] = PhocacartFeed::getFeed((int)$id);



        if ($this->t['feed']) {
            $fP = new JRegistry;
            $iP = new JRegistry;


            if
(isset($this->t['feed']['feed_params']) &&
$this->t['feed']['feed_params'] != '') {
               
$fP->loadString($this->t['feed']['feed_params']);
            }

            if
(isset($this->t['feed']['item_params']) &&
$this->t['feed']['item_params'] != '') {
               
$iP->loadString($this->t['feed']['item_params']);
            }



            $this->t['pathitem'] =
PhocacartPath::getPath('productimage');

            // Feed Params
            $this->p['export_published_only'] =
$fP->get('export_published_only', 1);
            $this->p['export_in_stock_only']  =
$fP->get('export_in_stock_only', 0);
            $this->p['export_price_only']     =
$fP->get('export_price_only', 1);
            $this->p['strip_html_tags_desc']  =
$fP->get('strip_html_tags_desc', 1);
            $this->p['item_limit']            =
$fP->get('item_limit', 0);
            $this->p['item_ordering']         =
$fP->get('item_ordering', 1);
            $this->p['category_ordering']     =
$fP->get('category_ordering', 0);
            $this->p['display_attributes']    =
$fP->get('display_attributes', 0);
            $this->p['specification_groups_id']=
$fP->get('specification_groups_id', '');
            $this->p['category_separator']    =
$fP->get('category_separator', '');
            $this->p['load_all_categories']   =
$fP->get('load_all_categories', 0);

            $this->p['price_decimals']           =
$fP->get('price_decimals', '');
            $this->p['price_including_currency'] =
$fP->get('price_including_currency', 0);

            if ($this->p['category_separator'] ==
'\n') {
                $this->p['category_separator'] =
"\n";
            }
            if ($this->p['category_separator'] ==
'\r') {
                $this->p['category_separator'] =
"\r";
            }
            if ($this->p['category_separator'] ==
'\r\n') {
                $this->p['category_separator'] =
"\r\n";
            }

            // Item Params (phocacartfeed.xml, language string,
view.xml.php here defined and conditions below)
            $this->p['item_id']                         =
$iP->get('item_id', '');
            $this->p['item_title']                      =
$iP->get('item_title', '');
            $this->p['item_title_extended']             =
$iP->get('item_title_extended', '');
            $this->p['item_description_short']          =
$iP->get('item_description_short', '');
            $this->p['item_description_long']           =
$iP->get('item_description_long', '');
            $this->p['item_sku']                        =
$iP->get('item_sku', '');
            $this->p['item_ean']                        =
$iP->get('item_ean', '');
            $this->p['item_original_price_with_vat']    =
$iP->get('item_original_price_with_vat', '');
            $this->p['item_original_price_without_vat'] =
$iP->get('item_original_price_without_vat', '');
            $this->p['item_final_price_with_vat']       =
$iP->get('item_final_price_with_vat', '');
            $this->p['item_final_price_without_vat']    =
$iP->get('item_final_price_without_vat', '');
            $this->p['item_vat']                        =
$iP->get('item_vat', '');
            $this->p['item_currency']                   =
$iP->get('item_currency', '');
            $this->p['item_url_image']                  =
$iP->get('item_url_image', '');
            $this->p['item_url_video']                  =
$iP->get('item_url_video', '');
            $this->p['item_category']                   =
$iP->get('item_category', '');
            $this->p['item_categories']                 =
$iP->get('item_categories', '');
            $this->p['feed_category']                   =
$iP->get('feed_category', '');
            $this->p['item_manufacturer']               =
$iP->get('item_manufacturer', '');
            $this->p['item_stock']                      =
$iP->get('item_stock', '');
            $this->p['item_delivery_date']              =
$iP->get('item_delivery_date', '');     // Stock
Status
            $this->p['item_delivery_date_date']         =
$iP->get('item_delivery_date_date', '');// Real Date
            $this->p['feed_delivery_date']              =
$iP->get('feed_delivery_date', '');
            $this->p['item_attribute']                  =
$iP->get('item_attribute', '');
            $this->p['item_attribute_name']             =
$iP->get('item_attribute_name', '');
            $this->p['item_attribute_value']            =
$iP->get('item_attribute_value', '');
            $this->p['item_specification']              =
$iP->get('item_specification', '');
            $this->p['item_specification_group_name']   =
$iP->get('item_specification_group_name', '');
            $this->p['item_specification_name']         =
$iP->get('item_specification_name', '');
            $this->p['item_specification_value']        =
$iP->get('item_specification_value', '');
            $this->p['item_url']                        =
$iP->get('item_url', '');
            $this->p['item_condition']                  =
$iP->get('item_condition', '');
            $this->p['item_reward_points']              =
$iP->get('item_reward_points', '');
            $this->p['item_reward_points_name']         =
$iP->get('item_reward_points_name', '');
            $this->p['item_reward_points_value']        =
$iP->get('item_reward_points_value', '');
            $this->p['item_type_feed']                  =
$iP->get('item_type_feed', '');
            $this->p['item_category_type_feed']         =
$iP->get('item_category_type_feed', '');

            $this->p['item_fixed_elements'] =
$iP->get('item_fixed_elements', '');

            /*
            // We can find specific feed and customize it for specific
needs
            // E.g. Heureka
            $this->t['feed']Name = '';
            if (isset($this->t['feed']['title'])) {
                if
(strpos(strtolower($this->t['feed']['title']),
'heureka') !== false) {
                    $this->t['feed']Name =
'heureka';
                }
            }
            */


            // Load all categories for a product or only one
            // This influences two parameters: Categories and Product
Category Type
            $categoriesList = 0;
            if ($this->p['load_all_categories'] == 1) {
                $categoriesList = 5;
            }

            // Possible feature - accept languages
            $this->t['products'] =
PhocacartProduct::getProducts(0, (int)$this->p['item_limit'],
$this->p['item_ordering'],
$this->p['category_ordering'],
$this->p['export_published_only'],
$this->p['export_in_stock_only'],
$this->p['export_price_only'], $categoriesList);

            parent::display($tpl);
        }
    }
}

?>
views/index.html000064400000000054151167552070007706
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/info/index.html000064400000000054151167552070010641
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/info/metadata.xml000064400000000325151167552070011147
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<!--<view title="COM_PHOCACART_INFO_GROUP">
		<message><![CDATA[COM_PHOCACART_INFO_GROUP_DESC]]></message>
	</view>-->
	<view hidden="true" />
</metadata>
views/info/tmpl/default.php000064400000007723151167552070011767
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Plugin\PluginHelper;

defined('_JEXEC') or die();
echo '<div id="ph-pc-info-box"
class="pc-info-view'.$this->p->get(
'pageclass_sfx' ).'">';

echo
PhocacartRenderFront::renderHeader(array(JText::_('COM_PHOCACART_INFO')));

if ( $this->t['info_view_description'] != '') {
	echo '<div class="ph-desc">'.
$this->t['info_view_description']. '</div>';
}

switch($this->t['infoaction']) {

	case 1:
		// ORDER PROCESSED - STANDARD PRODUCTS (ORDER/NO DOWNLOAD)
		echo $this->loadTemplate('order_nodownload');
	break;

	case 2:
		// ORDER PROCESSED - DOWNLOADABLE ITEMS (No payment made, display only
information about possible downloads) (ORDER/DOWNLOAD)
		echo $this->loadTemplate('order_download');
	break;

	case 3:
		// ORDER PROCESSED - STANDARD PRODUCTS - PAYMENT MADE (PAYMENT/NO
DOWNLOAD)
		echo $this->loadTemplate('payment_nodownload');
	break;

	case 4:
		// ORDER PROCESSED - DOWNLOADABLE ITEMS - PAYMENT MADE (Payment made,
link to download could be possible) (PAYMENT/DOWNLOAD)
		echo $this->loadTemplate('payment_download');
	break;

	case 5:
		// PAYMENT CANCELED
		echo $this->loadTemplate('payment_canceled');
	break;

}

// Display Shipping Method Info Description
if (isset($this->t['infodata']['shipping_id'])
&& (int)$this->t['infodata']['shipping_id']
> 0) {

    $shippingDescription =
PhocacartShipping::getInfoDescriptionById((int)$this->t['infodata']['shipping_id']);
    if ($shippingDescription != '') {
        echo '<div
class="ph-info-shipping-description">'.HTMLHelper::_('content.prepare',
$shippingDescription).'</div>';
    }

}

// Run shipping method event
if (isset($this->t['infodata']['shipping_method'])
&& $this->t['infodata']['shipping_method']
!= '') {
	$pluginShipping = PluginHelper::importPlugin('pcs');
	if ($pluginShipping) {

		PluginHelper::importPlugin('pcs',
htmlspecialchars(strip_tags($this->t['infodata']['shipping_method'])));
		$eventData               = array();
		$eventData['pluginname'] =
htmlspecialchars(strip_tags($this->t['infodata']['shipping_method']));
		$results =
Factory::getApplication()->triggerEvent('PCSonInfoViewDisplayContent',
array($this->t['infodata'], $eventData));
		if (isset($results[0]['content']) &&
$results[0]['content'] != '') {
			echo '<div
class="ph-info-shipping-content">'.$results[0]['content'].'</div>';
		}
	}
}

// Display Payment Method Info Description
if (isset($this->t['infodata']['payment_id'])
&& (int)$this->t['infodata']['payment_id']
> 0) {

    $paymentDescription =
PhocacartPayment::getInfoDescriptionById((int)$this->t['infodata']['payment_id']);
    if ($paymentDescription != '') {
        echo '<div
class="ph-info-payment-description">'.HTMLHelper::_('content.prepare',
$paymentDescription).'</div>';
    }

}

// Run payment method event
if (isset($this->t['infodata']['payment_method'])
&& $this->t['infodata']['payment_method'] !=
'') {
	$pluginPayment = PluginHelper::importPlugin('pcp');
	if ($pluginPayment) {

		PluginHelper::importPlugin('pcp',
htmlspecialchars(strip_tags($this->t['infodata']['payment_method'])));
		$eventData               = array();
		$eventData['pluginname'] =
htmlspecialchars(strip_tags($this->t['infodata']['payment_method']));
		$results =
Factory::getApplication()->triggerEvent('PCPonInfoViewDisplayContent',
array($this->t['infodata'], $eventData));
		if (isset($results[0]['content']) &&
$results[0]['content'] != '') {
			echo '<div
class="ph-info-payment-content">'.$results[0]['content'].'</div>';
		}
	}
}

echo '</div>';// end ph-pc-info-box
echo '<div>&nbsp;</div>';
echo PhocacartUtilsInfo::getInfo();
?>
views/info/tmpl/default.xml000064400000000714151167552070011771
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_PHOCACART_INFO_LAYOUT">
		<message>
			<![CDATA[COM_PHOCACART_INFO_LAYOUT_DESC]]>
		</message>
	</layout>
	
		<name>COM_PHOCACART_INFO_LAYOUT</name>
		<description>COM_PHOCACART_INFO_LAYOUT_DESC</description>
		
		<fields name="params">
<fieldset name="basic"
addfieldpath="/administrator/components/com_phocacart/models/fields"
>

			
		</fieldset>
</fields>

</metadata>views/info/tmpl/default_order_download.php000064400000001551151167552070015042
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

// ORDER PROCESSED - DOWNLOADABLE ITEMS (No payment made, display only
information about possible downloads) (ORDER/DOWNLOAD)
echo '<div class="alert alert-success">';

if (isset($this->t['infomessage']['order_download'])
&& $this->t['infomessage']['order_download']
!= '') {
	echo $this->t['infomessage']['order_download'];
} else {
	echo JText::_('COM_PHOCACART_ORDER_SUCCESSFULLY_PROCESSED');
	echo '</br>' .
JText::_('COM_PHOCACART_ORDER_PROCESSED_DOWNLOADABLE_ITEMS_ADDITIONAL_INFO');
}

echo '</div>';
?>views/info/tmpl/default_order_nodownload.php000064400000001431151167552070015374
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

// ORDER PROCESSED - STANDARD PRODUCTS (ORDER/NO DOWNLOAD)
echo '<div class="alert alert-success">';

if
(isset($this->t['infomessage']['order_nodownload'])
&&
$this->t['infomessage']['order_nodownload'] !=
'') {
	echo $this->t['infomessage']['order_nodownload'];
} else {
	echo JText::_('COM_PHOCACART_ORDER_SUCCESSFULLY_PROCESSED');
	echo '</br>' .
JText::_('COM_PHOCACART_ORDER_PROCESSED_ADDITIONAL_INFO');
}

echo '</div>';
?>views/info/tmpl/default_payment_canceled.php000064400000001353151167552070015333
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

// PAYMENT CANCELED
echo '<div class="alert alert-error">';

if
(isset($this->t['infomessage']['payment_canceled'])
&&
$this->t['infomessage']['payment_canceled'] !=
'') {
	echo $this->t['infomessage']['payment_canceled'];
} else {
	echo JText::_('COM_PHOCACART_PAYMENT_CANCELED');
	echo '</br>' .
JText::_('COM_PHOCACART_ORDER_PAYMENT_CANCELED_ADDITIONAL_INFO');
}

echo '</div>';
?>views/info/tmpl/default_payment_download.php000064400000002366151167552070015411
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
// ORDER PROCESSED - DOWNLOADABLE ITEMS - PAYMENT MADE (Payment made, link
to download could be possible) (PAYMENT/DOWNLOAD)	
// if user is logged in he/she will get the information about the download
link
// if user is a guest - because of security reason we will not display the
download link (by security token),
// user should get it per email
echo '<div class="alert alert-success">';

if
(isset($this->t['infomessage']['payment_download'])
&&
$this->t['infomessage']['payment_download'] !=
'') {
	echo $this->t['infomessage']['payment_download'];
} else {
	echo
JText::_('COM_PHOCACART_ORDER_AND_PAYMENT_SUCCESSFULLY_PROCESSED');
	echo '</br>' .
JText::_('COM_PHOCACART_ORDER_PAYMENT_PROCESSED_DOWNLOADABLE_ITEMS_ADDITIONAL_INFO');
}

echo '</div>';

if ($this->u->id > 0) {
	echo '<div><a
href="'.PhocacartRoute::getDownloadRoute().'">'.JText::_('COM_PHOCACART_DOWNLOAD_LINK').'</a></div>';
}
?>views/info/tmpl/default_payment_nodownload.php000064400000001504151167552070015737
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

// ORDER PROCESSED - STANDARD PRODUCTS - PAYMENT MADE (PAYMENT/NO
DOWNLOAD)
echo '<div class="alert alert-success">';

if
(isset($this->t['infomessage']['payment_nodownload'])
&&
$this->t['infomessage']['payment_nodownload'] !=
'') {
	echo
$this->t['infomessage']['payment_nodownload'];
} else {
	echo
JText::_('COM_PHOCACART_ORDER_AND_PAYMENT_SUCCESSFULLY_PROCESSED');
	echo '</br>' .
JText::_('COM_PHOCACART_ORDER_PAYMENT_PROCESSED_ADDITIONAL_INFO');
}

echo '</div>';
?>views/info/tmpl/index.html000064400000000054151167552070011615
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/info/view.html.php000064400000003574151167552070011304
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');
class PhocaCartViewInfo extends JViewLegacy
{
	protected $t;
	protected $r;
	protected $p;
	protected $u;
	protected $s;

	function display($tpl = null) {

		$document					= JFactory::getDocument();
		$app						= JFactory::getApplication();
		$uri 						= \Joomla\CMS\Uri\Uri::getInstance();
		$this->u					= PhocacartUser::getUser();
		$this->p					= $app->getParams();
		$this->s                    = PhocacartRenderStyle::getStyles();

		$this->t['info_view_description']			= $this->p->get(
'info_view_description', '' );
		$this->t['info_view_description']			=
PhocacartRenderFront::renderArticle($this->t['info_view_description']);

		$session 				= JFactory::getSession();
		$this->t['infoaction'] 	=
$session->get('infoaction', 0, 'phocaCart');
		$this->t['infomessage'] =
$session->get('infomessage', array(), 'phocaCart');
		$this->t['infodata'] 	=
$session->get('infodata', array(), 'phocaCart');

		$session->set('infoaction', 0, 'phocaCart');
		$session->set('infomessage', array(),
'phocaCart');
		$session->set('infodata', array(), 'phocaCart');//
order_id, order_token, payment_id, payment_method, shipping_id,
shipping_method, user_id


		$media = PhocacartRenderMedia::getInstance('main');
		$media->loadBase();
		$media->loadSpec();


		$this->_prepareDocument();
		parent::display($tpl);
	}

	protected function _prepareDocument() {
		PhocacartRenderFront::prepareDocument($this->document, $this->p,
false, false, JText::_('COM_PHOCACART_INFO'));
	}
}
?>
views/item/index.html000064400000000054151167552070010644
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/item/metadata.xml000064400000000263151167552070011153
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view title="COM_PHOCACART_ITEM_GROUP">
		<message><![CDATA[COM_PHOCACART_ITEM_GROUP_DESC]]></message>
	</view>
</metadata>views/item/tmpl/default.php000064400000106775151167552070012001
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

$layoutC 	= new JLayoutFile('button_compare', null,
array('component' => 'com_phocacart'));
$layoutW 	= new JLayoutFile('button_wishlist', null,
array('component' => 'com_phocacart'));
$layoutP	= new JLayoutFile('product_price', null,
array('component' => 'com_phocacart'));
$layoutS	= new JLayoutFile('product_stock', null,
array('component' => 'com_phocacart'));
$layoutID	= new JLayoutFile('product_id', null,
array('component' => 'com_phocacart'));
$layoutPP	= new JLayoutFile('product_play', null,
array('component' => 'com_phocacart'));
$layoutA	= new JLayoutFile('button_add_to_cart_item', null,
array('component' => 'com_phocacart'));
$layoutA2	= new JLayoutFile('button_buy_now_paddle', null,
array('component' => 'com_phocacart'));
$layoutA3	= new JLayoutFile('button_external_link', null,
array('component' => 'com_phocacart'));
$layoutQ	= new JLayoutFile('button_ask_question', null,
array('component' => 'com_phocacart'));
$layoutPD	= new JLayoutFile('button_public_download', null,
array('component' => 'com_phocacart'));
$layoutEL	= new JLayoutFile('link_external_link', null,
array('component' => 'com_phocacart'));
$layoutAB	= new JLayoutFile('attribute_options_box', null,
array('component' => 'com_phocacart'));
$layoutPOQ	= new JLayoutFile('product_order_quantity', null,
array('component' => 'com_phocacart'));
$layoutSZ	= new JLayoutFile('product_size', null,
array('component' => 'com_phocacart'));
$layoutI	= new JLayoutFile('image', null,
array('component' => 'com_phocacart'));
$layoutAAQ	= new JLayoutFile('popup_container_iframe', null,
array('component' => 'com_phocacart'));

echo '<div id="ph-pc-item-box"
class="pc-item-view'.$this->p->get(
'pageclass_sfx' ).'">';


if (isset($this->category[0]->id) &&
($this->t['display_back'] == 2 ||
$this->t['display_back'] == 3)) {
	if ($this->category[0]->id > 0) {
		$linkUp =
JRoute::_(PhocacartRoute::getCategoryRoute($this->category[0]->id,
$this->category[0]->alias));
		$linkUpText = $this->category[0]->title;
	} else {
		$linkUp 	= false;
		$linkUpText = false;
	}

	if ($linkUp && $linkUpText) {
		echo '<div class="ph-top">'
		.'<a
class="'.$this->s['c']['btn.btn-success'].'"
title="'.$linkUpText.'" href="'.
$linkUp.'" >'
        .'<span
class="'.$this->s['i']['back-category'].'"></span>
'.JText::_($linkUpText).'</a>'
        .'</div>';
	}
}

echo $this->t['event']->onItemBeforeHeader;


$popupAskAQuestion = 0;// we need this info for the container at the bottom
(if modal popup is used for ask a question)
$x = isset($this->item[0]) ? $this->item[0]: 0;

if (!empty($x) && isset($x->id) && (int)$x->id >
0) {

	$idName			= 'VItemP'.(int)$x->id;
	echo '<div
class="'.$this->s['c']['row'].'">';

	// === IMAGE PANEL
	echo '<div id="phImageBox"
class="'.$this->s['c']['col.xs12.sm5.md5']
.'">';

	//JPluginHelper::importPlugin('pcv');
	$results =
\JFactory::getApplication()->triggerEvent('PCVonItemImage',
array('com_phocacart.item', &$x, &$this->t,
&$this->p));
	$imageOutput = trim(implode("\n", $results));


	if ($imageOutput != '') {
		echo $imageOutput;// rendered by plugin
	} else {

		$label = PhocacartRenderFront::getLabel($x->date, $x->sales,
$x->featured);


		// IMAGE
		$image =
PhocacartImage::getThumbnailName($this->t['pathitem'],
$x->image, 'large');// Image
		$imageL =
PhocacartImage::getThumbnailName($this->t['pathitem'],
$x->image, 'large');// Image Link to enlarge


		// Some of the attribute is selected - this attribute include image so
the image should be displayed instead of default
		$imageA =
PhocaCartImage::getImageChangedByAttributes($this->t['attr_options'],
'large');
		if ($imageA != '') {
			$image =
PhocacartImage::getThumbnailName($this->t['pathitem'],
$imageA, 'large');
			$imageL =
PhocacartImage::getThumbnailName($this->t['pathitem'],
$imageA, 'large');
		}

		$link = JURI::base(true) . '/' . $imageL->rel;// Thumbnail
		//$link = JURI::base(true) . '/' .
$this->t['pathitem']['orig_rel_ds'] .
$x->image;// Original image
		if ($this->t['display_webp_images'] == 1) {
			$link = JURI::base(true) . '/' . $imageL->rel_webp;
		}


		if (isset($image->rel) && $image->rel != '') {

			$altValue = PhocaCartImage::getAltTitle($x->title, $image->rel);

			echo '<div class="ph-item-image-full-box ' .
$label['cssthumbnail'] . '">';
			echo '<div class="ph-label-box">';
			echo $label['new'] . $label['hot'] .
$label['feat'];
			if ($this->t['taglabels_output'] != '') {
				echo $this->t['taglabels_output'];
			}
			echo '</div>';

			$imageS =
PhocacartImage::getThumbnailName($this->t['pathitem'],
$x->image, 'small');
			$linkS = JURI::base(true) . '/' . $imageS->rel;//
Thumbnail
			if ($this->t['display_webp_images'] == 1) {
				$linkS = JURI::base(true) . '/' . $imageS->rel_webp;
			}
			echo '<a href="' . $link . '" ' .
$this->t['image_rel'] . ' class="' .
$this->t['image_class'] . ' phjProductHref' .
$idName . ' phImageFullHref" data-href="' . $link .
'" data-href-s="' . $linkS . '">';

			$d = array();
			$d['t'] = $this->t;
			$d['s'] = $this->s;
			$d['src'] = JURI::base(true) . '/' .
$image->rel;
			$d['data-image'] = JURI::base(true) . '/' .
$image->rel;
			$d['data-image-webp'] = JURI::base(true) . '/' .
$image->rel_webp;
			$d['alt-value'] = PhocaCartImage::getAltTitle($x->title,
$image->rel);
			$d['srcset-webp'] = $d['data-image-webp'];
			$d['data-image-meta'] = $d['data-image'];
			$d['class'] =
PhocacartRenderFront::completeClass(array($this->s['c']['img-responsive'],
$label['cssthumbnail2'], 'ph-image-full',
'phImageFull', 'phjProductImage' . $idName));
			$d['style'] = '';
			if (isset($this->t['image_width']) &&
(int)$this->t['image_width'] > 0 &&
isset($this->t['image_height']) &&
(int)$this->t['image_height'] > 0) {
				$d['style'] = 'width:' .
$this->t['image_width'] . 'px;height:' .
$this->t['image_height'] . 'px';
			}
			echo $layoutI->render($d);

			echo '</a>';

			echo '</div>' . "\n";// end
item_row_item_box_full_image
		}


		// ADDITIONAL IMAGES
		if (!empty($this->t['add_images'])) {

			echo '<div class="' .
$this->s['c']['row'] . '
ph-item-image-add-box">';

			foreach ($this->t['add_images'] as $v2) {
				echo '<div class="' .
$this->s['c']['col.xs12.sm4.md4'] . '
ph-item-image-box">';
				$image =
PhocacartImage::getThumbnailName($this->t['pathitem'],
$v2->image, 'small');
				$imageL =
PhocacartImage::getThumbnailName($this->t['pathitem'],
$v2->image, 'large');
				$link = JURI::base(true) . '/' . $imageL->rel;
				if ($this->t['display_webp_images'] == 1) {
					$link = JURI::base(true) . '/' . $imageL->rel_webp;
				}

				$altValue = PhocaCartImage::getAltTitle($x->title, $v2->image);

				echo '<a href="' . $link . '" ' .
$this->t['image_rel'] . '  class="' .
$this->t['image_class'] . '
phImageAdditionalHref">';

				$d = array();
				$d['t'] = $this->t;
				$d['s'] = $this->s;
				$d['src'] = JURI::base(true) . '/' .
$image->rel;
				$d['srcset-webp'] = JURI::base(true) . '/' .
$image->rel_webp;
				$d['alt-value'] = PhocaCartImage::getAltTitle($x->title,
$v2->image);
				$d['class'] =
PhocacartRenderFront::completeClass(array($this->s['c']['img-responsive'],
$label['cssthumbnail2'], 'ph-image-full',
'phImageAdditional', /*,
'phjProductImage'.$idName*/));
				echo $layoutI->render($d);

				echo '</a>';
				echo '</div>';
			}

			echo '</div>';// end additional images
		}
	} // end image output

	echo '</div>';// end item_row_item_c1




	// === PRICE PANEL
	echo '<div
class="'.$this->s['c']['col.xs12.sm7.md7'].'">';
	echo '<div class="ph-item-price-panel
phItemPricePanel">';

	$title = '';
	if (isset($this->item[0]->title) &&
$this->item[0]->title != '') {
		$title = $this->item[0]->title;
	}


	echo PhocacartRenderFront::renderHeader(array($title));



	// :L: PRICE
	$price 				= new PhocacartPrice;// Can be used by options


	$priceItems = array();
	if ($this->t['can_display_price']) {

		$priceItems	= $price->getPriceItems($x->price, $x->taxid,
$x->taxrate, $x->taxcalculationtype, $x->taxtitle,
$x->unit_amount, $x->unit_unit, 1, 1, $x->group_price);

		// Can change price and also SKU OR EAN (Advanced Stock and Price
Management)
		$price->getPriceItemsChangedByAttributes($priceItems,
$this->t['attr_options'], $price, $x);

		$d					= array();
		$d['s']				= $this->s;
		$d['type']          = $x->type;// PRODUCTTYPE
		$d['priceitems']	= $priceItems;

		$d['priceitemsorig']= array();
		if ($x->price_original != '' &&
$x->price_original > 0) {
			$d['priceitemsorig'] =
$price->getPriceItems($x->price_original, $x->taxid,
$x->taxrate, $x->taxcalculationtype);
		}
		$d['class']			= 'ph-item-price-box';
		$d['product_id']	= (int)$x->id;
		$d['typeview']		= 'Item';

		// Display discount price
		// Move standard prices to new variable (product price -> product
discount)
		$d['priceitemsdiscount']		= $d['priceitems'];
		$d['discount'] 					=
PhocacartDiscountProduct::getProductDiscountPrice($x->id,
$d['priceitemsdiscount']);

		// Display cart discount (global discount) in product views - under
specific conditions only
		// Move product discount prices to new variable (product price ->
product discount -> product discount cart)
		$d['priceitemsdiscountcart']	=
$d['priceitemsdiscount'];
		$d['discountcart']				=
PhocacartDiscountCart::getCartDiscountPriceForProduct($x->id,
$x->catid, $d['priceitemsdiscountcart']);

		$d['zero_price']		= 1;// Apply zero price if possible
		echo $layoutP->render($d);
	}

	if ( isset($x->description) && $x->description !=
'') {
		echo '<div class="ph-desc">'.
Joomla\CMS\HTML\HTMLHelper::_('content.prepare',
$x->description). '</div>';
	}
	// REWARD POINTS - NEEDED
	$pointsN = PhocacartReward::getPoints($x->points_needed,
'needed');
	if ($pointsN) {
		echo '<div class="ph-item-reward-box">';
		echo '<div
class="ph-reward-txt">'.JText::_('COM_PHOCACART_PRICE_IN_REWARD_POINTS').'</div>';

		echo '<div
class="ph-reward">'.$pointsN.'</div>';
		echo '</div>';
		echo '<div class="ph-cb"></div>';
	}

	// REWARD POINTS - RECEIVED
	$pointsR = PhocacartReward::getPoints($x->points_received,
'received', $x->group_points_received);
	if ($pointsR) {
		echo '<div class="ph-item-reward-box">';
		echo '<div
class="ph-reward-txt">'.JText::_('COM_PHOCACART_REWARD_POINTS').'</div>';

		echo '<div
class="ph-reward">'.$pointsR.'</div>';
		echo '</div>';
		echo '<div class="ph-cb"></div>';
	}


	if (isset($x->manufacturertitle) && $x->manufacturertitle !=
'') {
		echo '<div class="ph-item-manufacturer-box">';
		echo '<div
class="ph-manufacturer-txt">'.JText::_('COM_PHOCACART_MANUFACTURER').':</div>';
		echo '<div class="ph-manufacturer">';
		echo PhocacartRenderFront::displayLink($x->manufacturertitle,
$x->manufacturerlink);
		echo '</div>';
		echo '</div>';
		echo '<div class="ph-cb"></div>';
	}



	// STOCK ===================================================
	// Set stock: product, variations, or advanced stock status
	// There are classes because AJAX can change the visibility of buttons
	// Last word when checking if product can be ordered have always checkout
	$class_btn	= '';
	$class_icon	= '';

	$stock =
PhocacartStock::getStockItemsChangedByAttributes($this->t['stock_status'],
$this->t['attr_options'], $x);

	if ($this->t['hide_add_to_cart_stock'] == 1 &&
(int)$stock < 1) {
		$class_btn 					= 'ph-visibility-hidden';
		$class_icon					= 'ph-display-none';
	}

	if ($this->t['display_stock_status'] == 1 ||
$this->t['display_stock_status'] == 3) {


		if($this->t['stock_status']['stock_status'] ||
$this->t['stock_status']['stock_count'] !== false)
{
			$d							= array();
			$d['s']						= $this->s;
			$d['class']					= 'ph-item-stock-box';
			$d['product_id']			= (int)$x->id;
			$d['typeview']				= 'Item';
			$d['stock_status_output'] 	=
PhocacartStock::getStockStatusOutput($this->t['stock_status']);

			echo $layoutS->render($d);
		}

		if($this->t['stock_status']['min_quantity']) {
			$dPOQ						= array();
			$dPOQ['s']					= $this->s;
			$dPOQ['text']				=
JText::_('COM_PHOCACART_MINIMUM_ORDER_QUANTITY');
			$dPOQ['status']				=
$this->t['stock_status']['min_quantity'];
			echo $layoutPOQ->render($dPOQ);
		}

		if($this->t['stock_status']['min_multiple_quantity'])
{
			$dPOQ						= array();
			$dPOQ['s']					= $this->s;
			$dPOQ['text']				=
JText::_('COM_PHOCACART_MINIMUM_MULTIPLE_ORDER_QUANTITY');
			$dPOQ['status']				=
$this->t['stock_status']['min_multiple_quantity'];
			echo $layoutPOQ->render($dPOQ);
		}
	}

	if ((int)$this->t['item_display_delivery_date'] > 0
&& $x->delivery_date != '' &&
$x->delivery_date != '0000-00-00 00:00:00') {

		echo '<div
class="ph-item-delivery-date-box">';
		echo '<div
class="ph-delivery-date-txt">'.JText::_('COM_PHOCACART_DELIVERY_DATE').':</div>';
		echo '<div class="ph-delivery-date">';
		echo JHtml::date($x->delivery_date, 'DATE_FORMAT_LC3');
		echo '</div>';
		echo '</div>';
		echo '<div class="ph-cb"></div>';
	}

	// END STOCK ================================================



	// SIZE OPTIONS =============================================
	if ((int)$this->t['item_display_size_options'] > 0){

		$dSZ						= array();
		$dSZ['s']					= $this->s;
		$dSZ['length']				= $x->length;
		$dSZ['width']				= $x->width;
		$dSZ['height']				= $x->height;
		$dSZ['weight']				= $x->weight;
		$dSZ['volume']				= $x->volume;
		$dSZ['unit_amount']			= $x->unit_amount;
		$dSZ['unit_unit']			= $x->unit_unit;
		echo $layoutSZ->render($dSZ);
	}
	// END SIZE OPTIONS =========================================

	// ID OPTIONS (SKU, EAN, UPC, ...) ==========================

	$id = new PhocacartId();
	$id->getIdItemsChangedByAttributes($x,
$this->t['attr_options']);

	$dID						= array();
	$dID['s']					= $this->s;
	$dID['x']					= $x;
	$dID['class']			= 'ph-item-id-box';
	$dID['product_id']	= (int)$x->id;
	$dID['typeview']		= 'Item';
	echo $layoutID->render($dID);
	// END ID OPTIONS ===========================================


	// This form can get two events:
	// when option selected - price or image is changed id=phItemPriceBoxForm
	// when ajax cart is active and submit button is clicked
class=phItemCartBoxForm

	echo '<form 
	id="phCartAddToCartButton'.(int)$x->id.'"
	class="phItemCartBoxForm phjAddToCart phjItem
phjAddToCartVItemP'.(int)$x->id.' form-inline" 
	action="'.$this->t['linkcheckout'].'"
method="post">';

	// ATTRIBUTES, OPTIONS

	$d							= array();
	$d['s']						= $this->s;
	$d['attr_options']			= $this->t['attr_options'];
	$d['hide_attributes']		=
$this->t['hide_attributes_item'];
	$d['dynamic_change_image'] 	=
$this->t['dynamic_change_image'];
	$d['zero_attribute_price']	=
$this->t['zero_attribute_price'];
	$d['remove_select_option_attribute']	=
$this->t['remove_select_option_attribute'];
	$d['pathitem']				= $this->t['pathitem'];
	$d['init_type']				= 0;
	$d['price']					= $price;
	$d['product_id']			= (int)$x->id;
	$d['gift_types']			= $x->gift_types;
	$d['image_size']			= 'large';
	$d['typeview']				= 'Item';
	$d['priceitems']			= $priceItems;
	echo $layoutAB->render($d);


	// :L: ADD TO CART
	$addToCartHidden = 0;// Button can be hidden based on price

	if ($x->type == 3) {
		// PRODUCTTYPE - price on demand product cannot be added to cart
		$addToCartHidden = 1;

	} else if ($this->t['hide_add_to_cart_zero_price'] == 1
&& $x->price == 0) {
		// Don't display Add to Cart in case the price is zero
		$addToCartHidden = 1;

	} else if ((int)$this->t['item_addtocart'] == 1 ||
(int)$this->t['item_addtocart'] == 4) {

		$d					= array();
		$d['s']				= $this->s;
		$d['id']			= (int)$x->id;
		$d['catid']			= $this->t['catid'];
		$d['return']		= $this->t['actionbase64'];
		$d['addtocart']		= $this->t['item_addtocart'];
		$d['typeview']		= 'Item';
		$d['class_btn']		= $class_btn;
		$d['class_icon']	= $class_icon;
		echo $layoutA->render($d);


	} else if ((int)$this->t['item_addtocart'] == 102 &&
(int)$x->external_id != '') {
		$d					= array();
		$d['s']				= $this->s;
		$d['external_id']	= (int)$x->external_id;
		$d['return']		= $this->t['actionbase64'];

		echo $layoutA2->render($d);
	} else if ((int)$this->t['item_addtocart'] == 103 &&
$x->external_link != '') {
		$d					= array();
		$d['s']				= $this->s;
		$d['external_link']	= $x->external_link;
		$d['external_text']	= $x->external_text;
		$d['return']		= $this->t['actionbase64'];
		echo $layoutA3->render($d);

	}


	echo '</form>';
	echo '<div class="ph-cb"></div>';


	echo $this->t['event']->onItemAfterAddToCart;
	echo '<div class="ph-top-space"></div>';




	if ($this->t['display_compare'] == 1 ||
$this->t['display_wishlist'] == 1) {
		//echo '<div class="ph-cb"></div>';
	}

	// :L: COMPARE
	if ($this->t['display_compare'] == 1) {
		$d			= array();
		$d['s']		= $this->s;
		$d['linkc']	= $this->t['linkcomparison'];
		$d['id']	= (int)$x->id;
		$d['catid']	= (int)$x->catid;
		$d['return']= $this->t['actionbase64'];
		$d['method']= $this->t['add_compare_method'];
		echo $layoutC->render($d);
	}

	// :L: WISHLIST
	if ($this->t['display_wishlist'] == 1) {
		$d			= array();
		$d['s']		= $this->s;
		$d['linkw']	= $this->t['linkwishlist'];
		$d['id']	= (int)$x->id;
		$d['catid']	= (int)$x->catid;
		$d['return']= $this->t['actionbase64'];
		$d['method']= $this->t['add_wishlist_method'];
		echo $layoutW->render($d);
	}

	echo '<div class="ph-cb"></div>';

	// :L: PUBLIC DOWNLOAD
	if ($this->t['display_public_download'] == 1 &&
$x->public_download_file != '') {
		$d					= array();
		$d['s']				= $this->s;
		$d['linkdownload']	= $this->t['linkdownload'];
		$d['id']			= (int)$x->id;
		$d['return']		= $this->t['actionbase64'];
		$d['title']			= '';
		if ($x->public_download_text != '') {
			$d['title']		= $x->public_download_text;
		}

		echo '<div class="ph-cb"></div>';
		echo $layoutPD->render($d);
	}

	// :L: PUBLIC FILE PLAY
	if ($this->t['display_file_play'] == 1 &&
$x->public_play_file != '') {
		$d						= array();
		$d['s']					= $this->s;
		$d['id']				= (int)$x->id;
		$d['publicplayfile']	= $x->public_play_file;
		$d['pathpublicfile'] 	=
$this->t['pathpublicfile'];
		$d['title']				= '';
		if ($x->public_play_text != '') {
			$d['title']			= $x->public_play_text;
		}

		echo '<div class="ph-cb"></div>';
		echo $layoutPP->render($d);
	}

	// :L: EXTERNAL LINK
	if ($this->t['display_external_link'] == 1 &&
$x->external_link != '') {
		$d					= array();
		$d['s']				= $this->s;
		$d['linkexternal']	= $x->external_link;
		//$d['id']			= (int)$x->id;
		//$d['return']		= $this->t['actionbase64'];
		$d['title']			= '';
		if ($x->external_text != '') {
			$d['title']		= $x->external_text;
		}

		echo '<div class="ph-cb"></div>';
		echo $layoutEL->render($d);
	}

	// :L: EXTERNAL LINK 2
	if ($this->t['display_external_link'] == 1 &&
$x->external_link2 != '') {
		$d					= array();
		$d['s']				= $this->s;
		$d['linkexternal']	= $x->external_link2;
		//$d['id']			= (int)$x->id;
		//$d['return']		= $this->t['actionbase64'];
		$d['title']			= '';
		if ($x->external_text2 != '') {
			$d['title']		= $x->external_text2;
		}

		echo '<div class="ph-cb"></div>';
		echo $layoutEL->render($d);
	}

	// ASK A QUESTION
	if (((int)$this->t['item_askquestion'] == 1) ||
($this->t['item_askquestion'] == 2 &&
((int)$this->t['item_addtocart'] == 0 || $addToCartHidden !=
0))) {

		$d					= array();
		$d['s']				= $this->s;
		$d['id']			= (int)$x->id;
		$d['catid']			= $this->t['catid'];
		$d['popup']			= 0;
		$tmpl				= '';
		if ((int)$this->t['popup_askquestion'] > 0) {
			$d['popup']			=
(int)$this->t['popup_askquestion'];
			$popupAskAQuestion	= (int)$this->t['popup_askquestion'];
			$tmpl				= 'tmpl=component';
		}
		$d['link']			= 
JRoute::_(PhocacartRoute::getQuestionRoute($x->id, $x->catid,
$x->alias, $x->catalias, $tmpl));
		$d['return']		= $this->t['actionbase64'];

		echo '<div class="ph-cb"></div>';
		echo $layoutQ->render($d);
	}


	echo '<div class="ph-cb"></div>';

	echo $this->t['event']->onItemBeforeEndPricePanel;// View
Plugin

	echo $this->t['event']->PCPonItemBeforeEndPricePanel;//
Payment Plugin

	echo '</div>';// end item_row_item_box_price
	echo '</div>';// end item_row_item_c2

	echo '</div>';// end item_row

	echo '<div class="ph-item-bottom-box">';



	// TABS
	$active 		= $this->s['c']['tabactive'];
	$activeTab 		= $this->s['c']['tabactvietab'];// Not
displayed in Bootstrap4
	$tabO	= '';
	$tabLiO	= '';

	// DESCRIPTION
	if (isset($x->description_long) && $x->description_long !=
'') {
		$tabLiO .= '<li
class="'.$this->s['c']['nav-item'].'
'.$activeTab.'"><a href="#phdescription"
data-toggle="tab"
class="'.$this->s['c']['nav-link'].'
'.$active.'">'.JText::_('COM_PHOCACART_DESCRIPTION').'</a></li>';

		$tabO 	.= '<div
class="'.$this->s['c']['tabpane'].'
ph-tab-pane '.$active.'"
id="phdescription">';
		$tabO	.= Joomla\CMS\HTML\HTMLHelper::_('content.prepare',
$x->description_long);
		$tabO	.= '</div>';
		$active = $activeTab = '';
	}

	// FEATURES
	if (isset($x->features) && $x->features != '') {
		$tabLiO .= '<li
class="'.$this->s['c']['nav-item'].'
'.$activeTab.'"><a href="#phfeatures"
data-toggle="tab"
class="'.$this->s['c']['nav-link'].'
'.$active.'">'.JText::_('COM_PHOCACART_FEATURES').'</a></li>';

		$tabO 	.= '<div
class="'.$this->s['c']['tabpane'].'
ph-tab-pane '.$active.'"
id="phfeatures">';
		$tabO	.= Joomla\CMS\HTML\HTMLHelper::_('content.prepare',
$x->features);
		$tabO	.= '</div>';
		$active = $activeTab = '';
	}

	// VIDEO
	if (isset($x->video) && $x->video != '') {
		$tabLiO .= '<li
class="'.$this->s['c']['nav-item'].'
'.$activeTab.'"><a href="#phvideo"
data-toggle="tab"
class="'.$this->s['c']['nav-link'].'
'.$active.'">'.JText::_('COM_PHOCACART_VIDEO').'</a></li>';

		$tabO 	.= '<div
class="'.$this->s['c']['tabpane'].'
ph-tab-pane '.$active.'" id="phvideo">';
		$tabO	.= PhocacartRenderFront::displayVideo($x->video);
		$tabO	.= '</div>';
		$active = $activeTab = '';
	}

	// SPECIFICATION
	if (!empty($this->t['specifications'])){
		$tabLiO .= '<li
class="'.$this->s['c']['nav-item'].'
'.$activeTab.'"><a href="#phspecification"
data-toggle="tab"
class="'.$this->s['c']['nav-link'].'
'.$active.'">'.JText::_('COM_PHOCACART_SPECIFICATIONS').'</a></li>';
		$tabO 	.= '<div
class="'.$this->s['c']['tabpane'].'
ph-tab-pane '.$active.'"
id="phspecification">';


		foreach($this->t['specifications'] as $k => $v) {
			if(isset($v[0]) && $v[0] != '') {
				$tabO	.= '<h4
class="ph-spec-group-title">'.$v[0].'</h4>';
				unset($v[0]);
			}

			if (!empty($v)) {
				foreach($v as $k2 => $v2) {
					if (isset($v2['title']) &&
isset($v2['value'])) {
						$tabO .= '<div class="' .
$this->s['c']['row'] . '">';
						$tabO .= '<div class="' .
$this->s['c']['col.xs12.sm5.md5'] .
'">';
						$tabO .= '<div class="ph-spec-title">' .
$v2['title'] . '</div>';
						$tabO .= '</div>';

						$tabO .= '<div class="' .
$this->s['c']['col.xs12.sm7.md7'] .
'">';
						$tabO .= '<div class="ph-spec-value">' .
$v2['value'] . '</div>';
						$tabO .= '</div>';
						$tabO .= '</div>';
					}
				}
			}
		}

		$tabO	.= '</div>';
		$active = $activeTab = '';
	}


	// REVIEWS
	if ($this->t['enable_review'] > 0) {
		$tabLiO .= '<li
class="'.$this->s['c']['nav-item'].'
'.$activeTab.'"><a href="#phreview"
data-toggle="tab"
class="'.$this->s['c']['nav-link'].'
'.$active.'">'.JText::_('COM_PHOCACART_REVIEWS').'</a></li>';
		$tabO 	.= '<div
class="'.$this->s['c']['tabpane'].'
ph-tab-pane '.$active.'" id="phreview">';

		if (!empty($this->t['reviews'])) {
			foreach($this->t['reviews'] as $k => $v) {
				$rating = $v->rating;
				$tabO	.= '<div class="bs-callout
bs-callout-info">';
				$tabO	.= '<h4
class="ph-reviews-name">'.htmlspecialchars($v->name).'</h4>';
				$tabO	.= '<div><span
class="ph-stars"><span
style="width:'.((int)$rating * 16)
.'px;"></span></span></div>';
				$tabO	.= '<div
class="ph-reviews-review">'.htmlspecialchars($v->review).'</div>';
				$tabO	.= '</div>';
			}

		}
		if ((int)$this->u->id > 0) {


			$tabO	.= '<form
action="'.$this->t['linkitem'].'"
method="post"
class="'.$this->s['c']['item_review_form'].'">';
			// ROW
			$tabO	.= '<div
class="'.$this->s['c']['row'].'">';

			$tabO	.= '<div
class="'.$this->s['c']['col.xs12.sm2.md2'].'">';
			$tabO	.= '<div
class="ph-review-title">'.JText::_('COM_PHOCACART_RATING').'</div>';
			$tabO	.= '</div>';

			$tabO	.= '<div
class="'.$this->s['c']['col.xs12.sm10.md10'].'
ph-rating-box">';
			$tabO	.= '<div class="ph-review-value
ph-rating">';
			$tabO	.= '<select name="rating"
id="phitemrating">
						<option value="1">1</option>
						<option value="2">2</option>
						<option value="3">3</option>
						<option value="4">4</option>
						<option value="5">5</option>
						</select>';
			$tabO	.= '</div>';
			$tabO	.= '</div>';

			$tabO	.= '</div>';

			// ROW
			$tabO	.= '<div
class="'.$this->s['c']['row'].'">';

			$tabO	.= '<div
class="'.$this->s['c']['col.xs12.sm2.md2'].'">';
			$tabO	.= '<div
class="ph-review-title">'.JText::_('COM_PHOCACART_NAME').'</div>';
			$tabO	.= '</div>';

			$tabO	.= '<div
class="'.$this->s['c']['col.xs12.sm5.md5'].'">';
			$tabO	.= '<div class="ph-review-value"><input
type="text" name="name" class="form-control"
value="'. $this->u->name .'"
/></div>';
			$tabO	.= '</div>';

			$tabO	.= '<div
class="'.$this->s['c']['col.xs12.sm5.md5'].'"></div>';

			$tabO	.= '</div>';

			// ROW
			$tabO	.= '<div
class="'.$this->s['c']['row'].'">';

			$tabO	.= '<div
class="'.$this->s['c']['col.xs12.sm2.md2'].'">';
			$tabO	.= '<div
class="ph-review-title">'.JText::_('COM_PHOCACART_REVIEW').'</div>';
			$tabO	.= '</div>';

			$tabO	.= '<div
class="'.$this->s['c']['col.xs12.sm5.md5'].'">';
			$tabO	.= '<div class="ph-review-value"><textarea
class="" name="review"
rows="3"></textarea></div>';
			$tabO	.= '</div>';

			$tabO	.= '<div
class="'.$this->s['c']['col.xs12.sm5.md5'].'"></div>';

			$tabO	.= '</div>';

			// ROW
			$tabO	.= '<div
class="'.$this->s['c']['row'].'">';

			$tabO	.= '<div
class="'.$this->s['c']['col.xs12.sm2.md2'].'"></div>';

			$tabO	.= '<div
class="'.$this->s['c']['col.xs12.sm5.md5'].'">';
			$tabO	.= '<div
class="'.$this->s['c']['pull-right'].'">';
			$tabO	.= '<button
class="'.$this->s['c']['btn.btn-primary.btn-sm'].'
ph-btn"><span
class="'.$this->s['i']['edit'].'"></span>
'.JText::_('COM_PHOCACART_SUBMIT').'</button>';
			$tabO	.= '</div>';
			$tabO	.= '</div>';

			$tabO	.= '<div
class="'.$this->s['c']['col.xs12.sm5.md5'].'"></div>';

			$tabO	.= '</div>';

			// END ROW

			$tabO	.= Joomla\CMS\HTML\HTMLHelper::_('form.token');
			$tabO	.= '<input type="hidden" name="catid"
value="'.$this->t['catid'].'">';
			$tabO	.= '<input type="hidden" name="task"
value="item.review">';
			$tabO	.= '<input type="hidden" name="tmpl"
value="component" />';
			$tabO	.= '<input type="hidden" name="option"
value="com_phocacart" />';
			$tabO	.= '<input type="hidden" name="return"
value="'.$this->t['actionbase64'].'"
/>';
			$tabO	.= '</form>';

		} else {
			$tabO	.= '<div
class="ph-message">'.JText::_('COM_PHOCACART_ONLY_LOGGED_IN_USERS_CAN_MAKE_REVIEW_PLEASE_LOGIN').'</div>';
		}
		$tabO	.= '</div>';
		$active = $activeTab = '';
	}

	// RELATED PRODUCTS

	if (!empty($this->t['rel_products'])) {
		$tabLiO .= '<li
class="'.$this->s['c']['nav-item'].'
'.$activeTab.'"><a href="#phrelated"
data-toggle="tab"
class="'.$this->s['c']['nav-link'].'
'.$active.'">'.JText::_('COM_PHOCACART_RELATED_PRODUCTS').'</a></li>';

		$tabO 	.= '<div
class="'.$this->s['c']['tabpane'].'
ph-tab-pane '.$active.'"
id="phrelated">';

		$tabO	.= '<div
class="'.$this->s['c']['row'].'">';

		foreach($this->t['rel_products'] as $k => $v) {


			$tabO	.= '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm3.md3'].'">';
			$tabO	.= '<div class="ph-item-box grid
ph-item-thumbnail-related">';


			$tabO	.= '<div
class="'.PhocacartRenderFront::completeClass(array($this->s['c']['thumbnail'],
'ph-thumbnail', 'ph-thumbnail-c',
'ph-item')).'">';
			$tabO	.= '<div class="ph-item-content">';

			$image 	=
PhocacartImage::getThumbnailName($this->t['pathitem'],
$v->image, 'medium');

			// Try to find the best menu link
			if (isset($v->catid2) && (int)$v->catid2 > 0 &&
isset($v->catalias2) && $v->catalias2 != '') {
				$link 	= JRoute::_(PhocacartRoute::getItemRoute($v->id,
$v->catid2, $v->alias, $v->catalias2));
			} else {
				$link 	= JRoute::_(PhocacartRoute::getItemRoute($v->id,
$v->catid, $v->alias, $v->catalias));
			}
			$tabO	.= '<a href="'.$link.'">';
			if (isset($image->rel) && $image->rel != '') {
				/*$tabO	.= '<img
src="'.JURI::base(true).'/'.$image->rel.'"
alt=""
class="'.$this->s['c']['img-responsive'].'
ph-image"';
				if (isset($this->t['image_width']) &&
$this->t['image_width'] != '' &&
isset($this->t['image_height']) &&
$this->t['image_height'] != '') {
					$tabO	.= '
style="width:'.$this->t['image_width'].';height:'.$this->t['image_height'].'"';
				}
				$tabO	.= ' />';*/

				$d = array();
				$d['t'] = $this->t;
				$d['s'] = $this->s;
				$d['src'] = JURI::base(true) . '/' .
$image->rel;
				$d['srcset-webp'] = JURI::base(true) . '/' .
$image->rel_webp;
				$d['data-image'] = JURI::base(true) . '/' .
$image->rel;
				$d['data-image-webp'] = JURI::base(true) . '/' .
$image->rel_webp;
				$d['alt-value'] = PhocaCartImage::getAltTitle($v->title,
$image->rel);
				$d['class'] =
PhocacartRenderFront::completeClass(array($this->s['c']['img-responsive'],
'img-thumbnail', 'ph-image-full',
'phImageFull', 'phjProductImage' . ''));
				$d['style'] = '';
				/*if (isset($this->t['image_width']) &&
(int)$this->t['image_width'] > 0 &&
isset($this->t['image_height']) &&
(int)$this->t['image_height'] > 0) {
					$d['style'] = 'width:' .
$this->t['image_width'] . 'px;height:' .
$this->t['image_height'] . 'px';
				}*/

				$tabO .= $layoutI->render($d);

			}
			$tabO	.= '</a>';
			$tabO	.= '<div
class="'.$this->s['c']['caption'].'"><h4><a
href="'.$link.'">'.$v->title.'</a></h4></div>';

			$tabO	.= '<div class="">';
			$tabO	.= '<a href="'.$link.'"
class="'.$this->s['c']['btn.btn-primary.btn-sm'].'
ph-btn" role="button"><span
class="'.$this->s['i']['view-product'].'"></span>
'.JText::_('COM_PHOCACART_VIEW_PRODUCT').'</a>';
			$tabO	.= '</div>';

			$tabO	.= '</div>';
			$tabO	.= '</div>';

			$tabO	.= '</div>';
			$tabO	.= '</div>';


		}
		$tabO	.= '</div>';
		$tabO	.= '</div>';
		$active = $activeTab = '';
	}

	// PRICE HISTORY
	if ($this->t['enable_price_history'] &&
$this->t['price_history_data']) {
		$tabLiO .= '<li
class="'.$this->s['c']['nav-item'].'
'.$activeTab.'"><a href="#phpricehistory"
data-toggle="tab"
class="'.$this->s['c']['nav-link'].'
'.$active.'">'.JText::_('COM_PHOCACART_PRICE_HISTORY').'</a></li>';

		$tabO 	.= '<div
class="'.$this->s['c']['tabpane'].'
ph-tab-pane '.$active.'"
id="phpricehistory">';
		$tabO	.= '<div
class="'.$this->s['c']['row'].'">';

		$tabO	.= '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-cpanel-chart-box">';
		$tabO	.= '<div id="phChartAreaLineHolder"
class="ph-chart-canvas-holder" style="width:95%"
>';
        $tabO	.= '<canvas id="phChartAreaLine"
class="ph-chart-area-line"></canvas>';
		$tabO	.= '</div>';
		$tabO	.= '</div>';


		$tabO	.= '</div>';
		$tabO	.= '</div>';

	}

	// TABS PLUGIN
	if (!empty($this->t['event']->onItemInsideTabPanel)
&&
is_array($this->t['event']->onItemInsideTabPanel)) {
		foreach($this->t['event']->onItemInsideTabPanel as $k
=> $v) {
			if (isset($v['title']) && isset($v['alias'])
&& isset($v['content'])) {
				$tabLiO .= '<li
class="'.$this->s['c']['nav-item'].'
'.$activeTab.'"><a
href="#'.strip_tags($v['alias']).'"
data-toggle="tab"
class="'.$this->s['c']['nav-link'].'
'.$active.'">'.$v['title'].'</a></li>';
				$tabO 	.= '<div
class="'.$this->s['c']['tabpane'].'
ph-tab-pane '.$active.'"
id="'.strip_tags($v['alias']).'">';
				$tabO	.= $v['content'];
				$tabO	.= '</div>';
				$active = $activeTab = '';
			}
		}
	}


	if ($tabLiO != '') {
		echo '<ul
class="'.$this->s['c']['tabnav'].'">';
		echo $tabLiO;
		echo '</ul>';

	}

	if ($tabO != '') {
		echo '<div
class="'.$this->s['c']['tabcontent'].'">';
		echo $tabO;
		echo '</div>';
	}


	echo '</div>'; // end row 2 (bottom)

	echo $this->t['event']->onItemAfterTabs;

	// TAGS
	if ($this->t['tags_output'] != '') {

		echo '<div class="ph-cb"></div>';

		echo '<div class="ph-item-tag-box">';
		echo '<h3>Tags</h3>';
		echo $this->t['tags_output'];
		echo '</div>';

	}

	// PARAMETERS
	if ($this->t['parameters_output'] != '') {

		echo '<div class="ph-cb"></div>';
		echo '<div class="ph-item-parameter-box">';
		echo $this->t['parameters_output'];
		echo '</div>';


	}

	echo '<div class="ph-cb"></div>';

}


if ((isset($this->itemnext[0]) && $this->itemnext[0]) ||
(isset($this->itemprev[0]) && $this->itemprev[0])) {
	echo '<div
class="'.$this->s['c']['row'].'">';

	echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'
ph-item-navigation-box">';
	if(isset($this->itemprev[0]) && $this->itemprev[0]) {
		$p = $this->itemprev[0];

		$title 	= '';
		$titleT = JText::_('COM_PHOCACART_PREVIOUS_PRODUCT'). '
('. $p->title.')';
		if ($this->t['title_next_prev'] == 1) {
			$title = $titleT;
		} else if ($this->t['title_next_prev'] == 2) {
			$title = JText::_('COM_PHOCACART_PREVIOUS_PRODUCT');
		} else if ($this->t['title_next_prev'] == 3) {
			$title = $p->title;
		}
		$linkPrev = JRoute::_(PhocacartRoute::getItemRoute($p->id,
$p->categoryid, $p->alias, $p->categoryalias));
		echo '<div
class="'.$this->s['c']['pull-left'].'">';
		echo '<a href="'.$linkPrev.'"
class="'.$this->s['c']['btn.btn-default'].'
ph-item-navigation" role="button"
title="'.$titleT.'"><span
class="'.$this->s['i']['prev'].'"></span>
'.$title.'</a>';
		echo '</div>';
	}
	echo '</div>';

	echo '<div
class="'.$this->s['c']['col.xs12.sm2.md2'].'
ph-item-navigation-box">';
	echo '</div>';

	echo '<div
class="'.$this->s['c']['col.xs12.sm2.md2'].'
ph-item-navigation-box">';
	echo '</div>';

	echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'
ph-item-navigation-box">';
	if(isset($this->itemnext[0]) && $this->itemnext[0]) {
		$n = $this->itemnext[0];
		$title 	= '';
		$titleT = JText::_('COM_PHOCACART_NEXT_PRODUCT'). '
('. $n->title.')';
		if ($this->t['title_next_prev'] == 1) {
			$title = $titleT;
		} else if ($this->t['title_next_prev'] == 2) {
			$title = JText::_('COM_PHOCACART_NEXT_PRODUCT');
		} else if ($this->t['title_next_prev'] == 3) {
			$title = $n->title;
		}
		$linkNext = JRoute::_(PhocacartRoute::getItemRoute($n->id,
$n->categoryid, $n->alias, $n->categoryalias));
		echo '<div
class="'.$this->s['c']['pull-right'].'">';
		echo '<a href="'.$linkNext.'"
class="'.$this->s['c']['btn.btn-default'].'
ph-item-navigation" role="button"
title="'.$titleT.'">'.$title.' <span
class="'.$this->s['i']['next'].'"></span></a>';
		echo '</div>';
	}
	echo '</div>';

	echo '</div>';
}

echo '</div>';
echo '<div id="phContainer"></div>';

if ($popupAskAQuestion == 2) {
	echo '<div id="phContainerPopup">';
	$d						= array();
	$d['id']				= 'phAskAQuestionPopup';
	$d['title']				=
JText::_('COM_PHOCACART_ASK_A_QUESTION');
	$d['icon']				=
$this->s['i']['question-sign'];
	$d['t']					= $this->t;
	$d['s']					= $this->s;
	echo $layoutAAQ->render($d);
	echo '</div>';// end phContainerPopup
}




echo '<div>&nbsp;</div>';
echo PhocacartUtilsInfo::getInfo();
?>
views/item/tmpl/default.xml000064400000002414151167552070011773
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
   <layout title="COM_PHOCACART_ITEM_LAYOUT">
      <message>
         <![CDATA[COM_PHOCACART_ITEM_LAYOUT_DESC]]>
      </message>
   </layout>

   <name>COM_PHOCACART_ITEM_LAYOUT</name>
   <description>COM_PHOCACART_ITEM_LAYOUT_DESC</description>
   <fields name="request">
      <fieldset name="request"
addfieldpath="/administrator/components/com_phocacart/models/fields">

        
		 
		 
		 
		  <field 
            name="id" 
            type="phocaselectitem" 
            section="com_phocacart" 
            class="inputbox"
            default="" 
            label="COM_PHOCACART_FIELD_SELECT_PRODUCT_LABEL" 
            description="COM_PHOCACART_FIELD_SELECT_PRODUCT_DESC"

            required="true"
			multiple="false"
			filter="integer"
         />
		 
		 <field 
            name="catid" 
            type="phocaselectitemcategory" 
            section="com_phocacart" 
            class="inputbox"
            default="1" 
            label="COM_PHOCACART_FIELD_CATEGORY_LABEL" 
            description="COM_PHOCACART_FIELD_CATEGORY_DESC" 
            required="true"
			multiple="false"
			filter="integer"
			
         />
		
      </fieldset>
   </fields>
  

</metadata>views/item/tmpl/default_quickview.php000064400000031441151167552070014053
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

$layoutP	= new JLayoutFile('product_price', null,
array('component' => 'com_phocacart'));
$layoutS	= new JLayoutFile('product_stock', null,
array('component' => 'com_phocacart'));
$layoutA	= new JLayoutFile('button_add_to_cart_item', null,
array('component' => 'com_phocacart'));
$layoutA2	= new JLayoutFile('button_buy_now_paddle', null,
array('component' => 'com_phocacart'));
$layoutA3	= new JLayoutFile('button_external_link', null,
array('component' => 'com_phocacart'));

//$layoutQV 	= new JLayoutFile('popup_quickview', null,
array('component' => 'com_phocacart'));
$layoutAB	= new JLayoutFile('attribute_options_box', null,
array('component' => 'com_phocacart'));
$layoutPOQ	= new JLayoutFile('product_order_quantity', null,
array('component' => 'com_phocacart'));
$layoutI	= new JLayoutFile('image', null,
array('component' => 'com_phocacart'));

$close = '<button type="button" class="close"
aria-label="'.JText::_('COM_PHOCACART_CLOSE').'"
data-dismiss="modal" ><span
aria-hidden="true">&times;</span></button>';

$x = $this->item[0];
?>
<div id="phQuickViewPopup" class="<?php echo
$this->s['c']['modal.zoom'] ?>"
tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="<?php echo
$this->s['c']['modal-dialog'] ?> <?php echo
$this->s['c']['modal-lg'] ?>">
      <div class="<?php echo
$this->s['c']['modal-content'] ?>">
        <div class="<?php echo
$this->s['c']['modal-header'] ?>">
          <?php echo $this->s['c']['class-type']
!= 'bs4' ? $close : '' ?>
		  <h4><span class="<?php echo
$this->s['i']['quick-view']
?>"></span> <?php echo
JText::_('COM_PHOCACART_QUICK_VIEW'); ?></h4>
            <?php echo
$this->s['c']['class-type'] == 'bs4' ?
$close : '' ?>
        </div>
        <div class="<?php echo
$this->s['c']['modal-body'] ?>"><?php


//echo '<h1>'.$x->title.'</h1>';
echo '<div class="row">';

// === IMAGE PANEL
echo '<div id="phImageBox"
class="'.$this->s['c']['col.xs12.sm6.md6'].'">';


$idName			= 'VItemQuickP'.(int)$x->id;

$label 	= PhocacartRenderFront::getLabel($x->date, $x->sales,
$x->featured);

// IMAGE
$image 		=
PhocacartImage::getThumbnailName($this->t['pathitem'],
$x->image, 'large');// Image
$imageL 	=
PhocacartImage::getThumbnailName($this->t['pathitem'],
$x->image, 'large');// Image Link to enlarge


// Some of the attribute is selected - this attribute include image so the
image should be displayed instead of default
$imageA =
PhocaCartImage::getImageChangedByAttributes($this->t['attr_options'],
'large');
if ($imageA != '') {
	$image =
PhocacartImage::getThumbnailName($this->t['pathitem'],
$imageA, 'large');
	$imageL =
PhocacartImage::getThumbnailName($this->t['pathitem'],
$imageA, 'large');
}

$link 	= JURI::base(true).'/'.$imageL->rel;

if (isset($image->rel) && $image->rel != '') {

	echo '<div class="ph-item-image-full-box
'.$label['cssthumbnail'].'">';

	echo '<div class="ph-label-box">';
	echo $label['new'] . $label['hot'] .
$label['feat'];
	if ($this->t['taglabels_output'] != '') {
		echo $this->t['taglabels_output'];
	}
	echo '</div>';


    $altValue   = PhocaCartImage::getAltTitle($x->title, $x->image);

	//echo '<a href="'.$link.'"
'.$this->t['image_rel'].'>';
	// In Quic View there is no linking of image
	// 1) but we use A TAG in javascript jquery.phocaswapimage.js se we need A
TAG HERE but we make it inactive
	// 2) we need to do it inactive for switching images which comes with
links
	//    and this we will do per customHref in function Display:
function(imgBox, form, select, customHref) {
	//    custom href will be javascript:void(0); see this file, line cca 286
phSIO1'.(int)$formId.'.Init
	echo '<a href="javascript:void(0);"
'.$this->t['image_rel'].'
class="phjProductHref'.$idName.'"
data-href="'.$link.'">';

    $d						= array();
    $d['t']					= $this->t;
    $d['s']					= $this->s;
    $d['src']				=
JURI::base(true).'/'.$image->rel;
    $d['srcset-webp']		=
JURI::base(true).'/'.$image->rel_webp;
    $d['data-image']		=
JURI::base(true).'/'.$image->rel;// Default image - when
changed by javascript back to default
    $d['data-image-webp']	=
JURI::base(true).'/'.$image->rel_webp;// Default image - when
changed by javascript back to default
    $d['alt-value']			= PhocaCartImage::getAltTitle($x->title,
$image->rel);
    $d['class']				=
PhocacartRenderFront::completeClass(array($this->s['c']['img-responsive'],
$label['cssthumbnail2'], 'ph-image-full',
'phjProductImage'.$idName));
    $d['style']				= '';
    if (isset($this->t['image_width']) &&
(int)$this->t['image_width'] > 0 &&
isset($this->t['image_height']) &&
(int)$this->t['image_height'] > 0) {
        $d['style'] =
'width:'.$this->t['image_width'].'px;height:'.$this->t['image_height'].'px';
    }
    echo $layoutI->render($d);


	echo '</a>';

	echo '</div>'. "\n";
}


echo '</div>';// end image panel


// === PRICE PANEL
echo '<div
class="'.$this->s['c']['col.xs12.sm6.md6'].'
ph-item-price-panel">';

$title = '';
if (isset($x->title) && $x->title != '') {
	$title = $x->title;
}
echo PhocacartRenderFront::renderHeader(array($title));

// :L: PRICE
$price 	= new PhocacartPrice;// Can be used by options

if ($this->t['can_display_price']) {

	$d					= array();
	$d['s']				= $this->s;
	$d['type']          = $x->type;// PRODUCTTYPE
	$d['priceitems']	= $price->getPriceItems($x->price,
$x->taxid, $x->taxrate, $x->taxcalculationtype, $x->taxtitle,
$x->unit_amount, $x->unit_unit, 1, 1, $x->group_price);
	$price->getPriceItemsChangedByAttributes($d['priceitems'],
$this->t['attr_options'], $price, $x);

	$d['priceitemsorig']= array();
	if ($x->price_original != '' && $x->price_original
> 0) {
		$d['priceitemsorig'] =
$price->getPriceItems($x->price_original, $x->taxid,
$x->taxrate, $x->taxcalculationtype);
	}
	$d['class']			= 'ph-item-price-box';
	$d['product_id']	= (int)$x->id;
	$d['typeview']		= 'ItemQuick';

	// Display discount price
	// Move standard prices to new variable (product price -> product
discount)
	$d['priceitemsdiscount']		= $d['priceitems'];
	$d['discount'] 					=
PhocacartDiscountProduct::getProductDiscountPrice($x->id,
$d['priceitemsdiscount']);

	// Display cart discount (global discount) in product views - under
specific conditions only
	// Move product discount prices to new variable (product price ->
product discount -> product discount cart)
	$d['priceitemsdiscountcart']	=
$d['priceitemsdiscount'];
	$d['discountcart']				=
PhocacartDiscountCart::getCartDiscountPriceForProduct($x->id,
$x->catid, $d['priceitemsdiscountcart']);

	$d['zero_price']		= 1;// Apply zero price if possible
	echo$layoutP->render($d);
}
	if ( isset($x->description) && $x->description !=
'') {
		echo '<div class="ph-desc">'.
Joomla\CMS\HTML\HTMLHelper::_('content.prepare',
$x->description). '</div>';
	}
	// REWARD POINTS - NEEDED
	$pointsN = PhocacartReward::getPoints($x->points_needed,
'needed');
	if ($pointsN) {
		echo '<div class="ph-item-reward-box">';
		echo '<div
class="ph-reward-txt">'.JText::_('COM_PHOCACART_PRICE_IN_REWARD_POINTS').'</div>';

		echo '<div
class="ph-reward">'.$pointsN.'</div>';
		echo '</div>';
		echo '<div class="ph-cb"></div>';
	}

	// REWARD POINTS - RECEIVED
	$pointsR = PhocacartReward::getPoints($x->points_received,
'received', $x->group_points_received);
	if ($pointsR) {
		echo '<div class="ph-item-reward-box">';
		echo '<div
class="ph-reward-txt">'.JText::_('COM_PHOCACART_REWARD_POINTS').'</div>';

		echo '<div
class="ph-reward">'.$pointsR.'</div>';
		echo '</div>';
		echo '<div class="ph-cb"></div>';
	}


	if (isset($x->manufacturertitle) && $x->manufacturertitle !=
'') {
		echo '<div class="ph-item-manufacturer-box">';
		echo '<div
class="ph-manufacturer-txt">'.JText::_('COM_PHOCACART_MANUFACTURER').':</div>';
		echo '<div class="ph-manufacturer">';
		echo PhocacartRenderFront::displayLink($x->manufacturertitle,
$x->manufacturerlink);
		echo '</div>';
		echo '</div>';
		echo '<div class="ph-cb"></div>';
	}

	// STOCK ===================================================
	// Set stock: product, variations, or advanced stock status
	$class_btn	= '';
	$class_icon	= '';
	$this->stock =
PhocacartStock::getStockItemsChangedByAttributes($this->t['stock_status'],
$this->t['attr_options'], $x);

	if ($this->t['display_stock_status'] == 1 ||
$this->t['display_stock_status'] == 3) {


		if ($this->t['hide_add_to_cart_stock'] == 1 &&
(int)$this->stock < 1) {
			$class_btn 					= 'ph-visibility-hidden';
			$class_icon					= 'ph-display-none';
		}

		if($this->t['stock_status']['stock_status'] ||
$this->t['stock_status']['stock_count'] !== false)
{
			$d							= array();
			$d['s']					    = $this->s;
			$d['class']					= 'ph-item-stock-box';
			$d['product_id']			= (int)$x->id;
			$d['typeview']				= 'ItemQuick';
			$d['stock_status_output'] 	=
PhocacartStock::getStockStatusOutput($this->t['stock_status']);
			echo $layoutS->render($d);
		}

		if($this->t['stock_status']['min_quantity']) {
			$dPOQ						= array();
			$dPOQ['s']					= $this->s;
			$dPOQ['text']				=
JText::_('COM_PHOCACART_MINIMUM_ORDER_QUANTITY');
			$dPOQ['status']				=
$this->t['stock_status']['min_quantity'];
			echo $layoutPOQ->render($dPOQ);
		}

		if($this->t['stock_status']['min_multiple_quantity'])
{
			$dPOQ						= array();
			$dPOQ['s']					= $this->s;
			$dPOQ['text']				=
JText::_('COM_PHOCACART_MINIMUM_MULTIPLE_ORDER_QUANTITY');
			$dPOQ['status']				=
$this->t['stock_status']['min_multiple_quantity'];
			echo $layoutPOQ->render($dPOQ);
		}
	}
	// END STOCK ================================================

// This form can get two events:
// when option selected - price or image is changed id=phItemPriceBoxForm
// when ajax cart is active and submit button is clicked
class=phItemCartBoxForm
//
echo '<form 
id="phCartAddToCartButton'.(int)$x->id.'"
class="phItemCartBoxForm phjAddToCart phjItemQuick
phjAddToCartVItemQuickP'.(int)$x->id.' form-inline" 
action="'.$this->t['linkcheckout'].'"
method="post">';

// data-id="'.(int)$x->id.'" - needed for dynamic
change of price in quick view, we need to get the ID per javascript
// because Quick View = Items, Category View and there are more products
listed, not like in item id

// ATTRIBUTES, OPTIONS
$d							= array();
$d['s']					    = $this->s;
$d['attr_options']			= $this->t['attr_options'];
$d['hide_attributes']		=
$this->t['hide_attributes_item'];
$d['dynamic_change_image'] 	=
$this->t['dynamic_change_image'];
$d['remove_select_option_attribute']	=
$this->t['remove_select_option_attribute'];
$d['zero_attribute_price']  =
$this->t['zero_attribute_price'];
$d['pathitem']				= $this->t['pathitem'];
$d['init_type']				= 1;
$d['product_id']			= (int)$x->id;
$d['image_size']			= 'large';
$d['price']					= $price;
$d['typeview']				= 'ItemQuick';
echo $layoutAB->render($d);


// :L: ADD TO CART
$addToCartHidden = 0;// Button can be hidden based on price
if ($x->type == 3) {
    // PRODUCTTYPE - price on demand price cannot be added to cart
    $addToCartHidden = 1;
} else if ($this->t['hide_add_to_cart_zero_price'] == 1
&& $x->price == 0) {
	// Don't display Add to Cart in case the price is zero
	$addToCartHidden = 1;
} else if ((int)$this->t['item_addtocart'] == 1 ||
(int)$this->t['item_addtocart'] == 4) {

	$d					= array();
	$d['s']			    = $this->s;
	$d['id']			= (int)$x->id;
	$d['catid']			= $this->t['catid'];
	$d['return']		= $this->t['actionbase64'];
	$d['addtocart']		= $this->t['item_addtocart'];
	$d['typeview']		= 'ItemQuick';
	$d['class_btn']		= $class_btn;
	$d['class_icon']	= $class_icon;
	echo$layoutA->render($d);

} else if ((int)$this->t['item_addtocart'] == 2 &&
(int)$x->external_id != '') {
	$d					= array();
	$d['s']				= $this->s;
	$d['external_id']	= (int)$x->external_id;
	$d['return']		= $this->t['actionbase64'];

	echo$layoutA2->render($d);
} else if ((int)$this->t['item_addtocart'] == 3 &&
$x->external_link != '') {
	$d					= array();
	$d['s']				= $this->s;
	$d['external_link']	= $x->external_link;
	$d['external_text']	= $x->external_text;
	$d['return']		= $this->t['actionbase64'];
	echo $layoutA3->render($d);

}

echo '</form>';
echo '<div class="ph-cb"></div>';

// TAGS
if ($this->t['tags_output'] != '') {
	echo '<div class="ph-item-tag-box">';
	echo $this->t['tags_output'];
	echo '</div>';
	echo '<div class="ph-cb"></div>';
}


echo '</div>';// end right side price panel
echo '</div>';// end row


        ?></div>
		<div class="<?php echo
$this->s['c']['modal-footer']
?>"></div>
	   </div>
    </div>
</div>
views/item/tmpl/index.html000064400000000054151167552070011620
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/item/view.html.php000064400000031567151167552070011312
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');
jimport( 'joomla.filesystem.folder' );
jimport( 'joomla.filesystem.file' );

class PhocaCartViewItem extends JViewLegacy
{
	protected $item;
	protected $itemnext;
	protected $itemprev;
	protected $category;
	protected $t;
	protected $r;
	protected $p;
	protected $u;
	protected $s;

	function display($tpl = null){

		$app = JFactory::getApplication();
		//D $menus	= $app->getMenu('site', array());
		//D $items	= $menus->getItems('component',
'com_phocacart');

		$app					= JFactory::getApplication();
		$this->p 				= $app->getParams();
		$this->u				= PhocacartUser::getUser();
		$this->s				= PhocacartRenderStyle::getStyles();
		$uri 					= \Joomla\CMS\Uri\Uri::getInstance();
		$model					= $this->getModel();
		//D $document				= JFactory::getDocument();
		$id						= $app->input->get('id', 0, 'int');
		$catid					= $app->input->get('catid', 0,
'int');

		$this->category			= $model->getCategory($id, $catid);

		$this->item				= $model->getItem($id, $catid);
		$this->t['catid']		= 0;
		if (isset($this->category[0]->id)) {
			$this->t['catid']	= (int)$this->category[0]->id;
		}


		// PARAMS
		$this->t['tax_calculation'] 		    = $this->p->get(
'tax_calculation', 0 );
		$this->t['cart_metakey'] 			    = $this->p->get(
'cart_metakey', '' );
		$this->t['cart_metadesc'] 			    = $this->p->get(
'cart_metadesc', '' );
		$this->t['display_back']			    = $this->p->get(
'display_back', 3 );
		//$this->t['enable_social']			    = $this->p->get(
'enable_social', 0 );
		$this->t['enable_item_navigation']  	= $this->p->get(
'enable_item_navigation', 0 );
		$this->t['item_addtocart']		    	= $this->p->get(
'item_addtocart', 1 );
		//$this->t['add_cart_method']			= $this->p->get(
'add_cart_method', 0 );
		$this->t['enable_review']			    = $this->p->get(
'enable_review', 1 );
		$this->t['dynamic_change_image']    	= $this->p->get(
'dynamic_change_image', 0);
		$this->t['dynamic_change_price']	    = $this->p->get(
'dynamic_change_price', 0 );
		$this->t['dynamic_change_stock']	    = $this->p->get(
'dynamic_change_stock', 0 );
		$this->t['dynamic_change_id']	   	 	= $this->p->get(
'dynamic_change_id', 0 );
		$this->t['remove_select_option_attribute']=
$this->p->get( 'remove_select_option_attribute', 1 );
		$this->t['image_popup_method']	    	= $this->p->get(
'image_popup_method', 1 );
		$this->t['display_compare']			    = $this->p->get(
'display_compare', 0 );
		$this->t['display_wishlist']		    = $this->p->get(
'display_wishlist', 0 );
		$this->t['add_compare_method']		    = $this->p->get(
'add_compare_method', 0 );
		$this->t['add_wishlist_method']		    = $this->p->get(
'add_wishlist_method', 0 );

		$this->t['hide_addtocart']			    = $this->p->get(
'hide_addtocart', 0 );
		$this->t['hide_attributes_item']	    = $this->p->get(
'hide_attributes_item', 0 );
		$this->t['hide_attributes']			    = $this->p->get(
'hide_attributes', 0 );
		$this->t['item_askquestion']		    = $this->p->get(
'item_askquestion', 0 );
		$this->t['popup_askquestion']		    = $this->p->get(
'popup_askquestion', 1 );
		$this->t['title_next_prev']			    = $this->p->get(
'title_next_prev', 1 );
		$this->t['display_public_download']     =
$this->p->get( 'display_public_download', 1 );
		$this->t['display_file_play']     		= $this->p->get(
'display_file_play', 1 );
		$this->t['display_external_link']	    = $this->p->get(
'display_external_link', 1 );
		$this->t['enable_rewards']			    = $this->p->get(
'enable_rewards', 1 );
		$this->t['enable_price_history'] 	    = $this->p->get(
'enable_price_history', 0 );
		$this->t['display_stock_status']	    = $this->p->get(
'display_stock_status', 1 );
		$this->t['item_display_delivery_date']	=
$this->p->get( 'item_display_delivery_date', 0 );
        $this->t['item_display_size_options']	=
$this->p->get( 'item_display_size_options', 0 );
		$this->t['hide_add_to_cart_stock']	    =
$this->p->get( 'hide_add_to_cart_stock', 0 );
		$this->t['zero_attribute_price']	    = $this->p->get(
'zero_attribute_price', 1 );
		$this->t['hide_add_to_cart_zero_price']	=
$this->p->get( 'hide_add_to_cart_zero_price', 0 );
		$this->t['display_webp_images']			= $this->p->get(
'display_webp_images', 0 );
		$this->t['item_display_labels']			= $this->p->get(
'item_display_labels', 2 );
		$this->t['item_display_tags']			= $this->p->get(
'item_display_tags', 1 );
		$this->t['item_display_parameters']		= $this->p->get(
'item_display_parameters', 0 );


		// Rights or catalogue options --------------------------------
		$rights								= new PhocacartAccessRights();
		$this->t['can_display_price']		=
$rights->canDisplayPrice();
		$this->t['can_display_addtocart']	=
$rights->canDisplayAddtocart();
		$this->t['can_display_attributes']	=
$rights->canDisplayAttributes();

		if (!$this->t['can_display_addtocart']) {
			$this->t['item_addtocart']		= 0;
			//$this->t['display_addtocart_icon'] 	= 0;
			//$this->t['hide_attributes_category']= 1; Should be
displayed or not?
		}
		if (!$this->t['can_display_attributes']) {
			$this->t['hide_attributes_item'] = 1;
		}
		// ------------------------------------------------------------

		if (!isset($this->item[0]->id) || (isset($this->item[0]->id)
&& $this->item[0]->id < 1)) {

			header("HTTP/1.0 404
".JText::_('COM_PHOCACART_NO_PRODUCT_FOUND'));
			echo '<div class="alert
alert-error">'.JText::_('COM_PHOCACART_NO_PRODUCT_FOUND').'</div>';



		} else {

			$this->t['add_images']			=
PhocacartImage::getAdditionalImages((int)$id);
			$this->t['rel_products']		=
PhocacartRelated::getRelatedItemsById((int)$id, 0, 1);
			$this->t['tags_output']			=
PhocacartTag::getTagsRendered((int)$id,
$this->t['item_display_tags'], ' ');
			$this->t['taglabels_output']	=
PhocacartTag::getTagsRendered((int)$id,
$this->t['item_display_labels'], ' ');
			$this->t['stock_status']		= array();
			//$this->t['stock_status']		=
PhocacartStock::getStockStatus((int)$this->item[0]->stock,
(int)$this->item[0]->min_quantity,
(int)$this->item[0]->min_multiple_quantity,
(int)$this->item[0]->stockstatus_a_id, 
(int)$this->item[0]->stockstatus_n_id);


			//$this->t['stock_status_output'] =
PhocacartStock::getStockStatusOutput($this->t['stock_status']);
			$this->t['attr_options']		=
$this->t['hide_attributes_item'] == 0 ?
PhocacartAttribute::getAttributesAndOptions((int)$id) : array();

			$this->t['specifications']		=
PhocacartSpecification::getSpecificationGroupsAndSpecifications((int)$id);
			$this->t['reviews']				=
PhocacartReview::getReviewsByProduct((int)$id);

			if ($this->t['enable_price_history']) {
				$this->t['price_history_data']	=
PhocacartPriceHistory::getPriceHistoryChartById((int)$id);
			}

			$this->t['parameters_output']	=
PhocacartParameter::getParametersRendered((int)$id,
$this->t['item_display_parameters']);

			$this->t['action']				= $uri->toString();
			//$this->t['actionbase64']		=
base64_encode(htmlspecialchars($this->t['action']));
			$this->t['actionbase64']		=
base64_encode($this->t['action']);
			$this->t['linkcheckout']		=
JRoute::_(PhocacartRoute::getCheckoutRoute((int)$this->item[0]->id,
(int)$this->category[0]->id));
			$this->t['linkitem']			=
JRoute::_(PhocacartRoute::getItemRoute((int)$this->item[0]->id,
(int)$this->category[0]->id));

			$this->t['linkcomparison']	=
JRoute::_(PhocacartRoute::getComparisonRoute((int)$this->item[0]->id,
(int)$this->category[0]->id));
			$this->t['linkwishlist']	=
JRoute::_(PhocacartRoute::getWishListRoute((int)$this->item[0]->id,
(int)$this->category[0]->id));
			$this->t['linkdownload']	=
JRoute::_(PhocacartRoute::getDownloadRoute((int)$this->item[0]->id,
(int)$this->category[0]->id));
			$this->itemnext[0]			= false;
			$this->itemprev[0]			= false;

			if ($this->t['enable_item_navigation'] == 1) {
				if (isset($this->item[0]->ordering) &&
isset($this->item[0]->catid) &&
isset($this->item[0]->id) && $this->item[0]->catid >
0 && $this->item[0]->id > 0) {
					$this->itemnext			=
$model->getItemNext($this->item[0]->ordering,
$this->item[0]->catid);
					$this->itemprev			=
$model->getItemPrev($this->item[0]->ordering,
$this->item[0]->catid);
				}
			}


			$media = PhocacartRenderMedia::getInstance('main');
			$media->loadBase();
			$media->loadChosen();
			$media->loadRating();
			$media->loadPhocaSwapImage();
			$media->loadPhocaAttribute(1);
			$media->loadTouchSpin('quantity',
$this->s['i']);// only css, js will be loaded in ajax success


			if ($this->t['popup_askquestion'] == 1) {
				$media->loadWindowPopup();
			}

			if ($this->t['image_popup_method'] == 2) {
				$media->renderMagnific();
				$this->t['image_rel'] 	=
'rel="magnific"';
				$this->t['image_class']	= 'magnific';
			} else if ($this->t['image_popup_method'] == 1) {
				$media->renderPrettyPhoto();
				$this->t['image_rel'] =
'rel="prettyPhoto[pc_gal1]"';
				$this->t['image_class']	= '';
			} else {
				// None
				$this->t['image_rel'] 	= '';
				$this->t['image_class']	= '';
			}

			if ($this->t['hide_attributes_item'] == 0) {
				$media->loadPhocaAttributeRequired(1); // Some of the attribute can
be required and can be a image checkbox
			}

		/*	if ($this->t['dynamic_change_id'] == 1) {
				PhocacartRenderJs::renderAjaxChangeProductIdByOptions((int)$this->item[0]->id,
'Item', 'ph-item-id-box');
			}
			if ($this->t['dynamic_change_price'] == 1) {
				PhocacartRenderJs::renderAjaxChangeProductPriceByOptions((int)$this->item[0]->id,
'Item', 'ph-item-price-box');
			}
			if ($this->t['dynamic_change_stock'] == 1) {
				PhocacartRenderJs::renderAjaxChangeProductStockByOptions((int)$this->item[0]->id,
'Item', 'ph-item-stock-box');
			}*/

			/*if ($this->t['dynamic_change_id'] == 1 ||
$this->t['dynamic_change_price'] == 1 ||
$this->t['dynamic_change_stock'] == 1) {
				PhocacartRenderJs::renderAjaxChangeProductDataByOptions((int)$this->item[0]->id,
'Item', 'ph-item-data-box');
			}*/


			PhocacartRenderJs::renderAjaxAddToCart();
			//PhocacartRenderJs::renderAjaxUpdateCart();// used only in POS
			PhocacartRenderJs::renderAjaxAddToCompare();
			PhocacartRenderJs::renderAjaxAddToWishList();
			PhocacartRenderJs::renderAjaxAskAQuestion();
            $media->loadSpec();

			if (isset($this->category[0]) &&
is_object($this->category[0]) && isset($this->item[0])
&& is_object($this->item[0])){
				$this->_prepareDocument($this->category[0], $this->item[0]);
			}

			$this->t['pathitem'] 		=
PhocacartPath::getPath('productimage');
			$this->t['pathpublicfile'] 	=
PhocacartPath::getPath('publicfile');

		}
		$model->hit((int)$id);
		PhocacartStatisticsHits::productHit((int)$id);

		// Plugins ------------------------------------------
		JPluginHelper::importPlugin('pcv');
		//$this->t['dispatcher']	= J
EventDispatcher::getInstance();
		$this->t['event']		= new stdClass;

		$results =
\JFactory::getApplication()->triggerEvent('PCVonItemBeforeHeader',
array('com_phocacart.item', &$this->item,
&$this->p));
		$this->t['event']->onItemBeforeHeader =
trim(implode("\n", $results));

		$results =
\JFactory::getApplication()->triggerEvent('PCVonItemAfterAddToCart',
array('com_phocacart.item', &$this->item,
&$this->p));
		$this->t['event']->onItemAfterAddToCart =
trim(implode("\n", $results));

		$results =
\JFactory::getApplication()->triggerEvent('PCVonItemBeforeEndPricePanel',
array('com_phocacart.item', &$this->item,
&$this->p));
		$this->t['event']->onItemBeforeEndPricePanel =
trim(implode("\n", $results));

		$results =
\JFactory::getApplication()->triggerEvent('PCVonItemInsideTabPanel',
array('com_phocacart.item', &$this->item,
&$this->p));
		$this->t['event']->onItemInsideTabPanel = $results;

		$results =
\JFactory::getApplication()->triggerEvent('PCVonItemAfterTabs',
array('com_phocacart.item', &$this->item,
&$this->p));
		$this->t['event']->onItemAfterTabs =
trim(implode("\n", $results));

		// Some payment plugins want to display specific information in detail
view
		JPluginHelper::importPlugin('pcp');
		$results =
\JFactory::getApplication()->triggerEvent('PCPonItemBeforeEndPricePanel',
array('com_phocacart.item', &$this->item,
&$this->p));
		$this->t['event']->PCPonItemBeforeEndPricePanel =
trim(implode("\n", $results));

		// END Plugins --------------------------------------


		parent::display($tpl);
	}



	protected function _prepareDocument() {
		$category = false;
		if (isset($this->category[0]) &&
is_object($this->category[0])) {
			$category = $this->category[0];
		}
		$item = false;
		if (isset($this->item[0]) && is_object($this->item[0])) {
			$item = $this->item[0];
		}
		PhocacartRenderFront::prepareDocument($this->document, $this->p,
$category, $item);
	}
}
?>
views/item/view.json.php000064400000016507151167552070011314
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');
jimport( 'joomla.filesystem.folder' );
jimport( 'joomla.filesystem.file' );

class PhocaCartViewItem extends JViewLegacy
{
	protected $item;
	protected $itemnext;
	protected $itemprev;
	protected $category;
	protected $t;
	protected $r;
	protected $p;
	protected $u;
	protected $s;

	function display($tpl = null){

		if (!JSession::checkToken('request')) {
			$response = array(
				'status' => '0',
				'error' => '<span class="ph-result-txt
ph-error-txt">' . JText::_('JINVALID_TOKEN') .
'</span>');
			echo json_encode($response);
			return;
		}


		$app = JFactory::getApplication();
		$menus	= $app->getMenu('site', array());
		$items	= $menus->getItems('component',
'com_phocacart');

		$app					= JFactory::getApplication();
		$this->p 				= $app->getParams();
		$this->u				= PhocacartUser::getUser();
		$this->s				= PhocacartRenderStyle::getStyles();
		$uri 					= \Joomla\CMS\Uri\Uri::getInstance();
		$model					= $this->getModel();
		$document				= JFactory::getDocument();
		$id						= $app->input->get('id', 0, 'int');
		$catid					= $app->input->get('catid', 0,
'int');
		$this->category			= $model->getCategory($id, $catid);
		$this->item				= $model->getItem($id, $catid);
		$this->t['catid']		= 0;
		if (isset($this->category[0]->id)) {
			$this->t['catid']	= (int)$this->category[0]->id;
		}



		// PARAMS
		$this->t['tax_calculation'] 		= $this->p->get(
'tax_calculation', 0 );
		$this->t['cart_metakey'] 			= $this->p->get(
'cart_metakey', '' );
		$this->t['cart_metadesc'] 			= $this->p->get(
'cart_metadesc', '' );
		$this->t['display_back']			= $this->p->get(
'display_back', 3 );
		//$this->t['enable_social']			= $this->p->get(
'enable_social', 0 );
	//	$this->t['enable_item_navigation']	= $this->p->get(
'enable_item_navigation', 0 );
		$this->t['item_addtocart']			= $this->p->get(
'item_addtocart', 1 );
	//	$this->t['enable_review']			= $this->p->get(
'enable_review', 1 );
		$this->t['dynamic_change_image']	= $this->p->get(
'dynamic_change_image', 0);
		$this->t['dynamic_change_price']	= $this->p->get(
'dynamic_change_price', 0 );
		$this->t['dynamic_change_stock']	= $this->p->get(
'dynamic_change_stock', 0 );
		$this->t['dynamic_change_id']		= $this->p->get(
'dynamic_change_id', 0 );
		$this->t['remove_select_option_attribute']=
$this->p->get( 'remove_select_option_attribute', 1 );
	/*	$this->t['image_popup_method']		= $this->p->get(
'image_popup_method', 1 );
		$this->t['display_compare']			= $this->p->get(
'display_compare', 0 );
		$this->t['display_wishlist']		= $this->p->get(
'display_wishlist', 0 );
		$this->t['add_compare_method']		= $this->p->get(
'add_compare_method', 0 );
		$this->t['add_wishlist_method']		= $this->p->get(
'add_wishlist_method', 0 );*/

		$this->t['hide_addtocart']			= $this->p->get(
'hide_addtocart', 0 );
		$this->t['hide_attributes_item']	= $this->p->get(
'hide_attributes_item', 0 );
		$this->t['hide_attributes']			= $this->p->get(
'hide_attributes', 0 );
	/*	$this->t['item_askquestion']		= $this->p->get(
'item_askquestion', 0 );
		$this->t['popup_askquestion']		= $this->p->get(
'popup_askquestion', 1 );*/
        $this->t['item_display_delivery_date']	=
$this->p->get( 'item_display_delivery_date', 0 );
        $this->t['item_display_size_options']	=
$this->p->get( 'item_display_size_options', 0 );
		$this->t['enable_rewards']			= $this->p->get(
'enable_rewards', 1 );
		$this->t['display_stock_status']	= $this->p->get(
'display_stock_status', 1 );
		$this->t['hide_add_to_cart_stock']	= $this->p->get(
'hide_add_to_cart_stock', 0 );
		$this->t['zero_attribute_price']	= $this->p->get(
'zero_attribute_price', 1 );
		$this->t['hide_add_to_cart_zero_price']	=
$this->p->get( 'hide_add_to_cart_zero_price', 0 );
		$this->t['display_webp_images']			= $this->p->get(
'display_webp_images', 0 );
		$this->t['item_display_labels']			= $this->p->get(
'item_display_labels', 2 );
		$this->t['item_display_tags']			= $this->p->get(
'item_display_tags', 1 );


		// Rights or catalogue options --------------------------------
		$rights								= new PhocacartAccessRights();
		$this->t['can_display_price']		=
$rights->canDisplayPrice();
		$this->t['can_display_addtocart']	=
$rights->canDisplayAddtocart();
		$this->t['can_display_attributes']	=
$rights->canDisplayAttributes();

		if (!$this->t['can_display_addtocart']) {
			$this->t['item_addtocart']		= 0;
			//$this->t['display_addtocart_icon'] 	= 0;
			//$this->t['hide_attributes_category']= 1; Should be
displayed or not?
		}
		if (!$this->t['can_display_attributes']) {
			$this->t['hide_attributes_item'] = 1;
		}
		// ------------------------------------------------------------


		$this->t['image_rel'] = '';
		$this->t['pathitem'] =
PhocacartPath::getPath('productimage');

		if (!$this->item) {


			$response = array(
				'status' => '0',
				'error' => '<span class="ph-result-txt
ph-error-txt">'.JText::_('COM_PHOCACART_NO_PRODUCT_FOUND').'</span>');
			echo json_encode($response);
			return;

		} else {

			//$this->t['add_images']			=
PhocacartImage::getAdditionalImages((int)$id);
			//$this->t['rel_products']		=
PhocacartRelated::getRelatedItemsById((int)$id, 0, 1);
			$this->t['tags_output']			=
PhocacartTag::getTagsRendered((int)$id,
$this->t['item_display_tags']);
			$this->t['taglabels_output']	=
PhocacartTag::getTagsRendered((int)$id,
$this->t['item_display_labels']);
			$this->t['stock_status']		=
PhocacartStock::getStockStatus((int)$this->item[0]->stock,
(int)$this->item[0]->min_quantity,
(int)$this->item[0]->min_multiple_quantity,
(int)$this->item[0]->stockstatus_a_id, 
(int)$this->item[0]->stockstatus_n_id);
			$this->t['stock_status_output'] =
PhocacartStock::getStockStatusOutput($this->t['stock_status']);
			$this->t['attr_options']		=
$this->t['hide_attributes_item'] == 0 ?
PhocacartAttribute::getAttributesAndOptions((int)$id) : array();
			$this->t['specifications']		=
PhocacartSpecification::getSpecificationGroupsAndSpecifications((int)$id);
			//$this->t['reviews']				=
PhocacartReview::getReviewsByProduct((int)$id);

			//$this->t['action']				= $uri->toString();
			$this->t['action']				=
JRoute::_(PhocacartRoute::getCheckoutRoute((int)$this->item[0]->id,
(int)$this->category[0]->id));
			//$this->t['actionbase64']		=
base64_encode(htmlspecialchars($this->t['action']));
			$this->t['actionbase64']		=
base64_encode($this->t['action']);
			$this->t['linkcheckout']		=
JRoute::_(PhocacartRoute::getCheckoutRoute((int)$this->item[0]->id,
(int)$this->category[0]->id));
			$this->t['linkitem']			=
JRoute::_(PhocacartRoute::getItemRoute((int)$this->item[0]->id,
(int)$this->category[0]->id));


			$o2 = '';
			if (!empty($this->item[0])) {
				$o2 = $this->loadTemplate('quickview');
				$model->hit((int)$id);
				PhocacartStatisticsHits::productHit((int)$id);
			}

			$response = array(
			'status'	=> '1',
			'item'		=> '',
			'popup'		=> $o2);

			echo json_encode($response);
			return;
		}
	}

	protected function _prepareDocument() {}
}
?>
views/items/index.html000064400000000054151167552070011027
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/items/metadata.xml000064400000000265151167552070011340
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view title="COM_PHOCACART_ITEMS_GROUP">
		<message><![CDATA[COM_PHOCACART_ITEMS_GROUP_DESC]]></message>
	</view>
</metadata>views/items/tmpl/default.php000064400000045567151167552070012165
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;

defined('_JEXEC') or die();

$layoutC 	= new JLayoutFile('button_compare', null,
array('component' => 'com_phocacart'));
$layoutW 	= new JLayoutFile('button_wishlist', null,
array('component' => 'com_phocacart'));
$layoutQVB 	= new JLayoutFile('button_quickview', null,
array('component' => 'com_phocacart'));
$layoutS	= new JLayoutFile('product_stock', null,
array('component' => 'com_phocacart'));
$layoutPOQ	= new JLayoutFile('product_order_quantity', null,
array('component' => 'com_phocacart'));
$layoutR	= new JLayoutFile('product_rating', null,
array('component' => 'com_phocacart'));
$layoutAI	= new JLayoutFile('button_add_to_cart_icon', null,
array('component' => 'com_phocacart'));
$layoutIL	= new JLayoutFile('items_list', null,
array('component' => 'com_phocacart'));
$layoutIGL	= new JLayoutFile('items_gridlist', null,
array('component' => 'com_phocacart'));
$layoutIG	= new JLayoutFile('items_grid', null,
array('component' => 'com_phocacart'));
$layoutAAQ	= new JLayoutFile('popup_container_iframe', null,
array('component' => 'com_phocacart'));

// HEADER - NOT AJAX
if (!$this->t['ajax']) {
	echo '<div id="ph-pc-category-box"
class="pc-category-view'.$this->p->get(
'pageclass_sfx' ).'">';
	echo $this->loadTemplate('header');
	echo $this->loadTemplate('pagination_top');
	echo '<div id="phItemsBox">';
}



// ITEMS a) items displayed by layout plugin, b) items displayed common
way, c) no items found
if (!empty($this->items) &&
$this->t['pluginlayout']) {

	$pluginOptions 				= array();
	$eventData 					= array();
	$dLA 						= array();
	$eventData['pluginname'] 	=
$this->t['items_layout_plugin'];

	Factory::getApplication()->triggerEvent('PCLonItemsGetOptions',
array('com_phocacart.items', &$pluginOptions, $eventData));

	if (isset($pluginOptions['layouttype']) &&
$pluginOptions['layouttype'] != '') {
		$this->t['layouttype'] =
PhocacartText::filterValue($pluginOptions['layouttype'],
'alphanumeric5');
	}

	$lt			= $this->t['layouttype'];
	$dLA['t'] 	= $this->t;
	$dLA['s'] 	= $this->s;

	echo '<div id="phItems" class="ph-items
'.$lt.'">';

	Factory::getApplication()->triggerEvent('PCLonItemsInsideLayout',
array('com_phocacart.items', &$this->items, $dLA,
$eventData));

	echo $this->loadTemplate('pagination');

	echo '</div>'. "\n"; // end items

} else if (!empty($this->items)) {

	$price	= new PhocacartPrice;
	$col 	=
PhocacartRenderFront::getColumnClass((int)$this->t['columns_cat']);

	$lt		= $this->t['layouttype'];
	$i		= 1; // Not equal Heights

	echo '<div id="phItems" class="ph-items
'.$lt.'">';
	echo '<div
class="'.PhocacartRenderFront::completeClass(array($this->s['c']['row'],
$this->t['class_row_flex'],
$this->t['class_lazyload'], $lt)).'">';

	foreach ($this->items as $v) {

		// DIFF CATEGORY / ITEMS
		$this->t['categoryid'] = (int)$v->catid;

		$label 		= PhocacartRenderFront::getLabel($v->date, $v->sales,
$v->featured);
		$link 		= JRoute::_(PhocacartRoute::getItemRoute($v->id, $v->catid,
$v->alias, $v->catalias));


		// Image data
		$attributesOptions 	= $this->t['hide_attributes_category']
== 0 ? PhocacartAttribute::getAttributesAndOptions((int)$v->id) :
array();
		if (!isset($v->additional_image)) { $v->additional_image =
'';}
		$image = PhocacartImage::getImageDisplay($v->image,
$v->additional_image, $this->t['pathitem'],
$this->t['switch_image_category_items'],
$this->t['image_width_cat'],
$this->t['image_height_cat'], '', $lt,
$attributesOptions);


		// :L: IMAGE
		$dI	= array();
		if (isset($image['image']->rel) &&
$image['image']->rel != '') {
			$dI['t']				= $this->t;
			$dI['s']				= $this->s;
			$dI['product_id']		= (int)$v->id;
			$dI['layouttype']		= $lt;
            $dI['title']			= $v->title;
			$dI['image']			= $image;
			$dI['typeview']			= 'Items';
		}

		// :L: COMPARE
		$icon 				= array();
		$icon['compare'] 	= '';
		if ($this->t['display_compare'] == 1) {
			$d			= array();
			$d['s']		= $this->s;
			$d['linkc']	= $this->t['linkcomparison'];
			$d['id']	= (int)$v->id;
			$d['catid']	= $this->t['categoryid'];
			$d['return']= $this->t['actionbase64'];
			$d['method']= $this->t['add_compare_method'];
			$icon['compare'] = $layoutC->render($d);
		}

		// :L: WISHLIST
		$icon['wishlist'] = '';
		if ($this->t['display_wishlist'] == 1) {
			$d			= array();
			$d['s']		= $this->s;
			$d['linkw']	= $this->t['linkwishlist'];
			$d['id']	= (int)$v->id;
			$d['catid']	= $this->t['categoryid'];
			$d['return']= $this->t['actionbase64'];
			$d['method']= $this->t['add_wishlist_method'];
			$icon['wishlist'] = $layoutW->render($d);
		}

		// :L: QUICKVIEW
		$icon['quickview'] = '';
		if ($this->t['display_quickview'] == 1) {
			$d				= array();
			$d['s']			= $this->s;
			$d['linkqvb']	=
JRoute::_(PhocacartRoute::getItemRoute($v->id, $v->catid,
$v->alias, $v->catalias));
			$d['id']		= (int)$v->id;
			$d['catid']		= $this->t['categoryid'];
			$d['return']	= $this->t['actionbase64'];
			$icon['quickview'] = $layoutQVB->render($d);
		}

		// :L: PRICE
		$dP = array();
		$priceItems = array();
		if ($this->t['can_display_price']) {

			$dP['type'] = $v->type;// PRODUCTTYPE

			$priceItems	= $price->getPriceItems($v->price, $v->taxid,
$v->taxrate, $v->taxcalculationtype, $v->taxtitle,
$v->unit_amount, $v->unit_unit, 1, 1, $v->group_price);

			$price->getPriceItemsChangedByAttributes($dP['priceitems'],
$attributesOptions, $price, $v);
			$dP['priceitemsorig']= array();
			$dP['priceitems']	= $priceItems;

			if ($v->price_original != '' &&
$v->price_original > 0) {
				$dP['priceitemsorig'] =
$price->getPriceItems($v->price_original, $v->taxid,
$v->taxrate, $v->taxcalculationtype);
			}
			//$dP['class']		= 'ph-category-price-box '.$lt;
			$dP['class']		= 'ph-category-price-box';// Cannot be
dynamic as can change per ajax - this can cause jumping of boxes
			$dP['product_id']	= (int)$v->id;
			$dP['typeview']		= 'Items';

			// Display discount price
			// Move standard prices to new variable (product price -> product
discount)
			$dP['priceitemsdiscount']		= $dP['priceitems'];
			$dP['discount'] 				=
PhocacartDiscountProduct::getProductDiscountPrice($v->id,
$dP['priceitemsdiscount']);

			// Display cart discount (global discount) in product views - under
specific conditions only
			// Move product discount prices to new variable (product price ->
product discount -> product discount cart)
			$dP['priceitemsdiscountcart']	=
$dP['priceitemsdiscount'];
			$dP['discountcart']				=
PhocacartDiscountCart::getCartDiscountPriceForProduct($v->id,
$v->catid, $dP['priceitemsdiscountcart']);

			$dP['zero_price']		= 1;// Apply zero price if possible
		}


		// :L: LINK TO PRODUCT VIEW
		$dV = array();
		$dV['s'] = $this->s;
		$dV['display_view_product_button'] 	=
$this->t['display_view_product_button'];
		if ((int)$this->t['display_view_product_button'] > 0) {
			$dV['link']							= $link;
			//$dV['display_view_product_button'] 	=
$this->t['display_view_product_button'];
		}

		// :L: ADD TO CART
		$dA = $dA2 = $dA3 = $dA4 = $dAb = $dF = array();
		$icon['addtocart'] = '';

		// STOCK ===================================================
		// Set stock: product, variations, or advanced stock status
		$dSO 				= '';
		$dA['class_btn']	= '';
		$dA['class_icon']	= '';
		$dA['s']	        = $this->s;
		if ($this->t['display_stock_status'] == 2 ||
$this->t['display_stock_status'] == 3) {

			$stockStatus 				= array();
			$stock 						=
PhocacartStock::getStockItemsChangedByAttributes($stockStatus,
$attributesOptions, $v);

			if ($this->t['hide_add_to_cart_stock'] == 1 &&
(int)$stock < 1) {
				$dA['class_btn'] 		= 'ph-visibility-hidden';// hide
button
				$dA['class_icon']		= 'ph-display-none';// hide
icon
			}

			if($stockStatus['stock_status'] ||
$stockStatus['stock_count'] !== false) {
				$dS							= array();
				$dS['s']	                = $this->s;
				$dS['class']				= 'ph-category-stock-box';
				$dS['product_id']			= (int)$v->id;
				$dS['typeview']				= 'Category';
				$dS['stock_status_output'] 	=
PhocacartStock::getStockStatusOutput($stockStatus);
				$dSO = $layoutS->render($dS);
			}

			if($stockStatus['min_quantity']) {
				$dPOQ						= array();
				$dPOQ['s']	                = $this->s;
				$dPOQ['text']				=
JText::_('COM_PHOCACART_MINIMUM_ORDER_QUANTITY');
				$dPOQ['status']				= $stockStatus['min_quantity'];
				$dSO .= $layoutPOQ->render($dPOQ);
			}

			if($stockStatus['min_multiple_quantity']) {
				$dPOQ						= array();
				$dPOQ['s']	                = $this->s;
				$dPOQ['text']				=
JText::_('COM_PHOCACART_MINIMUM_MULTIPLE_ORDER_QUANTITY');
				$dPOQ['status']				=
$stockStatus['min_multiple_quantity'];
				$dSO .= $layoutPOQ->render($dPOQ);
			}
		}
		// END STOCK ================================================


		// ------------------------------------
		// BUTTONS + ICONS
		// ------------------------------------
		// Prepare data for Add to cart button
		// - Add To Cart Standard Button
		// - Add to Cart Icon Button
		// - Add to Cart Icon Only
		if ((int)$this->t['category_addtocart'] == 1 ||
(int)$this->t['category_addtocart'] == 4 ||
$this->t['display_addtocart_icon'] == 1) {

			// FORM DATA
            $dF['s']	                = $this->s;
			$dF['linkch']				= $this->t['linkcheckout'];//
link to checkout (add to cart)
			$dF['id']					= (int)$v->id;
			$dF['catid']				= $this->t['categoryid'];
			$dF['return']				= $this->t['actionbase64'];
			$dF['typeview']				= 'Items';
			$dA['addtocart']			=
$this->t['category_addtocart'];
			$dA['addtocart_icon']		=
$this->t['display_addtocart_icon'];

			// Both buttons + icon
			$dA['s']					= $this->s;
			$dA['id']					= (int)$v->id;
			$dA['link']					= $link;// link to item (product) view e.g.
when there are required attributes - we cannot add it to cart
			$dA['addtocart']			=
$this->t['category_addtocart'];
			$dA['method']				= $this->t['add_cart_method'];
			$dA['typeview']				= 'Items';

			// ATTRIBUTES, OPTIONS
			$dAb['s']						= $this->s;
			$dAb['attr_options']			= $attributesOptions;
			$dAb['hide_attributes']			=
$this->t['hide_attributes_category'];
			$dAb['dynamic_change_image'] 	=
$this->t['dynamic_change_image'];
			$dAb['remove_select_option_attribute']	=
$this->t['remove_select_option_attribute'];
			$dAb['zero_attribute_price']	=
$this->t['zero_attribute_price'];
			$dAb['pathitem']				= $this->t['pathitem'];

			$dAb['product_id']				= (int)$v->id;
			$dAb['gift_types']				= $v->gift_types;
			$dAb['image_size']				= $image['size'];
			$dAb['typeview']				= 'Items';
			$dAb['price']					= $price;
			$dAb['priceitems']				= $priceItems;

			// Attribute is required and we don't display it in category/items
view, se we need to redirect to detail view
			$dA['selectoptions']	= 0;
			if (isset($v->attribute_required) &&
$v->attribute_required == 1 &&
$this->t['hide_attributes_category'] == 1) {
				$dA['selectoptions']	= 1;
			}

			// Add To Cart as Icon
			if ($this->t['display_addtocart_icon'] == 1) {
				$icon['addtocart'] 	= $layoutAI->render($dA);

			}
		}

		// Different button or icons
		$addToCartHidden = 0;// Design parameter - if there is no button (add to
cart, paddle link, external link), used e.g. for displaying ask a question
button
		// Type 3 is Product Price on Demand - there is no add to cart button
except Quick View Button
		if ($v->type == 3 &&
(int)$this->t['category_addtocart'] != 104) {
			// PRODUCTTYPE - price on demand price cannot be added to cart
			$dA = array(); // Skip Standard Add to cart button
			$icon['addtocart'] = '';// Skip Add to cart icon
except Quick View Button
			$dF = array();// Skip form
			$addToCartHidden = 1;
		} else if ($this->t['hide_add_to_cart_zero_price'] == 1
&& $v->price == 0) {
			// Don't display Add to Cart in case the price is zero
			$dA = array(); // Skip Standard Add to cart button
			$icon['addtocart'] = '';// Skip Add to cart icon
			$dF = array();// Skip form
			$addToCartHidden = 1;
		} else if ((int)$this->t['category_addtocart'] == 1 ||
(int)$this->t['category_addtocart'] == 4) {
			// ADD TO CART BUTTONS - we have data yet
		} else if ((int)$this->t['category_addtocart'] == 102
&& (int)$v->external_id != '') {
			// EXTERNAL LINK PADDLE
			$dA2['t']				= $this->t;
			$dA2['s']				= $this->s;
			$dA2['external_id']		= (int)$v->external_id;
			$dA2['return']			= $this->t['actionbase64'];

			$dA = array(); // Skip Standard Add to cart button
			$icon['addtocart'] = '';// Skip Add to cart icon
			$dF = array();// Skip form

		} else if ((int)$this->t['category_addtocart'] == 103
&& $v->external_link != '') {
			// EXTERNAL LINK
			$dA3['t']				= $this->t;
			$dA3['s']				= $this->s;
			$dA3['external_link']	= $v->external_link;
			$dA3['external_text']	= $v->external_text;
			$dA3['return']			= $this->t['actionbase64'];

			$dA = array(); // Skip Standard Add to cart button
			$icon['addtocart'] = '';// Skip Add to cart icon
			$dF = array();// Skip form

		} else if ((int)$this->t['category_addtocart'] == 104) {
			// QUICK VIEW
			$dA4				= array();
			$dA4['s']			= $this->s;
			$dA4['linkqvb']		=
JRoute::_(PhocacartRoute::getItemRoute($v->id, $v->catid,
$v->alias, $v->catalias));
			$dA4['id']			= (int)$v->id;
			$dA4['catid']		= $this->t['categoryid'];
			$dA4['return']		= $this->t['actionbase64'];
			$dA4['button'] 		= 1;

			$dA = array(); // Skip Standard Add to cart button
			$icon['addtocart'] = '';// Skip Add to cart icon
			$dF = array();// Skip form

		} else {
			// ADD TO CART ICON ONLY (NO BUTTONS)
			$dA = array(); // Skip Standard Add to cart button
			// We remove the $dA completely, even for the icon, but the icon has the
data already stored in $icon['addtocart']
			// so no problem with removing the data completely
			// $dA for button will be rendered
			// $dA for icon was rendered already
			// Do not skip the form here
			$addToCartHidden = 1;
		}
		// ---------------------------- END BUTTONS

		$dQ	= array();
		if (((int)$this->t['category_askquestion'] == 1) ||
($this->t['category_askquestion'] == 2 &&
((int)$this->t['category_addtocart'] == 0 || $addToCartHidden
!= 0))) {

			$dQ['s']			= $this->s;
			$dQ['id']			= (int)$v->id;
			$dQ['catid']		= $this->t['categoryid'];
			$dQ['popup']		= 0;
			$tmpl				= '';
			if ((int)$this->t['popup_askquestion'] > 0) {
				$dQ['popup']		=
(int)$this->t['popup_askquestion'];
				$popupAskAQuestion	= (int)$this->t['popup_askquestion'];
				$tmpl				= 'tmpl=component';
			}
			$dQ['link']			= 
JRoute::_(PhocacartRoute::getQuestionRoute($v->id, $v->catid,
$v->alias, $v->catalias, $tmpl));
			$dQ['return']		= $this->t['actionbase64'];
		}


		// ======
		// RENDER
		// ======
		$dL 					= array();
		$dL['t']				= $this->t;
		$dL['s']				= $this->s;
		$dL['col']				= $col;
		$dL['link'] 			= $link;
		$dL['lt']				= $lt;// Layout Type
		$dL['layout']['dI']		= $dI;// Image
		$dL['layout']['dP']		= $dP;// Price
		$dL['layout']['dSO']	= $dSO;// Stock Output
		$dL['layout']['dF']		= $dF;// Form
		$dL['layout']['dAb']	= $dAb;// Attributes
		$dL['layout']['dV']		= $dV;// Link to Product View
		$dL['layout']['dA']		= $dA;// Button Add to Cart
		$dL['layout']['dA2']	= $dA2;// Button Buy now
		$dL['layout']['dA3']	= $dA3;// Button external link
		$dL['layout']['dA4']	= $dA4;// Button external link
		$dL['layout']['dQ']		= $dQ;// Ask A Question


		$dL['icon']				= $icon;// Icons
		$dL['product_header']	=
PhocacartRenderFront::renderProductHeader($this->t['product_name_link'],
$v, 'item', '', $lt);

		//$dL['product_header'] .= '<div>SKU:
'.$v->sku.'</div>';
		//$dL['product_header'] .= '<div>EAN:
'.$v->ean.'</div>';

		// Events
		$results =
\JFactory::getApplication()->triggerEvent('PCVonItemsItemAfterAddToCart',
array('com_phocacart.items', &$v, &$this->p));
		$dL['event']['onCategoryItemsItemAfterAddToCart'] =
trim(implode("\n", $results));

		// LABELS
		$dL['labels'] =  $label['new'] .
$label['hot'] . $label['feat'];
		$tagLabelsOutput = PhocacartTag::getTagsRendered((int)$v->id,
$this->t['category_display_labels']);
		if ($tagLabelsOutput != '') {
			$dL['labels'] .= $tagLabelsOutput;
		}


		// REVIEW - STAR RATING
		$dL['review'] = '';
		if ((int)$this->t['display_star_rating'] > 0) {
			$d							= array();
			$d['s']	                    = $this->s;
			$d['rating']				= isset($v->rating) &&
(int)$v->rating > 0 ? (int)$v->rating : 0;
			$d['size']					= 16;
			$d['display_star_rating']	=
(int)$this->t['display_star_rating'];
			$dL['review'] = $layoutR->render($d);
		}

		// DESCRIPTION
		$dL['description'] = '';
		if ($this->t['cv_display_description'] == 1 &&
$v->description != '') {
			$dL['description'] = '<div
class="ph-item-desc">' .
HTMLHelper::_('content.prepare', $v->description) .
'</div>';
		}

		// TAGS
		$dL['tags'] =  '';
		$tagsOutput = PhocacartTag::getTagsRendered((int)$v->id,
$this->t['category_display_tags'], ', ');
		if ($tagsOutput != '') {
			$dL['tags'] .= $tagsOutput;
		}

		// MANUFACTURER
		$dL['manufacturer'] =  '';
		if ($this->t['category_display_manufacturer'] > 0
&& (int)$v->manufacturerid > 0 &&
$v->manufacturertitle != '') {
			$dL['manufacturer'] .=
PhocacartManufacturer::getManufacturerRendered((int)$v->manufacturerid,
$v->manufacturertitle, $v->manufactureralias,
$this->t['manufacturer_alias'],
$this->t['category_display_manufacturer'], 0, '');
		}

		if ($lt == 'list') {
			echo $layoutIL->render($dL);
		} else if ( $lt == 'gridlist') {
			echo $layoutIGL->render($dL);
		} else  {
			echo $layoutIG->render($dL);
		}
		// --------------- END RENDER





		if ($i%(int)$this->t['columns_cat'] == 0) {
			echo '<div class="ph-cb
'.$lt.'"></div>';
		}
		$i++;
	}

	echo '</div>';// end row (row-flex)
	echo '<div class="ph-cb
'.$lt.'"></div>';

	echo $this->loadTemplate('pagination');

	echo '</div>'. "\n"; // end items
} else {

	echo '<div
class="ph-no-items-found">'.JText::_('COM_PHOCACART_NO_ITEMS_FOUND').'</div>';
}


// FOOTER - NOT AJAX
if (!$this->t['ajax']) {

	echo '</div>';// end #phItemsBox
	echo '</div>';// end #ph-pc-category-box

	echo '<div id="phContainer"></div>';
	if (isset($popupAskAQuestion) && $popupAskAQuestion == 2) {

		echo '<div id="phContainerPopup">';
		$d						= array();
		$d['id']				= 'phAskAQuestionPopup';
		$d['title']				=
JText::_('COM_PHOCACART_ASK_A_QUESTION');
		$d['icon']				=
$this->s['i']['question-sign'];
		$d['t']					= $this->t;
		$d['s']					= $this->s;
		echo $layoutAAQ->render($d);
		echo '</div>';// end phContainerPopup
	}
	echo '<div>&nbsp;</div>';
	echo PhocacartUtilsInfo::getInfo();
}
?>
views/items/tmpl/default.xml000064400000002755151167552070012166
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_PHOCACART_ITEM_LIST_LAYOUT">
		<message>
			<![CDATA[COM_PHOCACART_ITEM_LIST_LAYOUT_DESC]]>
		</message>
	</layout>
		<name>COM_PHOCACART_ITEM_LIST_LAYOUT</name>
		<description>COM_PHOCACART_ITEM_LIST_LAYOUT_DESC</description>
		<fields name="request">
		<fieldset name="request"
addfieldpath="/administrator/components/com_phocacart/models/fields">




		</fieldset>
	</fields>

	<fields name="params">
<fieldset name="basic"
addfieldpath="/administrator/components/com_phocacart/models/fields"
>

		<field name="show_pagination" type="radio" 
class="btn-group btn-group-yesno" default="1"
label="COM_PHOCACART_FIELD_SHOW_PAGINATION_LABEL"
description="COM_PHOCACART_FIELD_SHOW_PAGINATION_DESC">
			<option value="0">COM_PHOCACART_HIDE</option>
			<option value="1">COM_PHOCACART_DISPLAY</option>
		</field>

		<field name="show_pagination_top" type="radio" 
class="btn-group btn-group-yesno" default="1"
label="COM_PHOCACART_FIELD_SHOW_PAGINATION_TOP_LABEL"
description="COM_PHOCACART_FIELD_SHOW_PAGINATION_TOP_DESC">
			<option value="0">COM_PHOCACART_HIDE</option>
			<option value="1">COM_PHOCACART_DISPLAY</option>
		</field>

		<field name="items_view_id_cats"
type="phocacartcategory" section="com_phocacart"
default="0"
label="COM_PHOCACART_FIELD_ITEMS_VIEW_FORCE_CATEGORY_LABEL"
description="COM_PHOCACART_FIELD_ITEMS_VIEW_FORCE_CATEGORY_DESC"
multiple="true" />


		</fieldset>
</fields>
</metadata>
views/items/tmpl/default_header.php000064400000003341151167552070013455
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();






if (isset($this->category[0]->parentid) &&
($this->t['display_back'] == 1 ||
$this->t['display_back'] == 3)) {
	if ($this->category[0]->parentid == 0) {
		$linkUp = JRoute::_(PhocacartRoute::getCategoriesRoute());
		$linkUpText = JText::_('COM_PHOCACART_CATEGORIES');
	} else if ($this->category[0]->parentid > 0) {
		$linkUp =
JRoute::_(PhocacartRoute::getCategoryRoute($this->category[0]->parentid,
$this->category[0]->parentalias));
		$linkUpText = $this->category[0]->parenttitle;
	} else {
		$linkUp 	= false;
		$linkUpText = false;
	}

	if ($linkUp && $linkUpText) {
		echo '<div class="ph-top">'
		.'<a
class="'.$this->s['c']['btn.btn-success'].'"
title="'.$linkUpText.'" href="'.
$linkUp.'" >'
        .'<span
class="'.$this->s['i']['back-category'].'"></span>
'.JText::_($linkUpText).'</a>'
        .'</div>';
	}
}

echo $this->t['event']->onItemsBeforeHeader;

$title = '';
if (isset($this->category[0]->title) &&
$this->category[0]->title != '') {
	$title = $this->category[0]->title;
}

// DIFF CATEGORY / ITEMS
echo PhocacartRenderFront::renderHeader(array($title,
JText::_('COM_PHOCACART_ITEMS')), '',
$this->t['image_items_view']);

if ( isset($this->category[0]->description) &&
$this->category[0]->description != '') {
	echo '<div class="ph-desc">'.
Joomla\CMS\HTML\HTMLHelper::_('content.prepare',
$this->category[0]->description). '</div>';
}
?>
views/items/tmpl/default_pagination.php000064400000001246151167552070014360
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$this->t['action'] = str_replace('&amp;',
'&', $this->t['action']);
$this->t['action'] =
htmlspecialchars($this->t['action']);

$layout 			= new JLayoutFile('category_pagination', null,
array('component' => 'com_phocacart'));
$d					= array();
$d['t']				= $this->t;
$d['s']				= $this->s;
echo $layout->render($d);
?>
views/items/tmpl/default_pagination_top.php000064400000001252151167552070015237
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$this->t['action'] = str_replace('&amp;',
'&', $this->t['action']);
$this->t['action'] =
htmlspecialchars($this->t['action']);

$layout 			= new JLayoutFile('category_pagination_top', null,
array('component' => 'com_phocacart'));
$d					= array();
$d['t']				= $this->t;
$d['s']				= $this->s;
echo $layout->render($d);
?>
views/items/tmpl/index.html000064400000000054151167552070012003
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/items/view.html.php000064400000035534151167552070011473
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license   http://www.gnu.org/copyleft/gpl.html GNU/GPL, see
LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license   http://www.gnu.org/copyleft/gpl.html GNU/GPL
 *
 * Why Items View or why category view? Category view always has category
ID,
 * but items view is here for filtering and searching and this can be
without category ID
 */
defined('_JEXEC') or die();
jimport('joomla.application.component.view');
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');

class PhocaCartViewItems extends JViewLegacy
{
    protected $category;
    //protected $subcategories;
    protected $items;
    protected $t;
    protected $r;
    protected $p;
    protected $s;

    function display($tpl = null) {


        $app                   = JFactory::getApplication();
        $this->p               = $app->getParams();
        $this->s               = PhocacartRenderStyle::getStyles();
        $uri                   = \Joomla\CMS\Uri\Uri::getInstance();
        $model                 = $this->getModel();
        $document              = JFactory::getDocument();
        $this->t['categoryid'] =
$app->input->get('id', 0, 'int');// optional
        $this->t['limitstart'] =
$app->input->get('limitstart', 0, 'int');
        $this->t['ajax']       = 0;



        // PARAMS

		$this->t['view']			= 'items';
		$this->t['items_layout_plugin']	= $this->p->get(
'items_layout_plugin', '');
        $this->t['display_new']   =
$this->p->get('display_new', 0);
        $this->t['cart_metakey']  =
$this->p->get('cart_metakey', '');
        $this->t['cart_metadesc'] =
$this->p->get('cart_metadesc', '');
        //$this->t['description']			= $this->p->get(
'description', '' );
        $this->t['cv_display_description'] =
$this->p->get('cv_display_description', 1);
        $this->t['image_width_cat']        =
$this->p->get('image_width_cat', '');
        $this->t['image_height_cat']       =
$this->p->get('image_height_cat', '');
        //$this->t['image_link']			= $this->p->get(
'image_link', 0 );
        $this->t['columns_cat']   =
$this->p->get('columns_cat', 3);
        $this->t['enable_social'] =
$this->p->get('enable_social', 0);
        //$this->t['cv_display_subcategories']=
$this->p->get( 'cv_display_subcategories', 5 );
        $this->t['display_back']           =
$this->p->get('display_back', 3);
        $this->t['display_compare']        =
$this->p->get('display_compare', 0);
        $this->t['display_wishlist']       =
$this->p->get('display_wishlist', 0);
        $this->t['display_quickview']      =
$this->p->get('display_quickview', 0);
        $this->t['display_addtocart_icon'] =
$this->p->get('display_addtocart_icon', 0);
        $this->t['fade_in_action_icons']   =
$this->p->get('fade_in_action_icons', 0);

        // Hide action icon box if no icon displayed
        $this->t['display_action_icons'] = 1;
        if ($this->t['display_compare'] == 0 &&
$this->t['display_wishlist'] == 0 &&
$this->t['display_quickview'] == 0 &&
$this->t['display_addtocart_icon'] == 0) {
            $this->t['display_action_icons'] = 0;
        }

        $this->t['category_addtocart']          =
$this->p->get('category_addtocart', 1);
        $this->t['dynamic_change_image']        =
$this->p->get('dynamic_change_image', 0);
        $this->t['dynamic_change_price']        =
$this->p->get('dynamic_change_price', 0);
        $this->t['dynamic_change_stock']        =
$this->p->get('dynamic_change_stock', 0);
        $this->t['dynamic_change_id']           =
$this->p->get('dynamic_change_id', 0);
        $this->t['remove_select_option_attribute']=
$this->p->get( 'remove_select_option_attribute', 1 );
        $this->t['add_compare_method']          =
$this->p->get('add_compare_method', 0);
        $this->t['add_wishlist_method']         =
$this->p->get('add_wishlist_method', 0);
        $this->t['display_addtocart']           =
$this->p->get('display_addtocart', 1);
        $this->t['display_star_rating']         =
$this->p->get('display_star_rating', 0);
        $this->t['add_cart_method']             =
$this->p->get('add_cart_method', 0);
        $this->t['hide_attributes_category']    =
$this->p->get('hide_attributes_category', 1);
        $this->t['hide_attributes']             =
$this->p->get('hide_attributes', 0);
        $this->t['display_stock_status']        =
$this->p->get('display_stock_status', 1);
        $this->t['hide_add_to_cart_stock']      =
$this->p->get('hide_add_to_cart_stock', 0);
        $this->t['zero_attribute_price']        =
$this->p->get('zero_attribute_price', 1);
        $this->t['hide_add_to_cart_zero_price'] =
$this->p->get('hide_add_to_cart_zero_price', 0);
        $this->t['category_askquestion']        =
$this->p->get('category_askquestion', 0);
        $this->t['popup_askquestion']           =
$this->p->get('popup_askquestion', 1);


        // Rights or catalogue options --------------------------------
        $rights                            = new PhocacartAccessRights();
        $this->t['can_display_price']      =
$rights->canDisplayPrice();
        $this->t['can_display_addtocart']  =
$rights->canDisplayAddtocart();
        $this->t['can_display_attributes'] =
$rights->canDisplayAttributes();

        if (!$this->t['can_display_addtocart']) {
            $this->t['category_addtocart']     = 0;
            $this->t['display_addtocart_icon'] = 0;
            //$this->t['hide_attributes_category']= 1; Should
be displayed or not?
        }
        if (!$this->t['can_display_attributes']) {
            $this->t['hide_attributes_category'] = 1;
        }
        // ------------------------------------------------------------

        $this->t['display_view_product_button'] =
$this->p->get('display_view_product_button', 1);
        $this->t['product_name_link']           =
$this->p->get('product_name_link', 0);
        $this->t['switch_image_category_items'] =
$this->p->get('switch_image_category_items', 0);

        $this->t['lazy_load_category_items']      =
$this->p->get('lazy_load_category_items', 0);// Products
        $this->t['lazy_load_categories']          =
$this->p->get('lazy_load_categories', 0);    //
Subcategories
        $this->t['medium_image_width']            =
$this->p->get('medium_image_width', 300);
        $this->t['medium_image_height']           =
$this->p->get('medium_image_height', 200);
        $this->t['small_image_width']             =
$this->p->get('small_image_width', 180);
        $this->t['small_image_height']            =
$this->p->get('small_image_height', 120);
        $this->t['display_webp_images']           =
$this->p->get('display_webp_images', 0);
        $this->t['category_display_labels']       =
$this->p->get('category_display_labels', 2);
        $this->t['category_display_tags']         =
$this->p->get('category_display_tags', 0);
        $this->t['category_display_manufacturer'] =
$this->p->get('category_display_manufacturer', 0);

        $this->t['manufacturer_alias'] =
$this->p->get('manufacturer_alias',
'manufacturer');
        $this->t['manufacturer_alias'] =
$this->t['manufacturer_alias'] != '' ?
trim(PhocacartText::filterValue($this->t['manufacturer_alias'],
'alphanumeric')) : 'manufacturer';

        $this->t['show_pagination']           =
$this->p->get('show_pagination');
        $this->t['show_pagination_top']       =
$this->p->get('show_pagination_top', 1);
        $this->t['display_item_ordering']     =
$this->p->get('display_item_ordering');
        $this->t['display_item_ordering_top'] =
$this->p->get('display_item_ordering_top', 1);
        $this->t['show_pagination_limit']     =
$this->p->get('show_pagination_limit');
        $this->t['show_pagination_limit_top'] =
$this->p->get('show_pagination_limit_top', 1);
        $this->t['ajax_pagination_category']  =
$this->p->get('ajax_pagination_category', 0);
        $this->t['display_pagination_labels'] =
$this->p->get('display_pagination_labels', 1);
        $this->t['show_switch_layout_type']   =
$this->p->get('show_switch_layout_type', 1);


        //$this->category					=
$model->getCategory($this->t['categoryid']);
        //$this->subcategories				=
$model->getSubcategories($this->t['categoryid']);
        $this->items = $model->getItemList();

        $this->t['pagination']       =
$model->getPagination();
        $this->t['ordering']         =
$model->getOrdering();
        $this->t['layouttype']       =
$model->getLayoutType();
        $this->t['layouttypeactive'] =
PhocacartRenderFront::setActiveLayoutType($this->t['layouttype']);
        $this->t['columns_cat']      =
$this->t['layouttype'] == 'grid' ?
$this->t['columns_cat'] : 1;

        $this->t['action'] = $uri->toString();
        //$this->t['actionbase64']			=
base64_encode(htmlspecialchars($this->t['action']));
        $this->t['actionbase64']   =
base64_encode($this->t['action']);
        $this->t['linkcheckout']   =
JRoute::_(PhocacartRoute::getCheckoutRoute(0));
        $this->t['linkcomparison'] =
JRoute::_(PhocacartRoute::getComparisonRoute(0));
        $this->t['linkwishlist']   =
JRoute::_(PhocacartRoute::getWishListRoute(0));
        $this->t['limitstarturl']  =
$this->t['limitstart'] > 0 ? '&start=' .
$this->t['limitstart'] : '';

        $this->t['class_row_flex']             =
$this->p->get('equal_height', 1) == 1 ?
'ph-row-flex' : '';
        $this->t['class_fade_in_action_icons'] =
$this->p->get('fade_in_action_icons', 0) == 1 ?
'b-thumbnail' : '';
        $this->t['class_lazyload']             =
$this->t['lazy_load_category_items'] == 1 ?
'ph-lazyload' : '';

        $this->t['image_items_view'] =
$this->p->get('image_items_view', '');
        $this->t['image_items_view'] =
$this->t['image_items_view'] != '' ?
JURI::base(true) . '/' .
$this->t['image_items_view'] : '';

        $media = PhocacartRenderMedia::getInstance('main');
        $media->loadBase();
        $media->loadChosen();
        $media->loadProductHover();

        PhocacartRenderJs::renderAjaxAddToCart();
        //PhocacartRenderJs::renderAjaxUpdateCart();// used only in POS
        PhocacartRenderJs::renderAjaxAddToCompare();
        PhocacartRenderJs::renderAjaxAddToWishList();
        // Moved to JS
PhocacartRenderJs::renderSubmitPaginationTopForm($this->t['action'],
'#phItemsBox');

        if ((int)$this->t['category_askquestion'] > 0) {
            PhocacartRenderJs::renderAjaxAskAQuestion();
            if ($this->t['popup_askquestion'] == 1) {
                $media->loadWindowPopup();
            }
        }

        $touchSpinJs = $media->loadTouchSpin('quantity',
$this->s['i']);// only css, js will be loaded in ajax success
       
$media->loadPhocaSwapImage($this->t['dynamic_change_image']);


        if ($this->t['hide_attributes_category'] == 0) {
            $media->loadPhocaAttribute(1);
            $media->loadPhocaAttributeRequired(1); // Some of the
attribute can be required and can be a image checkbox
        }


        /*	if ($this->t['dynamic_change_price'] == 1) {
                // items == category -> this is why items has class:
ph-category-price-box (to have the same styling)
                PhocacartRenderJs::renderAjaxChangeProductPriceByOptions(0,
'Items', 'ph-category-price-box');// We need to load it
here
            }
            if ($this->t['dynamic_change_stock'] == 1) {
                PhocacartRenderJs::renderAjaxChangeProductStockByOptions(0,
'Items', 'ph-item-stock-box');
            }*/

     /*   if ($this->t['dynamic_change_id'] == 1 ||
$this->t['dynamic_change_price'] == 1 ||
$this->t['dynamic_change_stock'] == 1) {
           
PhocacartRenderJs::renderAjaxChangeProductDataByOptions((int)$this->item[0]->id,
'Items', 'ph-category-data-box');
        }*/

        // CHANGE PRICE FOR ITEM QUICK VIEW
        if ($this->t['display_quickview'] == 1 ||
$this->t['category_addtocart'] == 104) {
            PhocacartRenderJs::renderAjaxQuickViewBox();

            // CHANGE PRICE FOR ITEM QUICK VIEW
            /*if ($this->t['dynamic_change_price'] == 1) {
                PhocacartRenderJs::renderAjaxChangeProductPriceByOptions(0,
'ItemQuick', 'ph-item-price-box');// We need to load it
here
            }
            if ($this->t['dynamic_change_stock'] == 1) {
                PhocacartRenderJs::renderAjaxChangeProductStockByOptions(0,
'ItemQuick', 'ph-item-stock-box');
            }*/

           /* if ($this->t['dynamic_change_id'] == 1 ||
$this->t['dynamic_change_price'] == 1 ||
$this->t['dynamic_change_stock'] == 1) {
                PhocacartRenderJs::renderAjaxChangeProductDataByOptions(0,
'ItemQuick', 'ph-item-data-box');
            }*/


            $media->loadPhocaAttribute(1);                              
// We need to load it here
           
$media->loadPhocaSwapImage($this->t['dynamic_change_image']);//
We need to load it here in ITEM (QUICK VIEW) VIEW
        }

       
$media->loadPhocaMoveImage($this->t['switch_image_category_items']);//
Move (switch) images in CATEGORY, ITEMS VIEW

        $media->loadSpec();


        $this->_prepareDocument();
        $this->t['pathcat']  =
PhocacartPath::getPath('categoryimage');
        $this->t['pathitem'] =
PhocacartPath::getPath('productimage');


        // Plugins ------------------------------------------
        JPluginHelper::importPlugin('pcv');
        //$this->t['dispatcher']	= J
EventDispatcher::getInstance();
        $this->t['event']                      = new
stdClass;
        $results                               =
\JFactory::getApplication()->triggerEvent('PCVonItemsBeforeHeader',
array('com_phocacart.items', &$this->items,
&$this->p));
        $this->t['event']->onItemsBeforeHeader =
trim(implode("\n", $results));
        // Foreach values are rendered in default foreaches

        // Layout plugins - completely new layout including foreach
        $this->t['pluginlayout']        = false;

        if ($this->t['items_layout_plugin'] != '')
{
            $this->t['items_layout_plugin']     =
PhocacartText::filterValue($this->t['items_layout_plugin'],
'alphanumeric2');
            $this->t['pluginlayout'] 	        =
JPluginHelper::importPlugin('pcl',
$this->t['items_layout_plugin']);
        }


		if ($this->t['pluginlayout']) {
            $this->t['show_switch_layout_type'] = 0;
        }
        // END Plugins --------------------------------------




        parent::display($tpl);

        echo $media->returnLazyLoad();// Render all bottom scripts //
Must be loaded bottom because of ignoring async in Firefox

    }


    protected function _prepareDocument() {
        $category = false;
        if (isset($this->category[0]) &&
is_object($this->category[0])) {
            $category = $this->category[0];
        }
        PhocacartRenderFront::prepareDocument($this->document,
$this->p, $category);
    }
}

?>
views/items/view.raw.php000064400000023764151167552070011322
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');
jimport( 'joomla.filesystem.folder' );
jimport( 'joomla.filesystem.file' );

class PhocaCartViewItems extends JViewLegacy
{
	protected $category;
	protected $subcategories;
	protected $items;
	protected $t;
	protected $r;
	protected $p;
	protected $s;

	function display($tpl = null) {

		$app						= JFactory::getApplication();
		$this->p 					= $app->getParams();
		$this->s					= PhocacartRenderStyle::getStyles();
		$uri 						= \Joomla\CMS\Uri\Uri::getInstance();
		$model						= $this->getModel();
		$document					= JFactory::getDocument();
		$this->t['categoryid']		= $app->input->get(
'id', 0, 'int' );
		$this->t['limitstart']		= $app->input->get(
'limitstart', 0, 'int' );
		$this->t['ajax'] 			= 1;



		// PARAMS

		$this->t['view']			= 'items';
		$this->t['items_layout_plugin']	= $this->p->get(
'items_layout_plugin', '');
		$this->t['display_new']				= $this->p->get(
'display_new', 0 );
		$this->t['cart_metakey'] 			= $this->p->get(
'cart_metakey', '' );
		$this->t['cart_metadesc'] 			= $this->p->get(
'cart_metadesc', '' );
		//$this->t['description']			= $this->p->get(
'description', '' );
		$this->t['cv_display_description']	= $this->p->get(
'cv_display_description', 1 );
		$this->t['image_width_cat']			= $this->p->get(
'image_width_cat', '' );
		$this->t['image_height_cat']		= $this->p->get(
'image_height_cat', '' );
		//$this->t['image_link']			= $this->p->get(
'image_link', 0 );
		$this->t['columns_cat']				= $this->p->get(
'columns_cat', 3 );
		$this->t['columns_subcat_cat']		= $this->p->get(
'columns_subcat_cat', 3 );
		$this->t['enable_social']			= $this->p->get(
'enable_social', 0 );
		$this->t['cv_display_subcategories']= $this->p->get(
'cv_display_subcategories', 5 );
		$this->t['display_back']			= $this->p->get(
'display_back', 3 );
		$this->t['display_compare']			= $this->p->get(
'display_compare', 0 );
		$this->t['display_wishlist']		= $this->p->get(
'display_wishlist', 0 );
		$this->t['display_quickview']		= $this->p->get(
'display_quickview', 0 );
		$this->t['display_addtocart_icon']	= $this->p->get(
'display_addtocart_icon', 0 );
		$this->t['fade_in_action_icons']	= $this->p->get(
'fade_in_action_icons', 0 );

		// Hide action icon box if no icon displayed
		$this->t['display_action_icons'] = 1;
		if ($this->t['display_compare'] == 0 &&
$this->t['display_wishlist'] == 0 &&
$this->t['display_quickview'] == 0 &&
$this->t['display_addtocart_icon'] == 0) {
			$this->t['display_action_icons'] = 0;
		}

		$this->t['category_addtocart']		= $this->p->get(
'category_addtocart', 1 );
		$this->t['dynamic_change_image']	= $this->p->get(
'dynamic_change_image', 0);
		$this->t['dynamic_change_price']	= $this->p->get(
'dynamic_change_price', 0 );
		$this->t['dynamic_change_stock']	= $this->p->get(
'dynamic_change_stock', 0 );
		$this->t['remove_select_option_attribute']=
$this->p->get( 'remove_select_option_attribute', 1 );
		$this->t['add_compare_method']		= $this->p->get(
'add_compare_method', 0 );
		$this->t['add_wishlist_method']		= $this->p->get(
'add_wishlist_method', 0 );
		$this->t['display_addtocart']		= $this->p->get(
'display_addtocart', 1 );
		$this->t['display_star_rating']		= $this->p->get(
'display_star_rating', 0 );
		$this->t['add_cart_method']			= $this->p->get(
'add_cart_method', 0 );
		$this->t['hide_attributes_category']= $this->p->get(
'hide_attributes_category', 1 );
		$this->t['hide_attributes']			= $this->p->get(
'hide_attributes', 0 );
		$this->t['display_stock_status']	= $this->p->get(
'display_stock_status', 1 );
		$this->t['hide_add_to_cart_stock']	= $this->p->get(
'hide_add_to_cart_stock', 0 );
		$this->t['zero_attribute_price']	= $this->p->get(
'zero_attribute_price', 1 );
		$this->t['hide_add_to_cart_zero_price']	=
$this->p->get( 'hide_add_to_cart_zero_price', 0 );
		$this->t['category_askquestion']	 	= $this->p->get(
'category_askquestion', 0 );
		$this->t['popup_askquestion']		    = $this->p->get(
'popup_askquestion', 1 );

		// Rights or catalogue options --------------------------------
		$rights								= new PhocacartAccessRights();
		$this->t['can_display_price']		=
$rights->canDisplayPrice();
		$this->t['can_display_addtocart']	=
$rights->canDisplayAddtocart();
		$this->t['can_display_attributes']	=
$rights->canDisplayAttributes();

		if (!$this->t['can_display_addtocart']) {
			$this->t['category_addtocart']		= 0;
			$this->t['display_addtocart_icon'] 	= 0;
			//$this->t['hide_attributes_category']= 1; Should be
displayed or not?
		}
		if (!$this->t['can_display_attributes']) {
			$this->t['hide_attributes_category'] = 1;
		}
		// ------------------------------------------------------------

		$this->t['display_view_product_button']	=
$this->p->get( 'display_view_product_button', 1 );
		$this->t['product_name_link']			= $this->p->get(
'product_name_link', 0 );
		$this->t['switch_image_category_items']	=
$this->p->get( 'switch_image_category_items', 0 );

		$this->t['lazy_load_category_items']	= $this->p->get(
'lazy_load_category_items', 0 );
		$this->t['lazy_load_categories']		= $this->p->get(
'lazy_load_categories', 0 );// Subcategories
		$this->t['medium_image_width']			= $this->p->get(
'medium_image_width', 300 );
		$this->t['medium_image_height']			= $this->p->get(
'medium_image_height', 200 );
		$this->t['small_image_width']           =
$this->p->get('small_image_width', 180);
        $this->t['small_image_height']          =
$this->p->get('small_image_height', 120);
		$this->t['display_webp_images']			= $this->p->get(
'display_webp_images', 0 );
		$this->t['category_display_labels']		= $this->p->get(
'category_display_labels', 2 );
		$this->t['category_display_tags']		= $this->p->get(
'category_display_tags', 0 );
		$this->t['category_display_manufacturer']		=
$this->p->get( 'category_display_manufacturer', 0 );
		$this->t['manufacturer_alias']			= $this->p->get(
'manufacturer_alias', 'manufacturer');
		$this->t['manufacturer_alias']			=
$this->t['manufacturer_alias'] != '' ?
trim(PhocacartText::filterValue($this->t['manufacturer_alias'],
'alphanumeric'))  : 'manufacturer';

		$this->t['show_pagination'] 			=
$this->p->get('show_pagination');
		$this->t['show_pagination_top'] 		=
$this->p->get('show_pagination_top', 1);
		$this->t['display_item_ordering'] 		=
$this->p->get('display_item_ordering');
		$this->t['display_item_ordering_top'] 	=
$this->p->get('display_item_ordering_top', 1);
		$this->t['show_pagination_limit'] 		=
$this->p->get('show_pagination_limit');
		$this->t['show_pagination_limit_top'] 	=
$this->p->get('show_pagination_limit_top', 1);
		$this->t['ajax_pagination_category'] 	=
$this->p->get('ajax_pagination_category', 0);
		$this->t['display_pagination_labels'] 	=
$this->p->get('display_pagination_labels', 1);
		$this->t['show_switch_layout_type'] 	=
$this->p->get('show_switch_layout_type', 1);

		//$this->category						=
$model->getCategory($this->t['categoryid']);
		//$this->subcategories		=
$model->getSubcategories($this->t['categoryid']);
		$this->items				= $model->getItemList();
		$this->t['pagination']		= $model->getPagination();
		$this->t['ordering']		= $model->getOrdering();
		$this->t['layouttype']		= $model->getLayoutType();

		$this->t['layouttypeactive'] 	=
PhocacartRenderFront::setActiveLayoutType($this->t['layouttype']);
		$this->t['columns_cat'] 		=
$this->t['layouttype'] == 'grid' ?
$this->t['columns_cat'] : 1;


		$uri->delVar('format');// !!! REMOVE format parameter
because return url needs to go to standard html
		$this->t['action']			= $uri->toString();
		//$this->t['actionbase64']	=
base64_encode(htmlspecialchars($this->t['action']));
		$this->t['actionbase64']	=
base64_encode($this->t['action']);
		$this->t['linkcheckout']	=
JRoute::_(PhocacartRoute::getCheckoutRoute(0));
		$this->t['linkcomparison']	=
JRoute::_(PhocacartRoute::getComparisonRoute(0));
		$this->t['linkwishlist']	=
JRoute::_(PhocacartRoute::getWishListRoute(0));
		$this->t['limitstarturl'] 	=
$this->t['limitstart'] > 0 ?
'&start='.$this->t['limitstart'] :
'';
		$this->t['pathcat'] 		=
PhocacartPath::getPath('categoryimage');
		$this->t['pathitem'] 		=
PhocacartPath::getPath('productimage');


		$this->t['class_row_flex']              =
$this->p->get('equal_height', 1)  == 1 ?
'ph-row-flex' : '';
        $this->t['class_fade_in_action_icons']  =
$this->p->get('fade_in_action_icons', 0)  == 1 ?
'b-thumbnail' : '';
        $this->t['class_lazyload']       		=
$this->t['lazy_load_category_items']  == 1 ?
'ph-lazyload' : '';





		//$model->hit((int)$this->t['categoryid']);

		// Plugins ------------------------------------------
        JPluginHelper::importPlugin('pcv');
        //$this->t['dispatcher']	= J
EventDispatcher::getInstance();
        $this->t['event']                      = new
stdClass;
        $results                               =
\JFactory::getApplication()->triggerEvent('PCVonItemsBeforeHeader',
array('com_phocacart.items', &$this->items,
&$this->p));
        $this->t['event']->onItemsBeforeHeader =
trim(implode("\n", $results));
        // Foreach values are rendered in default foreaches

        // Layout plugins - completely new layout including foreach
        $this->t['pluginlayout']        = false;
        if ($this->t['items_layout_plugin'] != '')
{
            $this->t['items_layout_plugin']     =
PhocacartText::filterValue($this->t['items_layout_plugin'],
'alphanumeric2');
            $this->t['pluginlayout'] 	        =
JPluginHelper::importPlugin('pcl',
$this->t['items_layout_plugin']);
        }
		if ($this->t['pluginlayout']) {
            $this->t['show_switch_layout_type'] = 0;
        }
        // END Plugins --------------------------------------

		parent::display($tpl);

	}
}
?>
views/order/index.html000064400000000054151167552070011021
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/order/metadata.xml000064400000000325151167552070011327
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<!--<view title="COM_PHOCACART_ORDER_GROUP">
		<message><![CDATA[COM_PHOCACART_ORDER_GROUP_DESC]]></message>
	</view>-->
	<view hidden="true" />
</metadata>views/order/tmpl/default.php000064400000000540151167552070012135
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
?>views/order/tmpl/default.xml000064400000000720151167552070012146
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_PHOCACART_ORDER_LAYOUT">
		<message>
			<![CDATA[COM_PHOCACART_ORDER_LAYOUT_DESC]]>
		</message>
	</layout>
	
		<name>COM_PHOCACART_ORDER_LAYOUT</name>
		<description>COM_PHOCACART_ORDER_LAYOUT_DESC</description>
		
		<fields name="params">
<fieldset name="basic"
addfieldpath="/administrator/components/com_phocacart/models/fields"
>

			
		</fieldset>
</fields>

</metadata>views/order/tmpl/index.html000064400000000054151167552070011775
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/order/view.html.php000064400000002632151167552070011456
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');

class PhocaCartViewOrder extends JViewLegacy
{
	protected $t;
	protected $r;
	protected $p;
	protected $u;
	protected $s;
	public function display($tpl = null) {

		$app				= JFactory::getApplication();
		$this->p 			= $app->getParams();
		$this->s            = PhocacartRenderStyle::getStyles();
		$id					= $app->input->get('id', 0, 'int');
		$type				= $app->input->get('type', 0, 'int');
		$format				= $app->input->get('format', '',
'string');
		$token				= $app->input->get('o', '',
'string');
		$pos				= $app->input->get('pos', '',
'0');

		$orderGuestAccess	= $this->p->get( 'order_guest_access',
0 );

		if ($orderGuestAccess == 0) {
			$token = '';
		}
		$order	= new PhocacartOrderRender();
		$o = $order->render($id, $type, $format, $token, $pos);

		$media = PhocacartRenderMedia::getInstance('main');

		echo $o;

	}

	protected function _prepareDocument() {
		PhocacartRenderFront::prepareDocument($this->document, $this->p,
false, false, JText::_('COM_PHOCACART_ORDER'));
	}
}
?>
views/order/view.pdf.php000064400000004102151167552070011255
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');

class PhocaCartViewOrder extends JViewLegacy
{
	protected $t;
	protected $r;
	protected $p;
	protected $u;
	protected $s;
	public function display($tpl = null) {

		$app				= JFactory::getApplication();
		$this->p 			= $app->getParams();
		$this->s            = PhocacartRenderStyle::getStyles();
		$id					= $app->input->get('id', 0, 'int');
		$type				= $app->input->get('type', 0, 'int');
		$format				= $app->input->get('format', '',
'string');
		$token				= $app->input->get('o', '',
'string');
		$pos				= $app->input->get('pos', '',
'0');

		$orderBillingData	= PhocacartOrder::getOrderBillingData($id);


		//$invoice_prefix		= $this->p->get( 'invoice_prefix',
'');
		$orderGuestAccess	= $this->p->get( 'order_guest_access',
0 );

		if ($orderGuestAccess == 0) {
			$token = '';
		}
		$order	= new PhocacartOrderRender();
		$o = $order->render($id, $type, $format, $token, $pos);

		//$media = PhocacartRenderMedia::getInstance('main');

		switch($type) {
			case 2:
				$invoiceNumber	= PhocacartOrder::getInvoiceNumber($id,
$orderBillingData['date'],
$orderBillingData['invoice_number']);
				$title			= JText::_('COM_PHOCACART_INVOICE_NR'). ':
'. $invoiceNumber;
			break;
			case 1:
			case 3:
			default:
				$orderNumber	= PhocacartOrder::getOrderNumber($id,
$orderBillingData['date'],
$orderBillingData['order_number']);
				$title			= JText::_('COM_PHOCACART_ORDER_NR'). ':
'. $orderNumber;
			break;
		}

		$this->document->setTitle($title);

		echo $o;
		
		// PDF document name
		$this->document->setName($title);

	}

	protected function _prepareDocument() {
		PhocacartRenderFront::prepareDocument($this->document, $this->p);
	}
}
?>
views/order/view.raw.php000064400000004605151167552070011305
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');

class PhocaCartViewOrder extends JViewLegacy
{
	protected $t;
	protected $r;
	protected $p;
	protected $u;
	protected $s;

	public function display($tpl = null) {

		$app				= JFactory::getApplication();
		$this->p 			= $app->getParams();
		$this->s            = PhocacartRenderStyle::getStyles();
		$id					= $app->input->get('id', 0, 'int');
		$type				= $app->input->get('type', 0, 'int');
		$format				= $app->input->get('format', '',
'string');
		$token				= $app->input->get('o', '',
'string');
		$pos				= $app->input->get('pos', '',
'0');
		$print_server		= $app->input->get('printserver',
'', '0');

		$orderGuestAccess	= $this->p->get( 'order_guest_access',
0 );
		$pos_server_print	= $this->p->get( 'pos_server_print', 0
);

		if ($orderGuestAccess == 0) {
			$token = '';
		}


		$order	= new PhocacartOrderRender();
		$o = $order->render($id, $type, $format, $token, $pos);




		if ($pos == 1 && $type == 4) {

			// PRINT SERVER PRINT
			if ($print_server == 1 && ($pos_server_print == 2 ||
$pos_server_print == 3)) {

				try{

					$printPos = new PhocacartPosPrint(1);
					$printPos->printOrder($o);
					echo '<div class="ph-result-txt
ph-success-txt">'.JText::_('COM_PHOCACART_RECEIPT_SENT_TO_PRINTER').
'</div>';
				} catch(Exception $e) {
					echo '<div class="ph-result-txt
ph-error-txt">'.JText::_('COM_PHOCACART_ERROR').
": ". $e->getMessage(). '</div>';
				}
			} else {
				// RECEIPT IN HTML
				$o = str_replace("\n", '', $o); // produce html
output in PRE and CODE tag without new rows ("\n");
				echo '<div
class="phPrintInBox">'.$o.'</div>'; //
-->
components\com_phocacart\views\pos\tmpl\default_main_content_order.php
			}

		} else {
			echo '<div
class="phPrintInBox">'.$o.'</div>'; //
-->
components\com_phocacart\views\pos\tmpl\default_main_content_order.php
		}
	}

	protected function _prepareDocument() {
		PhocacartRenderFront::prepareDocument($this->document, $this->p,
false, false, JText::_('COM_PHOCACART_ORDER'));
	}
}
?>
views/orders/index.html000064400000000054151167552070011204
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/orders/metadata.xml000064400000000267151167552070011517
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view title="COM_PHOCACART_ORDERS_GROUP">
		<message><![CDATA[COM_PHOCACART_ORDERS_GROUP_DESC]]></message>
	</view>
</metadata>views/orders/tmpl/default.php000064400000027477151167552070012342
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

echo '<div id="ph-pc-orders-box"
class="pc-orders-view'.$this->p->get(
'pageclass_sfx' ).'">';

echo
PhocacartRenderFront::renderHeader(array(JText::_('COM_PHOCACART_ORDERS')));

/*if ( $this->t['description'] != '') {
	echo '<div class="ph-desc">'.
$this->t['description']. '</div>';
}*/

if ((int)$this->u->id > 0 || $this->t['token'] !=
'') {

	echo '<div
class="'.$this->s['c']['row'].'
ph-orders-header-box-row" >';

	echo '<div
class="'.$this->s['c']['col.xs12.sm2.md2'].'">'.JText::_('COM_PHOCACART_ORDER_NUMBER').'</div>';
	echo '<div
class="'.$this->s['c']['col.xs12.sm2.md2'].'">'.JText::_('COM_PHOCACART_STATUS').'</div>';
	echo '<div
class="'.$this->s['c']['col.xs12.sm3.md3'].'">'.JText::_('COM_PHOCACART_DATE_ADDED').'</div>';
	echo '<div
class="'.$this->s['c']['col.xs12.sm2.md2'].'
ph-right">'.JText::_('COM_PHOCACART_TOTAL').'</div>';
	echo '<div
class="'.$this->s['c']['col.xs12.sm3.md3'].'
ph-center">'.JText::_('COM_PHOCACART_ACTION').'</div>';

	echo '<div class="ph-cb"></div>';
	echo '</div>';
	if (!empty($this->t['orders'])) {

		$price			= new PhocacartPrice();
		foreach($this->t['orders'] as $k => $v) {
			echo '<div
class="'.$this->s['c']['row'].' 
ph-orders-item-box-row" >';

			echo '<div
class="'.$this->s['c']['col.xs12.sm2.md2'].'">'.PhocacartOrder::getOrderNumber($v->id,
$v->date, $v->order_number).'</div>';
			$statusClass =
PhocacartUtilsSettings::getOrderStatusClass($v->status_title);



			$status = '<span
class="'.$statusClass.'">'.JText::_($v->status_title).'</span>';
			echo '<div
class="'.$this->s['c']['col.xs12.sm2.md2'].'">'.$status.'</div>';

			echo '<div
class="'.$this->s['c']['col.xs12.sm3.md3'].'">'.PhocacartUtils::date($v->date).'</div>';

			$price->setCurrency($v->currency_id);
			$total = $price->getPriceFormat($v->total_amount);
			echo '<div
class="'.$this->s['c']['col.xs12.sm2.md2'].'
ph-right">'.$total.'</div>';

			echo '<div
class="'.$this->s['c']['col.xs12.sm3.md3'].'
ph-center">';

			$token = '';
			if ($this->t['token'] != '') {
				$token = '&o='.$this->t['token'];
			}
			$linkOrderView 		= JRoute::_(
'index.php?option=com_phocacart&view=order&tmpl=component&id='.(int)$v->id.'&type=1'.$token
);
			$linkInvoiceView 	= JRoute::_(
'index.php?option=com_phocacart&view=order&tmpl=component&id='.(int)$v->id.'&type=2'.$token
);
			$linkDelNoteView 	= JRoute::_(
'index.php?option=com_phocacart&view=order&tmpl=component&id='.(int)$v->id.'&type=3'.$token
);

	
			$displayDocument = json_decode($v->ordersviewdisplay, true);
			if (!is_array($displayDocument)) {$displayDocument = array();}
		
			$view = '';


			$linkOrderViewHandler= 'onclick="phWindowPopup(this.href,
\'orderview\', 2, 1.3);return false;"';

			if (in_array(1, $displayDocument)) {
				$view .= '<a href="' . $linkOrderView . '"
class="' .
$this->s['c']['btn.btn-success.btn-sm'] . '
ph-btn ph-orders-btn" role="button" ' .
$linkOrderViewHandler . '><span title="' .
JText::_('COM_PHOCACART_VIEW_ORDER') . '"
class="' . $this->s['i']['order'] . '
ph-icon-order"></span></a>';
			}

			if (in_array(2, $displayDocument) && $v->invoice_number !=
'') {
				$view .= ' <a href="' . $linkInvoiceView .
'" class="' .
$this->s['c']['btn.btn-danger.btn-sm'] . '
ph-btn ph-orders-btn" role="button" ' .
$linkOrderViewHandler . '><span title="' .
JText::_('COM_PHOCACART_VIEW_INVOICE') . '"
class="' . $this->s['i']['invoice'] .
' ph-icon-invoice"></span></a>';
			}

			if (in_array(3, $displayDocument)) {
				$view .= ' <a href="' . $linkDelNoteView .
'" class="' .
$this->s['c']['btn.btn-warning.btn-sm'] . '
ph-btn ph-orders-btn" role="button" ' .
$linkOrderViewHandler . '><span title="' .
JText::_('COM_PHOCACART_VIEW_DELIVERY_NOTE') . '"
class="' . $this->s['i']['del-note'] .
' ph-icon-del-note"></span></a>';
			}
			if ($this->t['plugin-pdf'] == 1 &&
$this->t['component-pdf']) {

				$formatPDF = '&format=pdf';
				$view .= '<br />';

				if (in_array(1, $displayDocument)) {
					$view .= '<a href="' . $linkOrderView . $formatPDF .
'" class="' .
$this->s['c']['btn.btn-success.btn-sm'] . '
ph-btn ph-orders-btn" role="button" ' .
$linkOrderViewHandler . '><span title="' .
JText::_('COM_PHOCACART_VIEW_ORDER') . '"
class="' . $this->s['i']['order'] . '
ph-icon-order"></span><br /><span
class="ph-icon-pdf-text">' .
JText::_('COM_PHOCACART_PDF') .
'</span></a>';
				}

				if (in_array(2, $displayDocument) && $v->invoice_number !=
'') {
					$view .= ' <a href="' . $linkInvoiceView .
$formatPDF . '" class="' .
$this->s['c']['btn.btn-danger.btn-sm'] . '
ph-btn ph-orders-btn" role="button" ' .
$linkOrderViewHandler . '><span title="' .
JText::_('COM_PHOCACART_VIEW_INVOICE') . '"
class="' . $this->s['i']['invoice'] .
' ph-icon-invoice"></span><br /><span
class="ph-icon-pdf-text">' .
JText::_('COM_PHOCACART_PDF') .
'</span></a>';
				}

				if (in_array(3, $displayDocument)) {
					$view .= ' <a href="' . $linkDelNoteView .
$formatPDF . '" class="' .
$this->s['c']['btn.btn-warning.btn-sm'] . '
ph-btn ph-orders-btn" role="button" ' .
$linkOrderViewHandler . '><span title="' .
JText::_('COM_PHOCACART_VIEW_DELIVERY_NOTE') . '"
class="' . $this->s['i']['del-note'] .
' ph-icon-del-note"></span><br /><span
class="ph-icon-pdf-text">' .
JText::_('COM_PHOCACART_PDF') .
'</span></a>';
				}

				//$view .= '<div
class="ph-icon-pdf-text-box"><span
class="ph-icon-pdf-text">'.JText::_('COM_PHOCACART_PDF').'</span><span
class="ph-icon-pdf-text">'.JText::_('COM_PHOCACART_PDF').'</span><span
class="ph-icon-pdf-text">'.JText::_('COM_PHOCACART_PDF').'</span></div>';

			/*	$view .= '<a
href="'.$linkOrderView.$formatPDF.'" class="btn
btn-transparent btn-small btn-xs ph-btn" role="button"
'.$linkOrderViewHandler.'><span
title="'.JText::_('COM_PHOCACART_VIEW_ORDER').'"
class="'.$this->s['i']['order'].'
icon-search ph-icon-success"></span><br /><span
class="ph-icon-success-txt">PDF</span></a>';
				$view .= ' <a
href="'.$linkInvoiceView.$formatPDF.'" class="btn
btn-transparent btn-small btn-xs ph-btn" role="button"
'.$linkOrderViewHandler.'><span
title="'.JText::_('COM_PHOCACART_VIEW_INVOICE').'"
class="'.$this->s['i']['invoice'].'
icon-ph-invoice ph-icon-danger"></span><br /><span
class="ph-icon-danger-txt">PDF</span></a>';
				$view .= ' <a
href="'.$linkDelNoteView.$formatPDF.'" class="btn
btn-transparent btn-small btn-xs ph-btn" role="button"
'.$linkOrderViewHandler.'><span
title="'.JText::_('COM_PHOCACART_VIEW_DELIVERY_NOTE').'"
class="'.$this->s['i']['del-note'].'
icon-ph-del-note ph-icon-warning"></span><br /><span
class="ph-icon-warning-txt">PDF</span></a>';*/

			}

			echo $view;

			echo '</div>';

			if ($this->t['display_reward_points_user_orders'] == 1) {
				echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'">';
				$points = PhocacartReward::getRewardPointsByOrderId($v->id);
				if (!empty($points)) {
					foreach ($points as $k => $v) {
						$approvedClass = 'approved';
						if ($v->published == 0) {
							$approvedClass = 'not-approved';
						}

						if ($v->type == 1) {

							if ($v->published == 0) {
								echo '<div>' .
JText::_('COM_PHOCACART_USER_POINTS_TO_RECEIVE') . '
<span
class="'.$this->s['c']['label.label-success'].'
' . $approvedClass . '">' . $v->points .
'</span> <small>(' .
JText::_('COM_PHOCACART_USER_NOT_APPROVED_YET') .
')</small></div>';
							} else {
								echo '<div>' .
JText::_('COM_PHOCACART_USER_POINTS_RECEIVED') . ' <span
class="'.$this->s['c']['label.label-success'].'
' . $approvedClass . '">' . $v->points .
'</span></div>';
							}
						} else if ($v->type == -1) {
							echo '<div>' .
JText::_('COM_PHOCACART_USER_POINTS_USED') . ' <span
class="'.$this->s['c']['label.label-danger'].'
' . $approvedClass . '">' . $v->points .
'</span></div>';
						} else {
							//echo '<div><span
class="label">'.$v->points.'</span></div>';
						}
					}

				}
				echo '</div>';
			}


			echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'">';

			$r 							= array();
			$r['trackinglink'] 			=
PhocacartOrderView::getTrackingLink($v);
			$r['trackingdescription'] 	=
PhocacartOrderView::getTrackingDescription($v);
			$r['shippingtitle'] 		=
PhocacartOrderView::getShippingTitle($v);
			$r['dateshipped'] 			=
PhocacartOrderView::getDateShipped($v);



			if($r['shippingtitle'] != '' ||
$r['trackinglink'] != '') {
				echo '<div class="ph-shipping-info-box">';
				echo '<div
class="ph-shipping-info-header">'.JText::_('COM_PHOCACART_SHIPPING_INFORMATION').'</div>';
				if ($r['shippingtitle'] != '') {
					echo '<div
class="ph-shipping-title">'.$r['shippingtitle'].'</div>';
				}
				if ($r['trackingdescription'] != '') {
					echo '<div
class="ph-tracking-desc">'.$r['trackingdescription'].'</div>';
				}
				if ($r['trackinglink'] != '') {
					echo '<div
class="ph-tracking-link">'.JText::_('COM_PHOCACART_SHIPPING_TRACKING_LINK').
': '.$r['trackinglink'].'</div>';
				}
				if ($r['dateshipped'] != '') {
					echo '<div
class="ph-date-shipped">'.JText::_('COM_PHOCACART_DATE_SHIPPED').
': '.$r['dateshipped'].'</div>';
				}
				echo '</div>';
			}
			echo '</div>';

			echo '<div class="ph-cb"></div>';
			echo '</div>';

		}
	} else {
		echo '<div class="alert alert-error
alert-danger">'.
JText::_('COM_PHOCACART_NO_ORDERS_ACCOUNT').
'</div>';
	}

} else {
	echo '<div class="alert alert-error
alert-danger">'.
JText::_('COM_PHOCACART_NOT_LOGGED_IN_PLEASE_LOGIN').
'</div>';
}

/*
if (!empty($this->t['categories'])) {
	echo '<div class="ph-categories">';
	$i = 0;
	$c = count($this->t['categories']);
	$nc= (int)$this->t['columns_cats'];
	$nw= 12/$nc;//1,2,3,4,6,12
	echo '<div class="row">';
	foreach ($this->t['categories'] as $v) {

		//if ($i%$nc==0) { echo '<div class="row">';}

		echo '<div class="col-sm-6
col-md-'.$nw.'">';
		echo '<div class="b-thumbnail ph-thumbnail
ph-thumbnail-c">';

		$image 	= PhocacartImage::getThumbnailName($this->t['path'],
$v->image, 'medium');
		$link	= JRoute::_(PhocacartRoute::getCategoryRoute($v->id,
$v->alias));

		if (isset($image->rel) && $image->rel != '') {
			echo '<a href="'.$link.'">';
			echo '<img class="img-responsive ph-image"
src="'.JURI::base(true).'/'.$image->rel.'"
alt=""';
			if (isset($this->t['image_width_cats']) &&
$this->t['image_width_cats'] != '' &&
isset($this->t['image_height_cats']) &&
$this->t['image_height_cats'] != '') {
				echo '
style="width:'.$this->t['image_width_cats'].';height:'.$this->t['image_height_cats'].'"';
			}
			echo ' />';
			echo '</a>';
		}
		echo '<div class="caption">';
		echo '<h3>'.$v->title.'</h3>';

		if (!empty($v->subcategories) &&
(int)$this->t['display_subcat_cats_view'] > 0) {
			echo '<ul>';
			$j = 0;
			foreach($v->subcategories as $v2) {
				if ($j == (int)$this->t['display_subcat_cats_view']) {
					break;
				}
				echo '<li><a
href="'.$link.'">'.$v2->title.'</a></li>';
				$j++;
			}
			echo '</ul>';
		}

		// Description box will be displayed even no description is set - to set
height and have all columns same height
		echo '<div class="ph-cat-desc">';
		if ($v->description != '') {
			echo $v->description;
		}
		echo '</div>';

		echo '<p class="ph-pull-right"><a
href="'.JRoute::_(PhocacartRoute::getCategoryRoute($v->id,
$v->alias)).'" class="btn btn-primary"
role="button">'.JText::_('COM_PHOCACART_VIEW_CATEGORY').'</a></p>';
		echo '<div class="clearfix"></div>';
		echo '</div>';
		echo '</div>';
		echo '</div>'. "\n";

		$i++;
		// if ($i%$nc==0 || $c==$i) { echo '</div>';}
	}
	echo '</div></div>'. "\n";
}*/
echo '</div>';
echo '<div>&nbsp;</div>';
echo PhocacartUtilsInfo::getInfo();
?>
views/orders/tmpl/default.xml000064400000000724151167552070012335
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_PHOCACART_ORDERS_LAYOUT">
		<message>
			<![CDATA[COM_PHOCACART_ORDERS_LAYOUT_DESC]]>
		</message>
	</layout>
	
		<name>COM_PHOCACART_ORDERS_LAYOUT</name>
		<description>COM_PHOCACART_ORDERS_LAYOUT_DESC</description>
		
		<fields name="params">
<fieldset name="basic"
addfieldpath="/administrator/components/com_phocacart/models/fields"
>

			
		</fieldset>
</fields>

</metadata>views/orders/tmpl/index.html000064400000000054151167552070012160
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/orders/view.html.php000064400000005276151167552070011650
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');

class PhocaCartViewOrders extends JViewLegacy
{
	protected $t;
	protected $r;
	protected $p;
	protected $u;
	protected $s;

	function display($tpl = null)
	{
		$app								= JFactory::getApplication();
		$this->u							= PhocacartUser::getUser();
		//$document							= JFactory::getDocument();
		$this->s							= PhocacartRenderStyle::getStyles();
		$this->p 							= $app->getParams();
		$model								= $this->getModel();
		$this->t['orders']					= $model->getOrderList();

		$this->t['token']					            =
$app->input->get('o', '', 'string');
		$this->t['order_guest_access']		            =
$this->p->get( 'order_guest_access', 0 );
        $this->t['display_reward_points_user_orders']	=
$this->p->get( 'display_reward_points_user_orders', 0);
		if ($this->t['order_guest_access'] == 0) {
			$this->t['token'] = '';
		}

		/*$app								= JFactory::getApplication();
		$document							= JFactory::getDocument();
		$this->p 							= $app->getParams();
		$this->t['categories']				= $model->getCategoriesList();
		$this->t['cart_metakey'] 			= $this->p->get(
'cart_metakey', '' );
		$this->t['cart_metadesc'] 			= $this->p->get(
'cart_metadesc', '' );
		$this->t['description']				= $this->p->get(
'description', '' );
		$this->t['load_bootstrap']			= $this->p->get(
'load_bootstrap', 0 );
		$this->t['equal_height']			= $this->p->get(
'equal_height', 1 );
		$this->t['columns_cats']			= $this->p->get(
'columns_cats', 3 );
		$this->t['image_width_cats']		= $this->p->get(
'image_width_cats', '' );
		$this->t['image_height_cats']		= $this->p->get(
'image_height_cats', '' );
		$this->t['display_subcat_cats_view']= $this->p->get(
'display_subcat_cats_view', 3 );
		*/

		$this->t['plugin-pdf']		=
PhocacartUtilsExtension::getExtensionInfo('phocacart',
'plugin', 'phocapdf');
		$this->t['component-pdf']	=
PhocacartUtilsExtension::getExtensionInfo('com_phocapdf');

		$media = PhocacartRenderMedia::getInstance('main');
		$media->loadBase();
		$media->loadWindowPopup();
		$media->loadSpec();

		//$this->t['path'] =
PhocacartPath::getPath('categoryimage');
		$this->_prepareDocument();
		parent::display($tpl);

	}

	protected function _prepareDocument() {
		PhocacartRenderFront::prepareDocument($this->document, $this->p,
false, false, JText::_('COM_PHOCACART_ORDERS'));
	}

}
?>
views/payment/index.html000064400000000054151167552070011363
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/payment/metadata.xml000064400000000331151167552070011666
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<!--<view title="COM_PHOCACART_PAYMENT_GROUP">
		<message><![CDATA[COM_PHOCACART_PAYMENT_GROUP_DESC]]></message>
	</view>-->
	<view hidden="true" />
</metadata>views/payment/tmpl/default.php000064400000001231151167552070012475
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
echo '<div id="ph-pc-payment-box"
class="pc-payment-view'.$this->p->get(
'pageclass_sfx' ).'">';

echo
PhocacartRenderFront::renderHeader(array(JText::_('COM_PHOCACART_PAYMENT')));

echo $this->t['o'];

echo '</div>';// end ph-pc-payment-box
echo '<div>&nbsp;</div>';
echo PhocacartUtilsInfo::getInfo();
?>views/payment/tmpl/default.xml000064400000000737151167552070012520
0ustar00<?xml version="1.0" encoding="utf-8"?>
<!--<metadata>
	<layout title="COM_PHOCACART_PAYMENT_LAYOUT">
		<message>
			<![CDATA[COM_PHOCACART_PAYMENT_LAYOUT_DESC]]>
		</message>
	</layout>
	
		<name>COM_PHOCACART_PAYMENT_LAYOUT</name>
		<description>COM_PHOCACART_PAYMENT_LAYOUT_DESC</description>
		
		<fields name="params">
<fieldset name="basic"
addfieldpath="/administrator/components/com_phocacart/models/fields"
>

			
		</fieldset>
</fields>

</metadata>-->views/payment/tmpl/index.html000064400000000054151167552070012337
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/payment/view.html.php000064400000005116151167552070012020
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');
class PhocaCartViewPayment extends JViewLegacy
{
	protected $t;
	protected $r;
	protected $p;
	protected $u;

	function display($tpl = null) {


		$document					= JFactory::getDocument();
		$app						= JFactory::getApplication();
		$uri 						= \Joomla\CMS\Uri\Uri::getInstance();
		$this->u					= PhocacartUser::getUser();
		$this->p					= $app->getParams();

		$session 					= JFactory::getSession();
		$this->t['proceedpayment'] 	=
$session->get('proceedpayment', array(),
'phocaCart');

		$order 			= new PhocacartOrderView();
		$payment		= new PhocacartPayment();

		$id				= 0;
		if (isset($this->t['proceedpayment']['orderid']))
{
			$id	=
(int)$this->t['proceedpayment']['orderid'];
		}

		if ($id > 0) {

			$o['common']	= $order->getItemCommon($id);
			$o['bas']		= $order->getItemBaS($id, 1);
			$o['products'] 	= $order->getItemProducts($id);
			$o['total'] 	= $order->getItemTotal($id);

			if (isset($o['common']->payment_id) &&
(int)$o['common']->payment_id > 0) {
				$paymentO =
$payment->getPaymentMethod((int)$o['common']->payment_id
);

				if (isset($paymentO->method)) {
					//$dispatcher = J EventDispatcher::getInstance();
					JPluginHelper::importPlugin('pcp',
htmlspecialchars(strip_tags($paymentO->method)));
					$eventData 					= array();
					$proceed 					= '';
					$eventData['pluginname'] 	=
htmlspecialchars(strip_tags($paymentO->method));
					\JFactory::getApplication()->triggerEvent('PCPbeforeSetPaymentForm',
array(&$proceed, $this->p, $paymentO->params, $o, $eventData));


				}
			}

			//$session->set('proceedpayment', array(),
'phocaCart');
			$this->t['o'] = $proceed;
		} else {
			// No order set, no payment - this should not happen but if, then just
repeat thank you
			//$this->t['o'] = 
'<div>'.JText::_('COM_PHOCACART_ORDER_SUCCESSFULLY_PROCESSED').'</div>';
			$this->t['o'] = '';
		}

		$media = PhocacartRenderMedia::getInstance('main');
		$media->loadBase();
        $media->loadSpec();
		$this->_prepareDocument();
		parent::display($tpl);
	}

	protected function _prepareDocument() {
		PhocacartRenderFront::prepareDocument($this->document, $this->p,
false, false, JText::_('COM_PHOCACART_PAYMENT'));
	}
}
?>
views/pos/index.html000064400000000054151167552070010507
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/pos/metadata.xml000064400000000261151167552070011014
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view title="COM_PHOCACART_POS_GROUP">
		<message><![CDATA[COM_PHOCACART_POS_GROUP_DESC]]></message>
	</view>
</metadata>views/pos/tmpl/default.php000064400000006310151167552070011624
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

echo '<div id="ph-pc-pos-site">';


// POPUP
// jQuery UI
//echo '<div id="phDialogConfirm"
class="ph-dialog" title="'.
JText::_('COM_PHOCACART_CONFIRM').'"></div>';


// Bootstrap Modal
echo '<div id="phDialogConfirm" class="modal
fade" tabindex="-1" role="dialog">';
echo '<div class="modal-dialog"
role="document">';
echo '<div class="modal-content">';
echo '<div class="modal-header">';
echo '<button type="button" class="close"
data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span></button>';
echo '<h4 class="modal-title">'.
JText::_('COM_PHOCACART_CONFIRM').'</h4>';
echo '</div>';
echo '<div class="modal-body"></div>';
echo '<div class="modal-footer">';
echo '<button type="button" class="btn
btn-default" data-dismiss="modal">'.
JText::_('COM_PHOCACART_CANCEL').'</button>';
echo '<button id="phDialogConfirmSave"
type="button" class="btn btn-success">'.
JText::_('COM_PHOCACART_OK').'</button>';
echo '</div>';
echo '</div>';
echo '</div>';
echo '</div>';


// TOP
echo '<div class="ph-pos-wrap-top">';
echo $this->loadTemplate('main_top');
echo '</div>';


// MAIN
echo '<div class="ph-pos-wrap-main">';


// MAIN LEFT
echo '<div class="ph-pos-main-column-left">';


// MAIN FILTER
echo '<div class="ph-pos-main-filter">';
echo $this->loadTemplate('main_filter');
echo '</div>';


// MAIN CATEGORIES
echo '<div class="ph-pos-main-categories">';
echo '<div id="phPosCategoriesBox">';
echo $this->loadTemplate('main_categories');
echo '</div>';
echo '</div>';


// MAIN CONTENT
echo '<div class="ph-pos-main-content">';

// HEADER - NOT AJAX
echo '<div id="ph-pc-pos-box"
class="pc-pos-view'.$this->p->get(
'pageclass_sfx' ).'">';
echo '<div id="phPosContentBox">';
echo $this->loadTemplate('main_content_products');// divided
into more different views - as default main will display products

// FOOTER - NOT AJAX
echo '</div>';// end #phItemsBox
echo '</div>';// end #ph-pc-category-box

echo '<div id="phContainer"></div>';
echo '<div>&nbsp;</div>';


echo '</div>';// end ph-pos-main-content

echo '</div>';// end ph-pos-column-left


// MAIN RIGHT
echo '<div class="ph-pos-main-column-right">';


// MAIN CART
echo '<div class="ph-pos-main-cart"
id="phPosCart">';
echo '<div class="phPosCartBox"
id="phPosCartBox">';
echo $this->loadTemplate('main_cart');
echo '</div>';
echo '</div>';


// MAIN INPUT
echo '<div class="ph-pos-main-input">';
echo '<div id="phPosInputBox">';
echo $this->loadTemplate('main_input');
echo '</div>';
echo '</div>';


echo '</div>';// end ph-pos-column-right

echo '</div>';// end ph-pos-wrap-main


// BOTTOM
echo '<div class="ph-pos-wrap-bottom">';
echo $this->loadTemplate('bottom');
echo '</div>';


echo '</div>';// end ph-pc-pos-site

echo '<div class="ph-pos-warning-msg-box"
id="phPosWarningMsgBox"
style="display:none"></div>';
?>
views/pos/tmpl/default.xml000064400000001141151167552070011632
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_PHOCACART_POS_LAYOUT">
		<message>
			<![CDATA[COM_PHOCACART_POS_LAYOUT_DESC]]>
		</message>
	</layout>
		<name>COM_PHOCACART_POS_LAYOUT</name>
		<description>COM_PHOCACART_POS_LAYOUT_DESC</description>
		<fields name="request">
		<fieldset name="request"
addfieldpath="/administrator/components/com_phocacart/models/fields">

			
		</fieldset>
	</fields>
	
	<fields name="params">
<fieldset name="basic"
addfieldpath="/administrator/components/com_phocacart/models/fields"
>

			

		</fieldset>
</fields>
</metadata>views/pos/tmpl/default_bottom.php000064400000000633151167552070013212
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

echo
'<div>'.PhocacartUtilsInfo::getInfo(2).'</div>';

?>views/pos/tmpl/default_currency.php000064400000003441151167552070013540
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die;


$currList 	= array();
$currList[] = '<div
class="ph-currency-list-box">';
if (!empty($this->t['currency_array'])) {
	foreach($this->t['currency_array'] as $k => $v) {
		$image = '';

		if (isset($v->image) && $v->image != '') {
			$image = '<img class="ph-currency-image-list"
src="'.JURI::base(true). '/' .
$v->image.'" alt="'.$v->code.'"
/>';
		}

		if ($v->active == 1) {
			//$item .= ' <span
class="ph-currency-list-suffix">('.$image .' '
. $v->code.')</span>';
			//$item .= ' <span
class="ph-currency-list-suffix">'.$image .' ' .
$v->code.'</span>';
		}

		$currList[] = '<a href="javascript:void(0);"
onclick="jQuery(\'<input>\').attr({type:
\'hidden\', id: \'id\', name: \'id\', value:
\''.(int)$v->id.'\'}).appendTo(\'#phPosCurrencyBoxForm\');jQuery(\'#phPosCurrencyBoxForm\').submit()"
class="btn btn-info ph-btn-dropdown-currency"><span
class="ph-currency-list">'.$image .'</span>
'. $v->text.'</a>';

	}
}
$currList[] = '</div>';

echo '<div>';
echo implode('', $currList);
echo '<form
action="'.$this->t['linkcheckout'].'"
method="post" id="phPosCurrencyBoxForm">';
echo '<input type="hidden" name="task"
value="checkout.currency">';
echo '<input type="hidden" name="tmpl"
value="component" />';
echo '<input type="hidden" name="option"
value="com_phocacart" />';
echo '<input type="hidden" name="return"
value="'.$this->t['actionbase64'].'"
/>';
echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
echo '</form>';
echo '</div>';
views/pos/tmpl/default_info.php000064400000001577151167552070012651
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

echo '<div id="ph-pc-pos-site">';

// TOP
echo '<div class="ph-pos-wrap-top">';
echo $this->loadTemplate('vendor');
echo $this->loadTemplate('logo');
echo '</div>';

echo '<div class="ph-pos-wrap-main">';
echo '<div class="ph-pos-main-page">';

echo '<div class="alert
'.$this->t['infotype'].'">' .
$this->t['infotext'] . '</div>';

echo '</div>';// end ph-pos-main-page
echo '</div>';// end ph-pos-wrap-main
	
echo '<div class="ph-pos-wrap-bottom">';
echo $this->loadTemplate('bottom');
echo '</div>';
	
echo '</div>';
?>views/pos/tmpl/default_logo.php000064400000001051151167552070012641
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

echo '<div class="ph-pos-logo">';
echo '<img
class="'.$this->s['c']['img-responsive'].'
ph-image"
src="'.JURI::base(true).'/media/com_phocacart/images/phoca-pos.png"
alt=""  />';
echo '</div>';
?>
views/pos/tmpl/default_main_cart.php000064400000000727151167552070013647
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

// Displayed only for standard request, not for AJAX (ajax is created in
controller)
echo $this->cart->render();

?>views/pos/tmpl/default_main_categories.php000064400000003537151167552070015045
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

if (!empty($this->t['categories'])) {


	// this function is triggered in phocapos.js
	echo '<form
class="'.$this->s['c']['form-inline'].'
ph-pos-checkbox-form"
action="'.$this->t['linkpos'].'"
id="phPosCategory" method="post">';
	echo '<div class="ph-pos-checkbox-box btn-group-toggle"
data-toggle="buttons"  >';//
data-toggle="buttons" - changes the standard checkbox to
graphical checkbox


	foreach ($this->t['categories'] as $k => $v) {
		$active	= '';
		$attrO	= '';
		if (in_array((int)$v->id, $this->t['categoryarray'])) {
			$active	= ' active';
			$attrO	= ' checked="checked"';
		}

		echo '<label
class="'.$this->s['c']['btn'].'
phCheckBoxButton phCheckBoxCategory '.$active.'"
><input type="checkbox" '.$attrO.'
class="phPosCategoryCheckbox"
name="c['.$v->id.']"
value="'.$v->id.'" autocomplete="off" 
/><span
class="'.$this->s['i']['ok'].'"
title="'.htmlspecialchars($v->title).''.'"></span>
'.htmlspecialchars($v->title).'</label> ';

	}

	echo '<input type="hidden" name="type"
value="products">';
	echo '<input type="hidden" name="tmpl"
value="component" />';
	echo '<input type="hidden" name="option"
value="com_phocacart" />';
	echo '<input type="hidden" name="ticketid"
value="'.(int)$this->t['ticket']->id.'"
/>';
	echo '<input type="hidden" name="unitid"
value="'.(int)$this->t['unit']->id.'"
/>';
	echo '<input type="hidden" name="section"
value="'.(int)$this->t['section']->id.'"
/>';
	echo Joomla\CMS\HTML\HTMLHelper::_('form.token');

	echo '</div>';
	echo '</form>';

}

?>
views/pos/tmpl/default_main_content_customers.php000064400000011702151167552070016467
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

echo '<div
class="ph-box-header">'.JText::_('COM_PHOCACART_CUSTOMERS').'</div>';

if (!empty($this->items)) {

	foreach ($this->items as $v) {
		echo '<div
class="'.$this->s['c']['row'].'
ph-pos-customer-row">';

		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm6.md6'].'">';
		echo '<div
class="ph-pos-customer-name">'.$v->name.'</div>';
		echo '</div>';

		echo '<div
class="'.$this->s['c']['row-item'].'
ph-pos-customer-action
'.$this->s['c']['col.xs12.sm6.md6'].'">';
		//echo '<form class="form-inline"
action="'.$this->t['linkpos'].'">';
		echo '<form
action="'.$this->t['linkpos'].'"
method="post"
class="'.$this->s['c']['form-horizontal.form-validate'].'"
role="form">';
		echo '<input type="hidden" name="task"
value="pos.savecustomer">';

		if ((int)$this->t['user']->id == (int)$v->id) {
			echo '<input type="hidden" name="id"
value="0">';
		} else {
			echo '<input type="hidden" name="id"
value="'.(int)$v->id.'">';
		}
		echo '<input type="hidden" name="tmpl"
value="component" />';
		echo '<input type="hidden" name="option"
value="com_phocacart" />';

	//	echo '<input type="hidden" name="ticketid"
value="'.(int)$this->t['ticket']->id.'"
/>';
	//	echo '<input type="hidden" name="unitid"
value="'.(int)$this->t['unit']->id.'"
/>';
	//	echo '<input type="hidden" name="sectionid"
value="'.(int)$this->t['section']->id.'"
/>';



		//echo '<input type="hidden"
name="mainboxdata"
value="'.$this->t['mainboxdatabase64'].'"
/>';
		echo '<input type="hidden"
name="redirectsuccess" value="main.content.products"
/>';
		echo '<input type="hidden"
name="redirecterror" value="main.content.customers"
/>';
		echo Joomla\CMS\HTML\HTMLHelper::_('form.token');

		if ((int)$this->t['user']->id == (int)$v->id) {
			echo '<button
class="'.$this->s['c']['btn.btn-danger'].'
editMainContent">'.JText::_('COM_PHOCACART_DESELECT').'</button>';
		} else {
			echo '<button
class="'.$this->s['c']['btn.btn-success'].'
editMainContent">'.JText::_('COM_PHOCACART_SELECT').'</button>';
		}
		echo '</form>';

		echo '</div>';// end row item
		echo '</div>';// end row
	}
} else {
	echo '<div
class="ph-pos-no-items">'.JText::_('COM_PHOCACART_NO_CUSTOMER_FOUND').'</div>';
}

//echo $this->loadTemplate('pagination');


echo '<form
action="'.$this->t['action'].'"
method="post" name="adminForm"
id="phPosPaginationBox">'. "\n";

if (!empty($this->items)) {

	echo '<div
class="'.$this->s['c']['row'].'
ph-pagination">';
	//if ($this->p->get('show_pagination')) {
	$col = 12;
	//if ($this->p->get('display_item_ordering')) {
		$col = 7;
		echo '<div
class="'.$this->s['c']["col.xs12.sm{$col}.md{$col}"].'
ph-center-pagination">';
		echo JText::_('COM_PHOCACART_ORDER_FRONT')
.':&nbsp;'. str_replace(
'class="inputbox"',
'class="'.$this->s['c']['inputbox'].'
'.$this->s['c']['form-control'].'
chosen-select" style="width: 16em"',
$this->t['ordering']);
		echo '</div>';
	//}

	//if ($this->p->get('show_pagination_limit')) {
		$col = 5;
		echo '<div
class="'.$this->s['c']["col.xs12.sm{$col}.md{$col}"].'
ph-center-pagination">';
		echo JText::_('COM_PHOCACART_DISPLAY_NUM')
.':&nbsp;' . str_replace(
'class="inputbox"',
'class="'.$this->s['c']['inputbox'].'
'.$this->s['c']['form-control'].'
chosen-select"',
$this->t['pagination']->getLimitBox(1));
		echo '</div>';
	//}

	echo '<div class="ph-cb"></div>';
	echo '<div class="col-xs-12 col-sm-12 col-md-12
ph-center-pagination pagination  phPaginationBox">'.
str_replace( 'class="inputbox"',
'class="'.$this->s['c']['inputbox'].'
'.$this->s['c']['form-control'].'
chosen-select"',
$this->t['pagination']->getPagesLinks()) .
'</div>';

	echo '<div class="ph-cb"></div>';

	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-center-pagination ph-pagination-mt pagination">';
	echo str_replace( 'class="inputbox"',
'class="'.$this->s['c']['inputbox'].'
'.$this->s['c']['form-control'].'
chosen-select"',
$this->t['pagination']->getPagesCounter());
	echo '</div>';

	echo '<div class="ph-cb"></div>';
	//}
	echo '</div>';
}

//if ($this->p->get('ajax_pagination_category', 0) == 1) {
	echo '<input type="hidden" name="format"
value="raw" />';
	echo '<input type="hidden" name="page"
value="'.$this->t['page'].'" />';
	echo '<input type="hidden" name="ticketid"
value="'.$this->t['ticket']->id.'"
/>';
	echo '<input type="hidden" name="unitid"
value="'.$this->t['unit']->id.'"
/>';
	echo '<input type="hidden" name="sectionid"
value="'.$this->t['section']->id.'"
/>';
	echo '<input type="hidden" name="date"
value="'.$this->state->get('date').'"
/>';
//}

echo Joomla\CMS\HTML\HTMLHelper::_( 'form.token' );
echo '</form>';
?>
views/pos/tmpl/default_main_content_order.php000064400000005124151167552070015557
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$price	= $this->t['price'];
$order	= new PhocacartOrderRender();


$view = '<a href="#" data-type="1"
data-order="'.(int)$this->t['id'].'"
class="'.$this->s['c']['btn.btn-default.btn-sm'].'
ph-btn phOrderPrintBtn" role="button"><span
title="'.JText::_('COM_PHOCACART_VIEW_ORDER').'"
class="'.$this->s['i']['order'].'
ph-icon-success"></span></a>';
$view .= ' <a href="#" data-type="4"
data-order="'.(int)$this->t['id'].'"
class="'.$this->s['c']['btn.btn-default.btn-sm'].'
ph-btn phOrderPrintBtn" role="button"><span
title="'.JText::_('COM_PHOCACART_VIEW_RECEIPT').'"
class="'.$this->s['i']['receipt'].'
ph-icon-success"></span></a>';
$view .= ' <a href="#" data-type="2"
data-order="'.(int)$this->t['id'].'"
class="'.$this->s['c']['btn.btn-default.btn-sm'].'
ph-btn phOrderPrintBtn" role="button"><span
title="'.JText::_('COM_PHOCACART_VIEW_INVOICE').'"
class="'.$this->s['i']['invoice'].'
ph-icon-danger"></span></a>';
$view .= ' <a href="#" data-type="3"
data-order="'.(int)$this->t['id'].'"
class="'.$this->s['c']['btn.btn-default.btn-sm'].'
ph-btn phOrderPrintBtn" role="button"><span
title="'.JText::_('COM_PHOCACART_VIEW_DELIVERY_NOTE').'"
class="'.$this->s['i']['del-note'].'"></span></a>';
$view .= ' <a href="#" data-type="-1"
data-order="'.(int)$this->t['id'].'"
class="'.$this->s['c']['btn.btn-default.btn-sm'].'
ph-btn phOrderPrintBtn" role="button"><span
title="'.JText::_('COM_PHOCACART_PRINT').'"
class="'.$this->s['i']['print'].'"></span></a>';

// Default document displayed at start
$o = $order->render($this->t['id'], 4, 'raw');

echo '<div class="ph-pos-order-box">';
echo '<div class="ph-pos-order-print-box">'.
$view.' </div>';
echo '<div class="ph-cb"></div>';

// class is used for CSS
// data-type and data order for selecting currently displayed document to
print (SERVER PRINT)
echo '<div id="phPosOrderPrintBox"
class="phType4" data-type="4"
data-order="'.(int)$this->t['id'].'">';
$o = str_replace("\n", '', $o);// produce html output
in PRE and CODE tag without new rows ("\n");
echo '<div
class="phPrintInBox">'.$o.'</div>';//
--> components\com_phocacart\views\order\view.raw.php
echo '</div>';

echo '</div>';// end ph-pos-order-box


// Pagination variables only
$this->items = false;
echo $this->loadTemplate('pagination');
?>
views/pos/tmpl/default_main_content_orders.php000064400000012321151167552070015737
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

$price = $this->t['price'];

echo '<div
class="ph-box-header">'.JText::_('COM_PHOCACART_ORDERS_SALES').'</div>';
if (!empty($this->items)) {

	echo '<div
class="'.$this->s['c']['row'].'
ph-pos-customer-row-header">';
		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm2.md2'].'">'.JText::_('COM_PHOCACART_ORDER').'</div>';
		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm1.md1'].'">'.JText::_('COM_PHOCACART_VENDOR').'</div>';
		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm1.md1'].'">'.JText::_('COM_PHOCACART_TOTAL').'</div>';
		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm1.md1'].'">'.JText::_('COM_PHOCACART_CUSTOMER').'</div>';
		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm2.md2'].'">'.JText::_('COM_PHOCACART_DATE').'</div>';
		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm1.md1'].'">'.JText::_('COM_PHOCACART_SECTION').'</div>';
		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm1.md1'].'">'.JText::_('COM_PHOCACART_UNIT').'</div>';
		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm1.md1'].'">'.JText::_('COM_PHOCACART_TICKET').'</div>';
		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm2.md2'].'"></div>';
	echo '</div>';

	foreach ($this->items as $v) {

		$orderNumber = isset($v->order_number) && $v->order_number
!= '' ? $v->order_number : false;

		echo '<div
class="'.$this->s['c']['row'].'
ph-pos-customer-row">';

		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm2.md2'].'">';
		echo '<div
class="ph-pos-customer-name">'.PhocacartOrder::getOrderNumber($v->id,
$v->date, $orderNumber).'</div>';
		echo '</div>';

		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm1.md1'].'">';
		echo '<div
class="ph-pos-vendor-name">'.$v->vendor_title.'</div>';
		echo '</div>';

		$price->setCurrency($v->currency_id, $v->id);

		$amount = (isset($v->total_amount_currency) &&
$v->total_amount_currency > 0) ?
$price->getPriceFormat($v->total_amount_currency, 0, 1) :
$price->getPriceFormat($v->total_amount);

		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm1.md1'].'">';
		echo '<div
class="ph-pos-total">'.$amount.'</div>';
		echo '</div>';

		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm1.md1'].'">';
		echo '<div
class="ph-pos-customer-name">'.$v->user_title.'</div>';
		echo '</div>';


		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm2.md2'].'">';
		echo '<div
class="ph-pos-customer-name">'.JHtml::date($v->date,
'DATE_FORMAT_LC6').'</div>';
		echo '</div>';


		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm1.md1'].'">';
		echo '<div class="ph-pos-section-name">';
		$title = $v->section_id;
		if (isset($v->section_title)) {
			$title = $v->section_title;
		}
		echo '<span class="label
label-primary">'.$title.'</span>';
		echo '</div>';
		echo '</div>';

		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm1.md1'].'">';
		echo '<div class="ph-pos-unit-name">';
		$title = $v->unit_id;
		if (isset($v->unit_title)) {
			$title = $v->unit_title;
		}
		echo '<span class="label label-info badge
badge-info">'.$title.'</span>';
		echo '</div>';
		echo '</div>';


		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm1.md1'].'">';
		echo '<div class="ph-pos-ticket-name">';
		echo '<span class="label label-warning badge
badge-warning">'.$v->ticket_id.'</span>';
		echo '</div>';
		echo '</div>';

		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm2.md2'].'
ph-pos-customer-action">';
		echo '<form
class="'.$this->s['c']['form-inline'].'"
action="'.$this->t['linkpos'].'"
method="post">';
		echo '<input type="hidden" name="page"
value="main.content.order">';
		echo '<input type="hidden" name="id"
value="'.(int)$v->id.'">';
		echo '<input type="hidden" name="tmpl"
value="component" />';
		echo '<input type="hidden" name="option"
value="com_phocacart" />';
		echo '<input type="hidden" name="ticketid"
value="'.(int)$this->t['ticket']->id.'"
/>';
		echo '<input type="hidden" name="unitid"
value="'.(int)$this->t['unit']->id.'"
/>';
		echo '<input type="hidden" name="sectionid"
value="'.(int)$this->t['section']->id.'"
/>';
		echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
		echo '<button
class="'.$this->s['c']['btn.btn-success'].'
loadMainContent">'.JText::_('COM_PHOCACART_VIEW').'</button>';
		echo '</form>';
		echo '</div>';

		echo '</div>';// end row
	}

} else {
	echo '<div
class="ph-pos-no-items">'.JText::_('COM_PHOCACART_NO_ORDER_SALE_FOUND_FOR_SELECTED_DATE').'</div>';
}

echo $this->loadTemplate('pagination');

?>
views/pos/tmpl/default_main_content_payment.php000064400000007031151167552070016120
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$price		= new PhocacartPrice();


echo '<div class="ph-pos-payment-box">';

echo '<div
class="'.$this->s['c']['row'].'
row-vac">';

echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm3.md3'].'">';
echo '</div>';


echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm3.md3'].'">';
echo '<div class="ph-pos-payment-item-txt">' .
JText::_('COM_PHOCACART_TOTAL_TO_PAY') .
'</div>';
echo '</div>';

echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm3.md3'].'">';
//$totalAmount = 0;
if ($this->t['total'][0]['brutto_currency'] !== 0)
{
	echo '<div class="ph-pos-total-to-pay
ph-right">' .
$price->getPriceFormat($this->t['total'][0]['brutto_currency'],
0, 1).'</div>';
	//$totalAmount =
$this->t['total'][0]['brutto_currency'];
} else if ($this->t['total'][0]['brutto'] !== 0) {
	echo '<div class="ph-pos-total-to-pay
ph-right">' .
$price->getPriceFormat($this->t['total'][0]['brutto']).'</div>';
	//$totalAmount = $this->t['total'][0]['brutto'];
}
echo '</div>';


echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm3.md3'].'">';
echo '</div>';

echo '</div>'; // end row-vac



echo '<form class="form-inline"
action="'.$this->t['action'].'"
method="post">';

// PLUGIN
$output 	= '';
$payment	= $this->cart->getPaymentMethod();
//$dispatcher = J EventDispatcher::getInstance();
JPluginHelper::importPlugin('pcp',
htmlspecialchars(strip_tags($payment['method'])));
$eventData 					= array();
$eventData['pluginname'] 	=
htmlspecialchars(strip_tags($payment['method']));
\JFactory::getApplication()->triggerEvent('PCPonDisplayPaymentPos',
array(&$output, $this->t, $eventData));
echo $output;
// END PLUGIN



echo '<div
class="'.$this->s['c']['row'].'
row-vac">';

echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm3.md3'].'">';
echo '</div>';

echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm6.md6'].'
ph-pos-payment-confirm-box">';

echo '<input type="hidden" name="task"
value="pos.order">';
echo '<input type="hidden" name="page"
value="main.content.payment">';
echo '<input type="hidden" name="tmpl"
value="component" />';
echo '<input type="hidden" name="option"
value="com_phocacart" />';
echo '<input type="hidden" name="ticketid"
value="'.(int)$this->t['ticket']->id.'"
/>';
echo '<input type="hidden" name="unitid"
value="'.(int)$this->t['unit']->id.'"
/>';
echo '<input type="hidden" name="sectionid"
value="'.(int)$this->t['section']->id.'"
/>';
echo '<input type="hidden"
name="redirectsuccess" value="main.content.order"
/>';
echo '<input type="hidden" name="redirecterror"
value="main.content.payment" />';
echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
echo '<button
class="'.$this->s['c']['btn.btn-success.btn-lg'].'
btn-extra-lg
editMainContent">'.JText::_('COM_PHOCACART_CONFIRM').'</button>';

echo '</div>';

echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm3.md3'].'">';
echo '</div>';

echo '</div>';// end row-vac

echo '</form>';


echo '</div>';// end ph-pos-payment-box


// Pagination variables only
$this->items = false;
echo $this->loadTemplate('pagination');
?>
views/pos/tmpl/default_main_content_payment_methods.php000064400000012711151167552070017644
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

$price	= $this->t['price'];

echo '<div
class="ph-box-header">'.JText::_('COM_PHOCACART_PAYMENT_METHODS').'</div>';

echo '<div
class="ph-checkout-payment-cost-box">';

if (!empty($this->t['paymentmethods'])) {

	foreach($this->t['paymentmethods'] as $k => $v) {

		echo '<div
class="'.$this->s['c']['row'].'
ph-pos-payment-method-row">';
		//echo '<form
action="'.$this->t['linkpos'].'"
method="post" class="form-horizontal form-validate"
role="form" id="phPosPaginationBox">';

		echo '<form
action="'.$this->t['linkpos'].'"
method="post"
class="'.$this->s['c']['form-horizontal.form-validate'].'"
role="form">';

		$checked = '';
		if (isset($v->selected) && $v->selected == 1 ) {
			$checked = 'checked="checked"';
		}

		$priceI = $price->getPriceItemsPayment($v->cost,
$v->cost_additional, $v->calculation_type,
$this->t['total'][0], $v->taxid, $v->taxrate,
$v->taxcalculationtype, $v->taxtitle, 0, 1);


		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm5.md5'].'">';
		if ($v->image != '') {
			echo '<span class="ph-payment-image"><img
src="'.JURI::base(true) .'/'. $v->image.'"
alt="'.htmlspecialchars(strip_tags($v->title)).'"
/></span>';
		}

		echo '<span
class="ph-payment-title">'.$v->title.'</span>';

		if ($this->t['display_payment_desc'] &&
$v->description != '') {
			echo '<div
class="ph-checkout-payment-desc">'.Joomla\CMS\HTML\HTMLHelper::_('content.prepare',
$v->description).'</div>';
		}
		echo '</div>';


		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm4.md4'].'"><div
class="radio">';

		if ($this->t['zero_payment_price'] == 0 &&
$priceI['zero'] == 1) {
			// Display blank price field
		} else if ($this->t['zero_payment_price'] == 2 &&
$priceI['zero'] == 1) {
			// Display free text
			echo '<div
class="'.$this->s['c']['col.xs12.sm8.md8'].'"></div>';
			echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'
ph-checkout-payment-tax">'.JText::_('COM_PHOCACART_FREE').'</div>';
		} else {
			if ($priceI['nettoformat'] ==
$priceI['bruttoformat']) {

			} else if ($priceI['nettoformat'] != '') {
				echo '<div
class="'.$this->s['c']['col.xs12.sm8.md8'].'">'.$priceI['nettotxt'].'</div>';
				echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'
ph-checkout-payment-netto">'.$priceI['nettoformat'].'</div>';
			}

			if ($priceI['taxformat'] != '') {
				echo '<div
class="'.$this->s['c']['col.xs12.sm8.md8'].'">'.$priceI['taxtxt'].'</div>';
				echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'
ph-checkout-payment-tax">'.$priceI['taxformat'].'</div>';
			}

			if ($priceI['bruttoformat'] != '') {
				echo '<div
class="'.$this->s['c']['col.xs12.sm8.md8'].'">'.$priceI['bruttotxt'].'</div>';
				echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'
ph-checkout-payment-brutto">'.$priceI['bruttoformat'].'</div>';
			}
		}

		echo '</div></div>';

		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm3.md3'].'
ph-pos-customer-action">';
		if ((int)$this->t['paymentid'] == (int)$v->id) {
			echo '<button
class="'.$this->s['c']['btn.btn-danger'].'
editMainContent">'.JText::_('COM_PHOCACART_DESELECT').'</button>';
			echo '<input type="hidden" name="id"
value="0" />';
		} else {
			echo '<button
class="'.$this->s['c']['btn.btn-success'].'
editMainContent">'.JText::_('COM_PHOCACART_SELECT').'</button>';
			echo '<input type="hidden" name="id"
value="'.(int)$v->id.'" />';
		}
		echo '</div>';


		echo '<input type="hidden" name="task"
value="pos.savepayment" />'. "\n";
		echo '<input type="hidden" name="tmpl"
value="component" />';
		echo '<input type="hidden" name="option"
value="com_phocacart" />'. "\n";
		echo '<input type="hidden"
name="redirectsuccess" value="main.content.products"
/>';
		echo '<input type="hidden"
name="redirecterror"
value="main.content.paymentmethods" />';
		echo Joomla\CMS\HTML\HTMLHelper::_('form.token');


		echo '<div class="ph-cb"></div>';

		echo '<div class="ph-pos-coupon-reward-box">';

		// COUPON CODE
		if ($this->t['enable_coupons'] > 0) {
			//echo '<div class="col-sm-12 col-md-12 ">';
			echo
'<label>'.JText::_('COM_PHOCACART_COUPON_CODE').
'
<small>('.JText::_('COM_PHOCACART_APPLY_COUPON_CODE').')</small><br
/><input type="text" name="phcoupon"
id="phcoupon"
value="'.$this->t['couponcodevalue'].'"
autocomplete="off"></label>';
			//echo '</div><div
class="ph-cb"></div>';
		}

		// REWARD POINTS
		if ($this->t['rewards']['apply']) {
			//echo '<div class="col-sm-12 col-md-12 ">';
			echo
'<label>'.JText::_('COM_PHOCACART_REWARD_POINTS').'
'.$this->t['rewards']['text'].'<br
/><input type="text" name="phreward"
id="phreward"
value="'.$this->t['rewards']['usedvalue'].'"
autocomplete="off"></label>';
			//echo '</div><div
class="ph-cb"></div>';
		}

		echo '</div>';

		echo '</form>'. "\n";

		echo '</div>';

		echo '<div class="ph-cb
ph-pos-hr-sub"></div>';

	}

} else {
	echo '<div
class="ph-pos-no-items">'.JText::_('COM_PHOCACART_NO_PAYMENT_METHOD_FOUND').'</div>';
}

echo '</div>';// end payment cost box

// Pagination variables only
$this->items = false;
echo $this->loadTemplate('pagination');
?>
views/pos/tmpl/default_main_content_products.php000064400000025403151167552070016311
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();



$layoutA	= new JLayoutFile('button_add_to_cart_list', null,
array('component' => 'com_phocacart'));
$layoutP	= new JLayoutFile('product_price', null,
array('component' => 'com_phocacart'));
$layoutI	= new JLayoutFile('product_image', null,
array('component' => 'com_phocacart'));
$layoutAB	= new JLayoutFile('attribute_options_box', null,
array('component' => 'com_phocacart'));
$layoutPFS	= new JLayoutFile('form_part_start_add_to_cart_list',
null, array('component' => 'com_phocacart'));
$layoutPFE	= new JLayoutFile('form_part_end', null,
array('component' => 'com_phocacart'));
$layoutBSH	= new JLayoutFile('button_submit_hidden', null,
array('component' => 'com_phocacart'));
$layoutS	= new JLayoutFile('product_stock', null,
array('component' => 'com_phocacart'));
$layoutPOQ	= new JLayoutFile('product_order_quantity', null,
array('component' => 'com_phocacart'));


// ITEMS
if (!empty($this->items)) {

	$price	= new PhocacartPrice;
	$col 	=
PhocacartRenderFront::getColumnClass($this->t['columns_pos']);
	$lt		= $this->t['pos_hide_attributes'] == 0 ?
'grid' : 'fullbutton grid';
	$i		= 1; // Not equal Heights

	echo '<div id="phItems" class="ph-items
'.$lt.'">';
	echo '<div
class="'.$this->s['c']['row.row-flex'].'
'.$lt.'">';

	foreach ($this->items as $v) {

		// DIFF CATEGORY / ITEMS
		//$this->t['categoryid'] = (int)$v->catid;

		//$label 		= PhocacartRenderFront::getLabel($v->date, $v->sales,
$v->featured);
		$link 		= JRoute::_(PhocacartRoute::getItemRoute($v->id, $v->catid,
$v->alias, $v->catalias));


		// Image data
		$attributesOptions 	= $this->t['pos_hide_attributes'] == 0 ?
PhocacartAttribute::getAttributesAndOptions((int)$v->id) : array();
		if (!isset($v->additional_image)) { $v->additional_image =
'';}
		$image = PhocacartImage::getImageDisplay($v->image,
$v->additional_image, $this->t['pathitem'],
$this->t['switch_image_category_items'],
$this->t['image_width_cat'],
$this->t['image_height_cat'], '', $lt,
$attributesOptions);


		if (!isset($image['image']->rel) ||
(isset($image['image']->rel) &&
$image['image']->rel == '')) {
			$image['image']->rel 	=
'media/com_phocacart/images/no-image.png';
			$image['image']->abs 	= JPATH_ROOT .
'/media/com_phocacart/images/no-image.png';
			$image['default']->rel 	=
$image['image']->rel;
			$image['default']->abs 	=
$image['image']->abs;


		}

		// :L: IMAGE
		$dI	= array();
		if (isset($image['image']->rel) &&
$image['image']->rel != '') {
			$dI['t']				= $this->t;
			$dI['s']				= $this->s;
			$dI['product_id']		= (int)$v->id;
			$dI['layouttype']		= $lt;
			$dI['image']			= $image;
			$dI['title']			= $v->title;
			$dI['typeview']			= 'Pos';

		}





		// :L: PRICE
		$dP 			= array();

		if ($this->t['can_display_price']) {
			$dP['s']		= $this->s;
			$dP['type']		= $v->type;// PRODUCTTYPE
			$dP['priceitems']	= $price->getPriceItems($v->price,
$v->taxid, $v->taxrate, $v->taxcalculationtype, $v->taxtitle,
$v->unit_amount, $v->unit_unit, 1, 1, $v->group_price);
			$price->getPriceItemsChangedByAttributes($dP['priceitems'],
$attributesOptions, $price, $v);
			$dP['priceitemsorig']= array();
			if ($v->price_original != '' &&
$v->price_original > 0) {
				$dP['priceitemsorig'] =
$price->getPriceItems($v->price_original, $v->taxid,
$v->taxrate, $v->taxcalculationtype);
			}
			//$dP['class']		= 'ph-category-price-box '.$lt;
			$dP['class']		= 'ph-category-price-box';// Cannot be
dynamic as can change per ajax - this can cause jumping of boxes
			$dP['product_id']	= (int)$v->id;
			$dP['typeview']		= 'Pos';

			// Display discount price
			// Move standard prices to new variable (product price -> product
discount)
			$dP['priceitemsdiscount']		= $dP['priceitems'];
			$dP['discount'] 				=
PhocacartDiscountProduct::getProductDiscountPrice($v->id,
$dP['priceitemsdiscount']);

			// Display cart discount (global discount) in product views - under
specific conditions only
			// Move product discount prices to new variable (product price ->
product discount -> product discount cart)
			$dP['priceitemsdiscountcart']	=
$dP['priceitemsdiscount'];
			$dP['discountcart']				=
PhocacartDiscountCart::getCartDiscountPriceForProduct($v->id,
$v->catid, $dP['priceitemsdiscountcart']);
			$dP['zero_price']		= 1;// Apply zero price if possible
		}



		// :L: ADD TO CART
		$dA = $dA2 = $dA3 = $dAb = $dF = array();
		$icon['addtocart'] = '';

		// STOCK ===================================================
		// Set stock: product, variations, or advanced stock status
		$dSO 				= '';
		$dA['class_btn']	= '';
		$dA['class_icon']	= '';
		$dA['s']			= $this->s;
		if ($this->t['pos_display_stock_status'] == 1) {

			$stockStatus 				= array();
			$stock 						=
PhocacartStock::getStockItemsChangedByAttributes($stockStatus,
$attributesOptions, $v);

			if ($this->t['hide_add_to_cart_stock'] == 1 &&
(int)$stock < 1) {
				$dA['class_btn'] 		= 'ph-visibility-hidden';// hide
button
				$dA['class_icon']		= 'ph-display-none';// hide
icon
			}

			if($stockStatus['stock_status'] ||
$stockStatus['stock_count'] !== false) {
				$dS							= array();
				$dS['s']					= $this->s;
				$dS['class']				= 'ph-item-stock-box';
				$dS['product_id']			= (int)$v->id;
				$dS['typeview']				= 'Pos';
				$dS['stock_status_output'] 	=
PhocacartStock::getStockStatusOutput($stockStatus);
				$dSO = $layoutS->render($dS);
			}

			if($stockStatus['min_quantity']) {
				$dPOQ						= array();
				$dPOQ['s']					= $this->s;
				$dPOQ['text']				=
JText::_('COM_PHOCACART_MINIMUM_ORDER_QUANTITY');
				$dPOQ['status']				= $stockStatus['min_quantity'];
				$dSO .= $layoutPOQ->render($dPOQ);
			}

			if($stockStatus['min_multiple_quantity']) {
				$dPOQ						= array();
				$dPOQ['s']					= $this->s;
				$dPOQ['text']				=
JText::_('COM_PHOCACART_MINIMUM_MULTIPLE_ORDER_QUANTITY');
				$dPOQ['status']				=
$stockStatus['min_multiple_quantity'];
				$dSO .= $layoutPOQ->render($dPOQ);
			}
		}
		// END STOCK ================================================


		// ------------------------------------
		// BUTTONS + ICONS
		// ------------------------------------
		// Prepare data for Add to cart button
		// - Add To Cart Standard Button
		// - Add to Cart Icon Button
		// - Add to Cart Icon Only

		// FORM DATA
		$dF['s']					= $this->s;
		$dF['linkch']				= $this->t['linkcheckout'];//
link to checkout (add to cart)
		$dF['id']					= (int)$v->id;
		$dF['catid']				= (int)$v->catid;
		$dF['ticketid']				= $this->t['ticket']->id;
		$dF['unitid']				= $this->t['unit']->id;
		$dF['sectionid']			= $this->t['section']->id;
		$dF['return']				= $this->t['actionbase64'];
		$dF['typeview']				= 'Pos';
		$dA['addtocart']			=
$this->t['category_addtocart'];
		$dA['addtocart_icon']		=
$this->t['display_addtocart_icon'];

		// Both buttons + icon
		$dA['id']					= (int)$v->id;
		$dA['link']					= $link;// link to item (product) view e.g.
when there are required attributes - we cannot add it to cart
		$dA['addtocart']			= 1;// POS has no external, quick view, icon
only, etc - just use standard -
$this->t['category_addtocart'];
		$dA['method']				= $this->t['add_cart_method'];
		$dA['typeview']				= 'Pos';

		// ATTRIBUTES, OPTIONS
		$dAb['s']						= $this->s;
		$dAb['attr_options']			= $attributesOptions;
		$dAb['hide_attributes']			=
$this->t['pos_hide_attributes'];
		$dAb['dynamic_change_image'] 	=
$this->t['dynamic_change_image'];
        $dAb['zero_attribute_price']	=
$this->t['zero_attribute_price'];
		$dAb['pathitem']				= $this->t['pathitem'];

		$dAb['product_id']				= (int)$v->id;
		$dAb['image_size']				= $image['size'];
		$dAb['typeview']				= 'Pos';
		$dAb['price']					= $price;

		// Attribute is required and we don't display it in category/items
view, so we need to redirect to detail view
		// NOT IN POS
		$dA['selectoptions']	= 0;
		/*if (isset($v->attribute_required) &&
$v->attribute_required == 1 &&
$this->t['pos_hide_attributes'] == 1) {
			$dA['selectoptions']	= 1;
		}*/





		// ======
		// RENDER
		// ======
		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']["col.xs12.sm{$col}.md{$col}"].'">';
		echo '<div class="ph-item-box
'.$lt.'">';
		//echo '<div
class="ph-label-box">'.$label['new'] .
$label['hot'] .
$label['feat'].'</div>';
		echo '<div
class="'.$this->t['class_thumbnail'].'
ph-thumbnail ph-thumbnail-c ph-item '.$lt.'">';
		echo '<div class="ph-item-content
'.$lt.'">';


		// -----------
		// RENDER GRID
		// -----------
		echo '<div
class="'.$this->s['c']['cat_item_grid'].'">';
		// :L: IMAGE
	//	echo '<a href="'.$link.'">';
		if (!empty($dI)) { echo $layoutI->render($dI);}
	//	echo '</a>';


		echo '</div>';

		echo '<div class="ph-item-clearfix
'.$lt.'"></div>';

		// CAPTION, DESCRIPTION BOX


		//echo '<div class="ph-caption 
'.$lt.'">';
		echo
PhocacartRenderFront::renderProductHeader($this->t['product_name_link'],
$v, 'item', '', $lt);
		//echo '</div>';// end caption







		// :L: PRICE
		if (!empty($dP)) { echo $layoutP->render($dP);}

		// VIEW PRODUCT BUTTON
		echo '<div class="ph-category-add-to-cart-box
'.$lt.'">';

		// :L: Stock status
		if (!empty($dSO)) { echo $dSO;}

		// Start Form
		if (!empty($dF)) { echo $layoutPFS->render($dF);}

		// :L: ATTRIBUTES AND OPTIONS
		if (!empty($dAb)) { echo $layoutAB->render($dAb);}

		// :L: ADD TO CART
		if (!empty($dA)) { echo $layoutA->render($dA);} else if
($icon['addtocart'] != '') { echo
$layoutBSH->render();}

		// End Form
		if (!empty($dF)) { echo $layoutPFE->render();}


		echo '</div>';// end add to cart box







		// --------------- END RENDER



		echo '<div class="ph-cb"></div>';


		echo '</div>';// end ph-item-content
		echo '</div>';// end thumbnail ph-item
		echo '</div>';// end ph-item-box
		echo '</div>'. "\n"; // end row item - columns

		if ($i%(int)$this->t['columns_pos'] == 0) {
			echo '<div class="ph-cb"></div>';
		}
		$i++;
	}


	echo '</div>';// end row (row-flex)
	echo '<div class="pb-cb"></div>';

	echo $this->loadTemplate('pagination');

	echo '</div>'. "\n"; // end items
} else {
	echo '<div id="phItems" class="ph-items
'.$this->s['c']['grid'].'">';
	echo '<div class="ph-pos-no-items-icon"><span
class="'.$this->s['i']['ban'].'"></span></div>';
	echo '<div
class="ph-pos-no-items">'.JText::_('COM_PHOCACART_NO_PRODUCT_FOUND').'</div>';

	echo $this->loadTemplate('pagination');// empty pagination
only needed variables
	echo '</div>'. "\n"; // end items
}
?>
views/pos/tmpl/default_main_content_shipping_methods.php000064400000010677151167552070020021
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

$price	= $this->t['price'];

echo '<div
class="ph-box-header">'.JText::_('COM_PHOCACART_SHIPPING_METHODS').'</div>';

echo '<div
class="ph-checkout-shipping-cost-box">';

if (!empty($this->t['shippingmethods'])) {

	foreach($this->t['shippingmethods'] as $k => $v) {

		echo '<div
class="'.$this->s['c']['row'].'
ph-pos-shipping-method-row">';
		echo '<form
action="'.$this->t['linkpos'].'"
method="post"
class="'.$this->s['c']['form-horizontal.form-validate'].'"
role="form">';

		$checked = '';
		if (isset($v->selected) && $v->selected == 1 ) {
			$checked = 'checked="checked"';
		}

		$priceI = $price->getPriceItemsShipping($v->cost,
$v->cost_additional, $v->calculation_type,
$this->t['total'][0], $v->taxid, $v->taxrate,
$v->taxcalculationtype, $v->taxtitle, 0, 1);

		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm5.md5'].'">';
		if ($v->image != '') {
			echo '<span class="ph-shipping-image"><img
src="'.JURI::base(true) .'/'. $v->image.'"
alt="'.htmlspecialchars(strip_tags($v->title)).'"
/></span>';
		}

		echo '<span
class="ph-shipping-title">'.$v->title.'</span>';

		if ($this->t['display_shipping_desc'] &&
$v->description != '') {
			echo '<div
class="ph-checkout-shipping-desc">'.Joomla\CMS\HTML\HTMLHelper::_('content.prepare',
$v->description).'</div>';
		}
		echo '</div>';


		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm4.md4'].'"><div
class="radio">';

		if ($this->t['zero_shipping_price'] == 0 &&
$priceI['zero'] == 1) {
			// Display blank price field
		} else if ($this->t['zero_shipping_price'] == 2 &&
$priceI['zero'] == 1) {
			// Display free text
			echo '<div
class="'.$this->s['c']['col.xs12.sm8.md8'].'"></div>';
			echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'
ph-checkout-shipping-tax">'.JText::_('COM_PHOCACART_FREE').'</div>';
		} else {
			if ($priceI['nettoformat'] ==
$priceI['bruttoformat']) {

			} else if ($priceI['nettoformat'] != '') {
				echo '<div
class="'.$this->s['c']['col.xs12.sm8.md8'].'">'.$priceI['nettotxt'].'</div>';
				echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'
ph-checkout-shipping-netto">'.$priceI['nettoformat'].'</div>';
			}

			if ($priceI['taxformat'] != '') {
				echo '<div
class="'.$this->s['c']['col.xs12.sm8.md8'].'">'.$priceI['taxtxt'].'</div>';
				echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'
ph-checkout-shipping-tax">'.$priceI['taxformat'].'</div>';
			}

			if ($priceI['bruttoformat'] != '') {
				echo '<div
class="'.$this->s['c']['col.xs12.sm8.md8'].'">'.$priceI['bruttotxt'].'</div>';
				echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'
ph-checkout-shipping-brutto">'.$priceI['bruttoformat'].'</div>';
			}
		}

		echo '</div></div>';


		echo '<div
class="'.$this->s['c']['row-item'].'
'.$this->s['c']['col.xs12.sm3.md3'].'
ph-pos-customer-action">';
		if ((int)$this->t['shippingid'] == (int)$v->id) {
			echo '<button
class="'.$this->s['c']['btn.btn-danger'].'
editMainContent">'.JText::_('COM_PHOCACART_DESELECT').'</button>';
			echo '<input type="hidden" name="id"
value="0" />';
		} else {
			echo '<button
class="'.$this->s['c']['btn.btn-success'].'
editMainContent">'.JText::_('COM_PHOCACART_SELECT').'</button>';
			echo '<input type="hidden" name="id"
value="'.(int)$v->id.'" />';
		}
		echo '</div>';

		echo '<input type="hidden" name="task"
value="pos.saveshipping" />'. "\n";
		echo '<input type="hidden" name="tmpl"
value="component" />';
		echo '<input type="hidden" name="option"
value="com_phocacart" />'. "\n";
		echo '<input type="hidden"
name="redirectsuccess" value="main.content.products"
/>';
		echo '<input type="hidden"
name="redirecterror"
value="main.content.shippingmethods" />';
		echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
		echo '</form>'. "\n";

		echo '</div>';

		echo '<div class="ph-cb
ph-pos-hr-sub"></div>';

	}
} else {
	echo '<div
class="ph-pos-no-items">'.JText::_('COM_PHOCACART_NO_SHIPPING_METHOD_FOUND').'</div>';
}

echo '</div>';// end shipping cost box

// Pagination variables only
$this->items = false;
echo $this->loadTemplate('pagination');
?>
views/pos/tmpl/default_main_filter.php000064400000012720151167552070014177
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

echo '<div
class="ph-pos-message-box"></div>';

echo '<div class="ph-pos-filter-box">';


// DATE FILTER (ORDERS)
echo '<div class="ph-pos-date-order-box"
id="phPosDateOrdersBox">';
echo '<form id="phPosDateOrdersForm"
class="form-inline"
action="'.$this->t['linkpos'].'"
method="post">';

Joomla\CMS\HTML\HTMLHelper::_('script',
'system/html5fallback.js', false, true);

// DATE FROM
$name		= "date";
$id			= 'phPosDateOrders';
$format 	= '%Y-%m-%d';
$attributes = array(
			'onChange' =>
'jQuery(\'#phPosDateOrdersForm\').submit()',
			"showTime" => false,
			"todayBtn" => true,
			"weekNumbers" => false,
			"fillTable" => true,
			"singleHeader" => false
);
$valueFrom 	=
$this->escape($this->state->get('filter.date',
PhocacartDate::getCurrentDate()));


$calendar = Joomla\CMS\HTML\HTMLHelper::_('calendar', $valueFrom,
$name, $id, $format, $attributes);
$calendarIcon = $this->s['i']['calendar'];
$calendar = str_replace('icon-calendar', $calendarIcon .'
icon-calendar', $calendar);

echo '<div class="ph-inline-param">'.
$calendar.'</div>';

echo '<input type="hidden" name="tmpl"
value="component" />';
echo '<input type="hidden" name="option"
value="com_phocacart" />';
echo '<input type="hidden" name="format"
value="raw" />';
echo '<input type="hidden" name="page"
value="main.content.orders" />';
echo '<input type="hidden" name="ticketid"
value="'.$this->t['ticket']->id.'"
/>';
echo '<input type="hidden" name="unitid"
value="'.$this->t['unit']->id.'"
/>';
echo '<input type="hidden" name="sectionid"
value="'.$this->t['section']->id.'"
/>';
echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
echo '</form>';
echo '</div>';


// SKU PRODUCT (ajax based on .phItemCartBoxForm)
echo '<div class="ph-pos-sku-product-box"
id="phPosSkuProductBox">';
echo '<div class="inner-addon right-addon">';

echo ' <i
class="'.$this->s['i']['barcode'].'"></i>';

echo '<form id="phPosSkuProductForm"
class="phItemCartBoxForm phjAddToCart phjPos phjAddToCartVPosPSku
form-inline"
action="'.$this->t['linkpos'].'"
method="post">';

echo '<input type="hidden" name="quantity"
value="1">';
echo '<input type="hidden" name="task"
value="pos.add">';
echo '<input type="hidden" name="tmpl"
value="component" />';
echo '<input type="hidden" name="option"
value="com_phocacart" />';
echo '<input type="hidden" name="page"
value="'.$this->t['page'].'" />';
echo '<input type="hidden" name="ticketid"
value="'.$this->t['ticket']->id.'"
/>';
echo '<input type="hidden" name="unitid"
value="'.$this->t['unit']->id.'"
/>';
echo '<input type="hidden" name="sectionid"
value="'.$this->t['section']->id.'"
/>';
//echo '<input type="hidden" name="return"
value="'.$this->t['mainboxdatabase64'].'"
/>';
echo '<input
type="'.$this->t['pos_sku_input_type'].'"
name="sku" id="phPosSku"
value="'.htmlspecialchars($this->t['sku']).'"
class="'.$this->s['c']['form-control'].'
ph-pos-search"
placeholder="'.$this->t['skutypetxt'].'
..."
'.$this->t['pos_input_autocomplete_output'].'
/>';
//echo '<input type="submit" value="submit"
/>';
echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
echo '</form>';

echo '</div>';
echo '</div>';


// LOYALTY CARD NUMBER (USER) (ajax based on .editMainContent)
echo '<div class="ph-pos-card-user-box"
id="phPosCartUserBox">';
echo '<div class="inner-addon right-addon">';

echo ' <i
class="'.$this->s['i']['barcode'].'"></i>';

echo '<form id="phPosCardUserForm"
class="phjAddToCartVPosPCard form-inline"
action="'.$this->t['linkpos'].'"
method="post">';

echo '<input type="hidden" name="quantity"
value="1">';
echo '<input type="hidden" name="task"
value="pos.savecustomer">';
echo '<input type="hidden" name="tmpl"
value="component" />';
echo '<input type="hidden" name="option"
value="com_phocacart" />';
echo '<input type="hidden" name="page"
value="'.$this->t['page'].'" />';
echo '<input type="hidden" name="ticketid"
value="'.$this->t['ticket']->id.'"
/>';
echo '<input type="hidden" name="unitid"
value="'.$this->t['unit']->id.'"
/>';
echo '<input type="hidden" name="sectionid"
value="'.$this->t['section']->id.'"
/>';
//echo '<input type="hidden" name="return"
value="'.$this->t['mainboxdatabase64'].'"
/>';
echo '<input
type="'.$this->t['pos_loyalty_card_number_input_type'].'"
name="card" id="phPosCard"
value="'.htmlspecialchars($this->t['card']).'"
class="'.$this->s['c']['form-control'].'
ph-pos-search"
placeholder="'.JText::_('COM_PHOCACART_FIELD_LOYALTY_CARD_NUMBER_LABEL').'
..."
'.$this->t['pos_input_autocomplete_output'].'
/>';
//echo '<input type="submit" value="submit"
/>';
echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
echo '</form>';

echo '</div>';
echo '</div>';


// SEARCH
echo '<div class="ph-pos-search-box"
id="phPosSearchBox">';
echo '<div class="inner-addon right-addon">';
echo ' <i
class="'.$this->s['i']['search'].'"></i>';
echo '	<input type="text" name="phpossearch"
id="phPosSearch"
value="'.htmlspecialchars($this->t['search']).'"
class="'.$this->s['c']['form-control'].'
ph-pos-search"
placeholder="'.JText::_('COM_PHOCACART_SEARCH').'
..."
'.$this->t['pos_input_autocomplete_output'].'
/>';
echo '</div>';
echo '</div>';

echo '</div>'; // end ph-pos-filter-box
?>
views/pos/tmpl/default_main_input.php000064400000012757151167552070014063
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

// USER
echo '<form class="form-inline"
action="'.$this->t['action'].'"
method="post">';
echo '<input type="hidden" name="format"
value="raw">';
echo '<input type="hidden" name="page"
value="main.content.customers">';
echo '<input type="hidden" name="tmpl"
value="component" />';
echo '<input type="hidden" name="option"
value="com_phocacart" />';
echo '<input type="hidden" name="ticketid"
value="'.(int)$this->t['ticket']->id.'"
/>';
echo '<input type="hidden" name="unitid"
value="'.(int)$this->t['unit']->id.'"
/>';
echo '<input type="hidden" name="sectionid"
value="'.(int)$this->t['section']->id.'"
/>';
//echo '<input type="hidden" name="limitstart"
value="0" />';//We use more pages, reset for new date,
new customer, new products
//echo '<input type="hidden" name="start"
value="0" />';
echo Joomla\CMS\HTML\HTMLHelper::_('form.token');

if ($this->t['userexists']) {
	echo '<button
class="'.$this->s['c']['btn.btn-primary'].'
loadMainContent"><span
class="'.$this->s['i']['user'].'
icon-white"></span> 
&nbsp;'.$this->t['user']->name.'</button>';
} else if ($this->t['anonymoususerexists']) {
	echo '<button
class="'.$this->s['c']['btn.btn-primary'].'
loadMainContent"><span
class="'.$this->s['i']['user'].'
icon-white"></span> 
&nbsp;'.$this->t['loyalty_card_number'].'</button>';
} else {
	echo '<button
class="'.$this->s['c']['btn.btn-primary'].'
loadMainContent"><span
class="'.$this->s['i']['user'].'
icon-white"></span>
&nbsp;'.JText::_('COM_PHOCACART_SELECT_CUSTOMER').'</button>';
}

echo '</form>';


// SHIPPING Method
$title = JText::_('COM_PHOCACART_SELECT_SHIPPING_METHOD');
if ($this->t['shippingmethodexists']) {
	$shipping = $this->cart->getShippingMethod();
	if (isset($shipping['title']) &&
$shipping['title'] != '') {
		$title = $shipping['title'];
	}
}

if ($this->t['pos_shipping_force'] == 0) {

	echo '<form class="form-inline"
action="'.$this->t['action'].'"
method="post">';
	echo '<input type="hidden" name="format"
value="raw">';
	echo '<input type="hidden" name="page"
value="main.content.shippingmethods">';
	echo '<input type="hidden" name="tmpl"
value="component" />';
	echo '<input type="hidden" name="option"
value="com_phocacart" />';
	echo '<input type="hidden" name="ticketid"
value="'.(int)$this->t['ticket']->id.'"
/>';
	echo '<input type="hidden" name="unitid"
value="'.(int)$this->t['unit']->id.'"
/>';
	echo '<input type="hidden" name="sectionid"
value="'.(int)$this->t['section']->id.'"
/>';
	echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
	echo '<button
class="'.$this->s['c']['btn.btn-primary'].'
loadMainContent"><span
class="'.$this->s['i']['shipping-method'].'
icon-white"></span>
&nbsp;'.$title.'</button>';
	echo '</form>';
} else {
	echo '<div><button
class="'.$this->s['c']['btn.btn-primary'].'"><span
class="'.$this->s['i']['shipping-method'].'
icon-white"></span>
&nbsp;'.$title.'</button></div>';
}


// PAYMENT Method
$title = JText::_('COM_PHOCACART_SELECT_PAYMENT_METHOD');
if ($this->t['paymentmethodexists']) {
	$payment = $this->cart->getPaymentMethod();
	if (isset($payment['title']) &&
$payment['title'] != '') {
		$title = $payment['title'];
	}
}

if ($this->t['pos_payment_force'] == 0) {
	echo '<form class="form-inline"
action="'.$this->t['action'].'"
method="post">';
	echo '<input type="hidden" name="format"
value="raw">';
	echo '<input type="hidden" name="page"
value="main.content.paymentmethods">';
	echo '<input type="hidden" name="tmpl"
value="component" />';
	echo '<input type="hidden" name="option"
value="com_phocacart" />';
	echo '<input type="hidden" name="ticketid"
value="'.(int)$this->t['ticket']->id.'"
/>';
	echo '<input type="hidden" name="unitid"
value="'.(int)$this->t['unit']->id.'"
/>';
	echo '<input type="hidden" name="sectionid"
value="'.(int)$this->t['section']->id.'"
/>';
	echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
	echo '<button
class="'.$this->s['c']['btn.btn-primary'].'
loadMainContent"><span
class="'.$this->s['i']['payment-method'].'
icon-white"></span>
&nbsp;'.$title.'</button>';
	echo '</form>';
} else {
	echo '<div><button
class="'.$this->s['c']['btn.btn-primary'].'"><span
class="'.$this->s['i']['payment-method'].'
icon-white"></span>
&nbsp;'.$title.'</button></div>';
}


// PAYMENT
echo '<form class="form-inline"
action="'.$this->t['action'].'"
method="post">';
echo '<input type="hidden" name="format"
value="raw">';
echo '<input type="hidden" name="page"
value="main.content.payment">';
echo '<input type="hidden" name="tmpl"
value="component" />';
echo '<input type="hidden" name="option"
value="com_phocacart" />';
echo '<input type="hidden" name="ticketid"
value="'.(int)$this->t['ticket']->id.'"
/>';
echo '<input type="hidden" name="unitid"
value="'.(int)$this->t['unit']->id.'"
/>';
echo '<input type="hidden" name="sectionid"
value="'.(int)$this->t['section']->id.'"
/>';
echo Joomla\CMS\HTML\HTMLHelper::_('form.token');

//if (!$this->t['paymentexists']) {
echo '<button
class="'.$this->s['c']['btn.btn-success.btn-lg'].'
loadMainContent">'.JText::_('COM_PHOCACART_PAYMENT').'</button>';
//} else {
//	echo '<button class="btn btn-success btn-lg
loadMainContent">'.$this->t['user']->name.'</button>';
//}
echo '</form>';
?>
views/pos/tmpl/default_main_top.php000064400000005342151167552070013516
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();


echo
PhocacartTicket::renderNavigation($this->t['vendor']->id,
$this->t['ticket']->id,
$this->t['unit']->id,
$this->t['section']->id);
echo
PhocacartSection::renderTitleAndBackButton($this->t['section']->id,
$this->t['unit']->id);

echo '<div class="ph-add-remove-tickets">';
echo '<form id="phPosAddTicketForm"
class="form-inline" style="display:inline"
action="'.$this->t['action'].'"
method="post">';

echo '<button
class="'.$this->s['c']['btn.btn-success'].'
ph-pos-btn-ticket" /><span
class="'.$this->s['i']['plus'].'
icon-white"></span></button>';
echo '<input type="hidden" name="task"
value="pos.addticket">';
echo '<input type="hidden" name="unitid"
value="'.(int)$this->t['unit']->id.'">';
echo '<input type="hidden" name="sectionid"
value="'.(int)$this->t['section']->id.'">';
echo '<input type="hidden" name="tmpl"
value="component" />';
echo '<input type="hidden" name="option"
value="com_phocacart" />';
echo '<input type="hidden" name="return"
value="'.$this->t['actionbase64'].'"
/>';
echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
echo '</form>';

$msg = JText::_('COM_PHOCACART_TICKET_NR') . ':
<b>'.(int)$this->t['ticket']->id .
'</b><br />'
	. JText::_('COM_PHOCACART_WARNING_CLOSE_CURRENT_TICKET') .
'<br />'
	. '<span
class="ph-warning">'.JText::_('COM_PHOCACART_WARNING_CART_WILL_BE_CLOSED_ALL_DATA_WILL_BE_REMOVED')
. '</span>';

echo '<form id="phPosCloseTicketForm"
class="form-inline" style="display:inline"
action="'.$this->t['action'].'"
method="post"
data-txt="'.htmlspecialchars($msg).'">';
echo '<button
class="'.$this->s['c']['btn.btn-danger'].'
ph-pos-btn-ticket" ><span
class="'.$this->s['i']['minus'].'
icon-white"></span></button>';
echo '<input type="hidden" name="task"
value="pos.removeticket">';
echo '<input type="hidden" name="ticketid"
value="'.(int)$this->t['ticket']->id.'">';
echo '<input type="hidden" name="unitid"
value="'.(int)$this->t['unit']->id.'">';
echo '<input type="hidden" name="sectionid"
value="'.(int)$this->t['section']->id.'">';
echo '<input type="hidden" name="tmpl"
value="component" />';
echo '<input type="hidden" name="option"
value="com_phocacart" />';
echo '<input type="hidden" name="return"
value="'.$this->t['actionbase64'].'"
/>';
echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
echo '</form>';

echo '</div>';// end ph-add-remove-tickets


echo $this->loadTemplate('vendor');
echo $this->loadTemplate('logo');
?>
views/pos/tmpl/default_pagination.php000064400000005577151167552070014053
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$this->t['action'] = str_replace('&amp;',
'&', $this->t['action']);
$this->t['action'] =
htmlspecialchars($this->t['action']);


echo '<div class="ph-cb"></div>';


echo '<form
action="'.$this->t['action'].'"
method="post" name="adminForm"
id="phPosPaginationBox">'. "\n";

if (!empty($this->items)) {

	echo '<div
class="'.$this->s['c']['row'].'
ph-pagination">';
	//if ($this->p->get('show_pagination')) {
	$col = 12;
	//if ($this->p->get('display_item_ordering')) {
		$col = 7;
		echo '<div
class="'.$this->s['c']["col.xs12.sm{$col}.md{$col}"].'
ph-center-pagination">';
		echo JText::_('COM_PHOCACART_ORDER_FRONT')
.':&nbsp;'. str_replace(
'class="inputbox"',
'class="'.$this->s['c']['inputbox'].'
'.$this->s['c']['form-control'].'
chosen-select" style="width: 16em"',
$this->t['ordering']);
		echo '</div>';
	//}

	//if ($this->p->get('show_pagination_limit')) {
		$col = 5;
		echo '<div
class="'.$this->s['c']["col.xs12.sm{$col}.md{$col}"].'
ph-center-pagination">';
		echo JText::_('COM_PHOCACART_DISPLAY_NUM')
.':&nbsp;' . str_replace(
'class="inputbox"',
'class="'.$this->s['c']['inputbox'].'
'.$this->s['c']['form-control'].'
chosen-select"',
$this->t['pagination']->getLimitBox(1));
		echo '</div>';
	//}

	echo '<div class="ph-cb"></div>';
	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-center-pagination pagination  phPaginationBox">'.
str_replace( 'class="inputbox"',
'class="'.$this->s['c']['inputbox'].'
'.$this->s['c']['form-control'].'
chosen-select"',
$this->t['pagination']->getPagesLinks()) .
'</div>';

	echo '<div class="ph-cb"></div>';

	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-center-pagination ph-pagination-mt pagination">';
	echo str_replace( 'class="inputbox"',
'class="'.$this->s['c']['inputbox'].'
'.$this->s['c']['form-control'].'
chosen-select"',
$this->t['pagination']->getPagesCounter());
	echo '</div>';

	echo '<div class="ph-cb"></div>';
	//}
	echo '</div>';
}

//if ($this->p->get('ajax_pagination_category', 0) == 1) {
	echo '<input type="hidden" name="format"
value="raw" />';
	echo '<input type="hidden" name="page"
value="'.$this->t['page'].'" />';
	echo '<input type="hidden" name="ticketid"
value="'.$this->t['ticket']->id.'"
/>';
	echo '<input type="hidden" name="unitid"
value="'.$this->t['unit']->id.'"
/>';
	echo '<input type="hidden" name="sectionid"
value="'.$this->t['section']->id.'"
/>';
	echo '<input type="hidden" name="date"
value="'.$this->state->get('date').'"
/>';
//}

echo Joomla\CMS\HTML\HTMLHelper::_( 'form.token' );
echo '</form>';

?>
views/pos/tmpl/default_section.php000064400000007234151167552070013356
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

echo '<div id="ph-pc-pos-site">';

// TOP
echo '<div class="ph-pos-wrap-top">';
echo $this->loadTemplate('section_top');
echo '</div>';

echo '<div class="ph-pos-wrap-main">';

echo '<div class="ph-pos-main-page">';

// SECTIONS
echo '<div id="phSections"
class="ph-sections">';
echo '<div class="row ">';
if (!empty($this->items)) {

	foreach ($this->items as $k => $v) {

		echo '<div class="ph-unit
ph-unit-id-'.(int)$v['id'].'">';
		$linkEdit = PhocacartRoute::getPosRoute(1, (int)$v['id'],
$this->t['section']->id);
		echo '<div class="ph-pos-section-unit-box"><a
class="btn btn-default btn-unit"
href="'.$linkEdit.'">'.$v['title'].'</a>';
		if (!empty($v['tickets'])) {

			echo '<div
class="ph-pos-section-ticket-box">';
			foreach ($v['tickets'] as $k2 => $v2) {
				if ($v2['id'] > 0) {

					$linkEditTicket =
PhocacartRoute::getPosRoute((int)$v2['id'],
(int)$v['unit_id'], (int)$v['section_id']);
					$uO = '';
					$uOClass = '';
					$uOClass = 'ph-pos-ticket-false';
					$uCount = 0;
					if (!empty($v2['cart'])) {
						$cart = unserialize($v2['cart']);
						if (!empty($cart)) {
							$count = 0;
							foreach($cart as $k3 => $v3) {
								if (isset($v3['quantity'])) {
									$count = $count + $v3['quantity'];
								}
							}
							$uOClass = 'ph-pos-ticket-true';
							$uCount = $count;
							if ($count == 1) {
								$uO .= '('.$count.'
'.JText::_('COM_PHOCACART_ITEM').')';
							} else if ($count > 1) {
								$uO .= '('.$count.'
'.JText::_('COM_PHOCACART_ITEMS').')';
							} else {
								$uOClass = 'ph-pos-ticket-false';
							}


						}
					}
					echo '<a class="btn btn-ticket
'.$uOClass.'" href="'.$linkEditTicket.'"
title="'.$uO.'">'.(int)$v2['id'].'<span
class="ph-pos-ticket-count
'.$uOClass.'">'.$uCount.'</span></a>';

				}
			}
			echo '</div>';
		}
		echo '</div>';


		echo '</div>';
	}

} else {
	echo
'<div>'.JText::_('COM_PHOCACART_NO_UNIT_FOUND').'</div>';
}

echo '</div>'; // end row
echo '</div>'; // end ph-sections

echo '<div class="ph-pos-hr"></div>';

// SELECT THIS SECTION
echo '<div class="ph-section">';
echo '<div class="row ">';

$linkEdit = PhocacartRoute::getPosRoute(1, 0,
$this->t['section']->id);

echo '<div class="ph-unit-section">';
echo '<a class="btn btn-success"
href="'.$linkEdit.'">'.JText::_('COM_PHOCACART_SELECT_THIS_SECTION').'</a>';
echo '</div>';

echo '</div>';// end row
echo '</div>';// end ph-section


// Dummy form for javascript which needs the form input values (like
current sectionid) - to change the url bar when reseted
echo '<form
action="'.$this->t['action'].'"
method="post" name="adminForm"
id="phPosPaginationBox">'. "\n";
echo '<input type="hidden" name="format"
value="raw" />';
echo '<input type="hidden" name="page"
value="'.$this->t['page'].'" />';
echo '<input type="hidden" name="ticketid"
value="'.$this->t['ticket']->id.'"
/>';
echo '<input type="hidden" name="unitid"
value="'.$this->t['unit']->id.'"
/>';
echo '<input type="hidden" name="sectionid"
value="'.$this->t['section']->id.'"
/>';
echo Joomla\CMS\HTML\HTMLHelper::_( 'form.token' );
echo '</form>';

echo '</div>';// end ph-pos-main-page

echo '</div>';// end ph-pos-wrap-main

echo '<div class="ph-pos-wrap-bottom">';
echo $this->loadTemplate('bottom');
echo '</div>';

echo '</div>';
?>
views/pos/tmpl/default_section_top.php000064400000001133151167552070014230
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

echo
PhocacartSection::renderNavigation($this->t['section']->id);	
echo '<div
class="ph-link-sections">&nbsp;</div>';
echo '<div
class="ph-add-remove-tickets">&nbsp;</div>';
echo $this->loadTemplate('vendor');
echo $this->loadTemplate('logo');
?>views/pos/tmpl/default_vendor.php000064400000005612151167552070013205
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

echo '<div class="ph-pos-vendor-title">';

echo '<div class="dropdown">';

echo '<button
class="'.$this->s['c']['btn.btn-info'].'
dropdown-toggle" type="button"
id="phdropdownMenuButton" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">';
if (isset($this->t['vendor']->image) &&
$this->t['vendor']->image != '') {
	echo '<div class="ph-img-inside-btn">' .
PhocacartImage::getImage($this->t['vendor']->image) .
'</div>';
}
echo $this->t['vendor']->name;
echo '</button>';


echo '<div class="dropdown-menu ph-vendor-dropdown"
aria-labelledby="phdropdownMenuButton">';
//echo '<a class="dropdown-item btn btn-danger
ph-pos-btn-dropdown" href="#">';

// CURRNECY
echo '<div
class="ph-dropdown-header">'.JText::_('COM_PHOCACART_CURRENCY').'</div>';
echo $this->loadTemplate('currency');


// ORDERS
echo '<div
class="ph-dropdown-header">'.JText::_('COM_PHOCACART_ORDERS').'</div>';
echo '<form
action="'.$this->t['action'].'"
method="post">';
//echo '<input type="hidden" name="limitstart"
value="0" />';//We use more pages, reset for new date,
new customer, new products
//echo '<input type="hidden" name="start"
value="0" />';
echo '<input type="hidden" name="page"
value="main.content.orders">';
echo '<input type="hidden" name="tmpl"
value="component" />';
echo '<input type="hidden" name="option"
value="com_phocacart" />';
echo '<input type="hidden" name="ticketid"
value="'.(int)$this->t['ticket']->id.'"
/>';
echo '<input type="hidden" name="unitid"
value="'.(int)$this->t['unit']->id.'"
/>';
echo '<input type="hidden" name="sectionid"
value="'.(int)$this->t['section']->id.'"
/>';
echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
echo '<button
class="'.$this->s['c']['btn.btn-primary'].'
loadMainContent ph-pos-btn-dropdown"><span
class="'.$this->s['i']['shopping-cart'].'
icon-white"></span>
&nbsp;'.JText::_('COM_PHOCACART_ORDERS').'</button>';
echo '</form>';


// LOGOUT
echo '<div
class="ph-dropdown-header">'.JText::_('COM_PHOCACART_LOGOUT').'</div>';
echo '<form action="'.
JRoute::_('index.php?option=com_users&task=user.logout').'"
method="post">';
echo '<button type="submit"
class="'.$this->s['c']['btn.btn-danger'].'
 ph-pos-btn-dropdown"><span
class="'.$this->s['i']['log-out'].'
icon-white"></span>
'.JText::_('JLOGOUT').'</button>';
echo '<input type="hidden" name="return"
value="'.
base64_encode(PhocacartRoute::getPosRoute()).'" />';
echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
echo '</form>';

echo '</div>';// end dropdown-menu
echo '</div>';// end dropdown

echo '</div>';// end ph-pos-vendor-title
?>
views/pos/tmpl/index.html000064400000000054151167552070011463
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/pos/view.html.php000064400000035634151167552070011154
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');
jimport( 'joomla.filesystem.folder' );
jimport( 'joomla.filesystem.file' );

class PhocaCartViewPos extends JViewLegacy
{
	protected $category;
	protected $subcategories;
	protected $items;
	protected $t;
	protected $r;
	protected $p;
	protected $s;
	protected $cart;

	function display($tpl = null) {

		$app						= JFactory::getApplication();
		$document					= JFactory::getDocument();
		$this->p 					= $app->getParams();
		$this->s					= PhocacartRenderStyle::getStyles();
		$uri 						= \Joomla\CMS\Uri\Uri::getInstance();
		$model						= $this->getModel();
		$this->state				= $this->get('State');
		$this->t['action']			= $uri->toString();
		$this->t['actionbase64']	=
base64_encode($this->t['action']);


		// INPUTS
		$this->t['id']				= $app->input->get( 'id',
0, 'int' );
		//$this->t['categoryid']		= $app->input->get(
'id', 0, 'int' );// optional
		$this->t['limitstart']		= $app->input->get(
'limitstart', 0, 'int' );
		$this->t['search']			= $app->input->get(
'search', '', 'string' );
		$this->t['sku']				= $app->input->get(
'sku', '', 'string' );//sku, ean, isbn, jan,
...
		$this->t['card']			= $app->input->get(
'card', '', 'string' );// loyalty customer
card
		$this->t['page']			= $app->input->get(
'page', 'main.content.products', 'string' );
		$this->t['category']		=
$app->input->get('category', '',
'string');// list of active categories


		$this->t['linkcheckout']	=
JRoute::_(PhocacartRoute::getCheckoutRoute(0));
		$this->t['limitstarturl'] 	=
$this->t['limitstart'] > 0 ?
'&start='.$this->t['limitstart'] :
'';

		$this->t['currency_array']	=
PhocacartCurrency::getCurrenciesArray();
		$this->t['price'] 			= new PhocacartPrice();
		$this->t['categoryarray']	= explode(',',
$this->t['category']);
		$this->t['ajax'] 			= 0;
		$this->t['shippingedit'] 	= 0;
		$this->t['paymentedit'] 	= 0;

		$preferredSku = PhocacartPos::getPreferredSku();
		$this->t['skutype']		= $preferredSku['name'];
		$this->t['skutypetxt']	= $preferredSku['title'];

		$this->t['user'] 	= array();
		$this->t['vendor']	= array();
		$this->t['ticket']	= array();
		$this->t['unit']	= array();
		$this->t['section']	= array();
		$dUser 				= PhocacartUser::defineUser($this->t['user'],
$this->t['vendor'], $this->t['ticket'],
$this->t['unit'], $this->t['section']);

		// 1) CHECK - VENDOR LOGGED IN
		if (!isset($this->t['vendor']->id) ||
(isset($this->t['vendor']->id) &&
(int)$this->t['vendor']->id < 1 )) {
			//$this->t['infotext'] =
JText::_('COM_PHOCACART_PLEASE_LOGIN_ACCESS_POS');
			//$this->t['infotype'] = 'alert-error
alert-danger';
			//parent::display('info');

			$returnUrl  						=
'index.php?option=com_users&view=login&return='.$this->t['actionbase64'];
			$app->redirect(JRoute::_($returnUrl, false),
JText::_('COM_PHOCACART_PLEASE_LOGIN_ACCESS_POS'));
			return;

		}

		// PARAMS
		$this->t['display_new']				= $this->p->get(
'display_new', 0 );
		$this->t['cart_metakey'] 			= $this->p->get(
'cart_metakey', '' );
		$this->t['cart_metadesc'] 			= $this->p->get(
'cart_metadesc', '' );
		$this->t['image_width_cat']			= $this->p->get(
'image_width_cat', '' );
		$this->t['image_height_cat']		= $this->p->get(
'image_height_cat', '' );
		$this->t['columns_pos']				= $this->p->get(
'columns_pos', 6 );
		$this->t['display_addtocart_icon']	= $this->p->get(
'display_addtocart_icon', 0 );
		$this->t['category_addtocart']		= $this->p->get(
'category_addtocart', 1 );
		$this->t['dynamic_change_image']	= $this->p->get(
'dynamic_change_image', 0);
		$this->t['dynamic_change_price']	= $this->p->get(
'dynamic_change_price', 0 );
		$this->t['dynamic_change_stock']	= $this->p->get(
'dynamic_change_stock', 0 );
		$this->t['dynamic_change_id']	   	= $this->p->get(
'dynamic_change_id', 0 );
		$this->t['display_price']			= true;//$this->p->get(
'hide_price', 0 );
		$this->t['display_addtocart']		= true;//$this->p->get(
'hide_addtocart', 0 );
		$this->t['can_display_price']		= true;
		$this->t['hide_add_to_cart_stock']	= $this->p->get(
'hide_add_to_cart_stock', 0 );
		$this->t['display_star_rating']		= $this->p->get(
'display_star_rating', 0 );
		$this->t['add_cart_method']			= $this->p->get(
'add_cart_method', 0 );
		$this->t['pos_hide_attributes']		= $this->p->get(
'pos_hide_attributes', 1 );
		$this->t['pos_display_stock_status']= $this->p->get(
'pos_display_stock_status', 0 );
		$this->t['pos_payment_force']		= $this->p->get(
'pos_payment_force', 0 );
		$this->t['pos_shipping_force']		= $this->p->get(
'pos_shipping_force', 0 );
		$this->t['pos_input_autocomplete']	= $this->p->get(
'pos_input_autocomplete', 0 );
		$this->t['pos_sku_input_type']		= $this->p->get(
'pos_sku_input_type', 'text' );
		$this->t['pos_input_type']			= $this->p->get(
'pos_input_type', 'text' );
		$this->t['display_shipping_desc']	= $this->p->get(
'display_shipping_desc', 0 );
		$this->t['display_payment_desc']	= $this->p->get(
'display_payment_desc', 0 );
		$this->t['zero_shipping_price']		= $this->p->get(
'zero_shipping_price', 1 );
		$this->t['zero_payment_price']		= $this->p->get(
'zero_payment_price', 1 );
        $this->t['zero_attribute_price']	=
$this->p->get( 'zero_attribute_price', 1 );
		$this->t['enable_coupons']			= $this->p->get(
'enable_coupons', 2 );
		$this->t['enable_rewards']			= $this->p->get(
'enable_rewards', 1 );

		$this->t['display_view_product_button']				=
$this->p->get( 'display_view_product_button', 1 );
		$this->t['product_name_link']						= $this->p->get(
'product_name_link', 0 );
		$this->t['switch_image_category_items']				=
$this->p->get( 'switch_image_category_items', 0 );
		$this->t['pos_loyalty_card_number_input_type']		=
$this->p->get( 'pos_loyalty_card_number_input_type',
'text' );

		$this->t['lazy_load_category_items']	= $this->p->get(
'lazy_load_category_items', 0 );
		$this->t['medium_image_width']			= $this->p->get(
'medium_image_width', 300 );
		$this->t['medium_image_height']			= $this->p->get(
'medium_image_height', 200 );
		$this->t['display_webp_images']			= $this->p->get(
'display_webp_images', 0 );


		$this->t['pos_input_autocomplete_output'] = '';
		if ($this->t['pos_input_autocomplete'] == 0) {
			$this->t['pos_input_autocomplete_output'] = '
autocomplete="off" ';
		}

		if ((int)$this->t['pos_payment_force'] > 0) {
			$this->t['pos_payment_force'] =
PhocacartPayment::isPaymentMethodActive($this->t['pos_payment_force'])
=== true ? (int)$this->t['pos_payment_force'] : 0;
		}
		if ((int)$this->t['pos_shipping_force'] > 0) {
			$this->t['pos_shipping_force'] =
PhocacartShipping::isShippingMethodActive($this->t['pos_shipping_force'])
=== true ? (int)$this->t['pos_shipping_force'] : 0;
		}




		// CATEGORIES
		$this->t['categories'] =
PhocacartCategoryMultiple::getAllCategories(1, array(0,2));

		// LAYOUT
		PhocacartPos::renderPosPage();// render the page (boxes)

		// MEDIA
		$media = PhocacartRenderMedia::getInstance('main');
		$media->loadBase();
		$media->loadBootstrap();
		$media->loadChosen();
		//$this->t['class-row-flex'] 	=
$media->loadEqualHeights();
		$this->t['class_thumbnail'] = 'ph-pos-thumbnail';

		PhocacartRenderJs::renderAjaxAddToCart();
		PhocacartRenderJs::renderAjaxUpdateCart();
		// Moved to JS
PhocacartRenderJs::renderSubmitPaginationTopForm($this->t['action'],
'#phPosContentBox');

		//- PhocacartRenderJspos::managePos($this->t['action']);
		//- PhocacartRenderJspos::printPos(JRoute::_(
'index.php?option=com_phocacart&view=order&tmpl=component&format=raw'));
		//- PhocacartRenderJspos::searchPosByType('#phPosSearch');
		//- PhocacartRenderJspos::searchPosByCategory();

		// Tendered
		//$currency = PhocacartCurrency::getCurrency(); - loaded before filter
		//PhocacartRenderJs::getPriceFormatJavascript($currency->price_decimals,
$currency->price_dec_symbol, $currency->price_thousands_sep,
$currency->price_currency_symbol, $currency->price_prefix,
$currency->price_suffix, $currency->price_format);


		$media->loadPhocaAttribute(1);
		if ($this->t['pos_hide_attributes'] == 0) {
			$media->loadPhocaAttributeRequired(1); // Some of the attribute can
be required and can be a image checkbox
		}

		/*if ($this->t['dynamic_change_price'] == 1) {
			// items == category -> this is why items has class:
ph-category-price-box (to have the same styling)
			PhocacartRenderJs::renderAjaxChangeProductPriceByOptions(0,
'Pos', 'ph-category-price-box');// We need to load it
here
		}
		if ($this->t['dynamic_change_stock'] == 1) {
			PhocacartRenderJs::renderAjaxChangeProductStockByOptions(0,
'Pos', 'ph-item-stock-box');
		}*/

		/*if ($this->t['dynamic_change_id'] == 1 ||
$this->t['dynamic_change_price'] == 1 ||
$this->t['dynamic_change_stock'] == 1) {
			PhocacartRenderJs::renderAjaxChangeProductDataByOptions(0,
'Pos', 'ph-item-data-box');
		}*/



		// 2) CHECK TICKET
		if ((int)$this->t['ticket']->id < 1) {
			$this->t['infotext'] =
JText::_('COM_PHOCACART_TICKET_DOES_NOT_EXIST');
			$this->t['infotype'] = 'alert-error
alert-danger';
			parent::display('info');
			return true;

		}

		// 3) CHECK - SECTION EXISTS (if the asked not found, set the first
existing)
		if (isset($this->t['section']->id)) {
			// Set in PhocacartUser::defineUser() ->
PhocacartTicket::getTicket()
		} else {
			$this->t['section']->id = 0;
		}

		// 4) CHECK - UNIT EXISTS (if the asked not found, set the first existing
but by the section
		if (isset($this->t['unit']->id)) {
			// Set in PhocacartUser::defineUser() ->
PhocacartTicket::getTicket()
		} else {
			$this->t['unit']->id = 0;
		}

		$this->t['linkpos']				=
JRoute::_(PhocacartRoute::getPosRoute($this->t['ticket']->id,
$this->t['unit']->id,
$this->t['section']->id));


		// 5) CHECK - USER
		$this->t['userexists'] 			= false;
		$this->t['anonymoususerexists'] = false;
		if (isset($this->t['user']->id) &&
(int)$this->t['user']->id &&
isset($this->t['user']->name)) {
			$this->t['userexists'] = true;
		} else {
			// Try to find anonymous user (only loyalty card number added - which is
not stored in our database
			// such can be used for different features without having it stored in
our database
			$this->t['loyalty_card_number'] =
PhocacartPos::getCardByVendorAndTicket($this->t['vendor']->id,
$this->t['ticket']->id,
$this->t['unit']->id,
$this->t['section']->id, 0);
			if ($this->t['loyalty_card_number'] != '') {
				$this->t['anonymoususerexists'] = true;
			}
		}

		$this->t['shippingmethodexists'] 	= false;
		$this->t['paymentmethodexists'] 	= false;

		// CART
		$this->cart	= new PhocacartCartRendercheckout();
		$this->cart->setType(array(0,2));
		$this->cart->setFullItems();
		$this->t['shippingid'] 	=
$this->cart->getShippingId();

		if (isset($this->t['shippingid']) &&
(int)$this->t['shippingid'] > 0 &&
$this->t['shippingedit'] == 0) {
			$this->cart->addShippingCosts($this->t['shippingid']);
			$this->t['shippingmethodexists'] = true;
		}
		$this->t['paymentid'] 	= $this->cart->getPaymentId();
		if (isset($this->t['paymentid']) &&
(int)$this->t['paymentid'] > 0 &&
$this->t['paymentedit'] == 0) {
			$this->cart->addPaymentCosts($this->t['paymentid']);//
validity of payment will be checked
			$this->t['paymentmethodexists'] = true;
		}

		$this->cart->roundTotalAmount();
		$this->t['total']		= $this->cart->getTotal();

		//$this->t['paymentexists'] 	= false;
		//$this->t['plugin-pdf']		=
PhocacartUtilsExtension::getExtensionInfo('phocacart',
'plugin', 'phocapdf');
		//$this->t['component-pdf']		=
PhocacartUtilsExtension::getExtensionInfo('com_phocapdf');


		$this->items						=
$model->getItemList($this->t['user']->id,
$this->t['vendor']->id,
$this->t['ticket']->id,
$this->t['unit']->id,
$this->t['section']->id);
		$this->t['pagination']				= $model->getPagination();
		$this->t['ordering']				= $model->getOrdering();

		$this->_prepareDocument();
		$this->t['pathcat'] =
PhocacartPath::getPath('categoryimage');
		$this->t['pathitem'] =
PhocacartPath::getPath('productimage');


		switch ($this->t['page']) {

			case 'section':

				// Prepare units (in fact we asked for tickets because of ticket
information
				// and we need to sort them to units
				$sortedItems = array();
				if (!empty($this->items)) {

					foreach($this->items as $k => $v) {
						$id = $v->id;
						$sortedItems[$id]['id'] 				= $v->id;
						$sortedItems[$id]['user_id'] 			= $v->user_id;
						$sortedItems[$id]['vendor_id'] 			= $v->vendor_id;
						//$sortedItems[$id]['ticket_id'] 			= $v->ticket_id;
						$sortedItems[$id]['unit_id'] 			= $v->unit_id;
						$sortedItems[$id]['section_id'] 		= $v->section_id;
						$sortedItems[$id]['title'] 				= $v->title;
						$sortedItems[$id]['tickets'][$k]['cart']=
$v->cart;
						$sortedItems[$id]['tickets'][$k]['id'] 	=
$v->ticket_id;
					}
				}
				$this->items = $sortedItems;

				// Change the url bar (only to not confuse when the ticketid will be
changed to existing from not existing)
				$changeUrlParameter = array("sectionid" =>
(int)$this->t['section']->id);

				if (!empty($changeUrlParameter)) {
					$s[] = 'jQuery(document).ready(function(){';
					foreach($changeUrlParameter as $k => $v) {
						$s[] = '   phUpdateUrlParameter("'.$k.'",
'.(int)$v.');';
					}
					$s[] = '})';
					$s[] = ' ';
					JFactory::getDocument()->addScriptDeclaration(implode("\n",
$s));
				}

				parent::display('section');
			break;

			default:

				// Scroll cart to bottom
			/*	PhocacartRenderJspos::renderJsScrollToPos();
				// Change the url bar (only to not confuse when the ticketid will be
changed to existing from not existing)
				PhocacartRenderJspos::changeUrlParameter( array(
				"ticketid" =>
(int)$this->t['ticket']->id,
				"unitid" => (int)$this->t['unit']->id,
				"sectionid" =>
(int)$this->t['section']->id));*/

				// Change the url bar (only to not confuse when the ticketid will be
changed to existing from not existing)
				$changeUrlParameter = array(
				"ticketid" =>
(int)$this->t['ticket']->id,
				"unitid" => (int)$this->t['unit']->id,
				"sectionid" =>
(int)$this->t['section']->id);

				if (!empty($changeUrlParameter)) {
					$s[] = 'jQuery(document).ready(function(){';
					foreach($changeUrlParameter as $k => $v) {
						$s[] = '   phUpdateUrlParameter("'.$k.'",
'.(int)$v.');';
					}
					$s[] = '})';
					$s[] = ' ';
					JFactory::getDocument()->addScriptDeclaration(implode("\n",
$s));
				}

				parent::display($tpl);
			break;
		}
	}


	protected function _prepareDocument() {
		$category = false;
		if (isset($this->category[0]) &&
is_object($this->category[0])) {
			$category = $this->category[0];
		}
		PhocacartRenderFront::prepareDocument($this->document, $this->p,
$category);
	}
}
?>
views/pos/view.json.php000064400000001146151167552070011150
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');
jimport( 'joomla.filesystem.folder' );
jimport( 'joomla.filesystem.file' );

class PhocaCartViewPos extends JViewLegacy
{
	function display($tpl = null) {

		// DEBUG
		//debug_print_backtrace();
	}
}
?>
views/pos/view.raw.php000064400000033136151167552070010774
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');
jimport( 'joomla.filesystem.folder' );
jimport( 'joomla.filesystem.file' );

class PhocaCartViewPos extends JViewLegacy
{
	protected $category;
	protected $subcategories;
	protected $items;
	protected $t;
	protected $r;
	protected $p;
	protected $s;
	protected $cart;

	function display($tpl = null) {

		$app						= JFactory::getApplication();
		$document					= JFactory::getDocument();
		$this->p 					= $app->getParams();
		$this->s					= PhocacartRenderStyle::getStyles();
		$uri 						= \Joomla\CMS\Uri\Uri::getInstance();
		$model						= $this->getModel();
		$this->state				= $this->get('State');
		$this->t['action']			= $uri->toString();
		$this->t['actionbase64']	=
base64_encode($this->t['action']);


		// INPUTS
		$this->t['id']				= $app->input->get( 'id',
0, 'int' );
		//$this->t['categoryid']		= $app->input->get(
'id', 0, 'int' );// optional
		$this->t['limitstart']		= $app->input->get(
'limitstart', 0, 'int' );
		$this->t['search']			= $app->input->get(
'search', '', 'string' );
		$this->t['sku']				= $app->input->get(
'sku', '', 'string' );//sku, ean, isbn, jan,
...
		$this->t['card']			= $app->input->get(
'card', '', 'string' );// loyalty customer
card
		$this->t['page']			= $app->input->get(
'page', 'main.content.products', 'string' );
		$this->t['category']		=
$app->input->get('category', '',
'string');// list of active categories



		$this->t['linkcheckout']	=
JRoute::_(PhocacartRoute::getCheckoutRoute(0));
		$this->t['limitstarturl'] 	=
$this->t['limitstart'] > 0 ?
'&start='.$this->t['limitstart'] :
'';

		$this->t['currency_array']		=
PhocacartCurrency::getCurrenciesArray();
		$this->t['price'] 				= new PhocacartPrice();
		$this->t['categoryarray']	= explode(',',
$this->t['category']);
		$this->t['ajax'] 			= 1;
		$this->t['shippingedit'] 	= 0;
		$this->t['paymentedit'] 	= 0;

		$preferredSku = PhocacartPos::getPreferredSku();
		$this->t['skutype']		= $preferredSku['name'];
		$this->t['skutypetxt']	= $preferredSku['title'];

		$this->t['user'] 	= array();
		$this->t['vendor']	= array();
		$this->t['ticket']	= array();
		$this->t['unit']	= array();
		$this->t['section']	= array();
		$dUser 				= PhocacartUser::defineUser($this->t['user'],
$this->t['vendor'], $this->t['ticket'],
$this->t['unit'], $this->t['section']);




		// 1) CHECK - VENDOR LOGGED IN
		if (!isset($this->t['vendor']->id) ||
(isset($this->t['vendor']->id) &&
(int)$this->t['vendor']->id < 1 )) {
			echo '<div class="alert alert-error
alert-danger">'.JText::_('COM_PHOCACART_PLEASE_LOGIN_ACCESS_POS').
'</div>';
			exit;
		}



		// PARAMS
		$this->t['display_new']				= $this->p->get(
'display_new', 0 );
		$this->t['cart_metakey'] 			= $this->p->get(
'cart_metakey', '' );
		$this->t['cart_metadesc'] 			= $this->p->get(
'cart_metadesc', '' );
		$this->t['image_width_cat']			= $this->p->get(
'image_width_cat', '' );
		$this->t['image_height_cat']		= $this->p->get(
'image_height_cat', '' );
		$this->t['columns_pos']				= $this->p->get(
'columns_pos', 6 );
		$this->t['display_addtocart_icon']	= $this->p->get(
'display_addtocart_icon', 0 );
		$this->t['category_addtocart']		= $this->p->get(
'category_addtocart', 1 );
		$this->t['dynamic_change_image']	= $this->p->get(
'dynamic_change_image', 0);
		$this->t['dynamic_change_price']	= $this->p->get(
'dynamic_change_price', 0 );
		$this->t['dynamic_change_stock']	= $this->p->get(
'dynamic_change_stock', 0 );
		$this->t['display_price']			= true;//$this->p->get(
'hide_price', 0 );
		$this->t['display_addtocart']		= true;//$this->p->get(
'hide_addtocart', 0 );
		$this->t['can_display_price']		= true;
		$this->t['hide_add_to_cart_stock']	= $this->p->get(
'hide_add_to_cart_stock', 0 );
		$this->t['display_star_rating']		= $this->p->get(
'display_star_rating', 0 );
		$this->t['add_cart_method']			= $this->p->get(
'add_cart_method', 0 );
		$this->t['pos_hide_attributes']		= $this->p->get(
'pos_hide_attributes', 1 );
		$this->t['pos_display_stock_status']= $this->p->get(
'pos_display_stock_status', 0 );
		$this->t['pos_payment_force']		= $this->p->get(
'pos_payment_force', 0 );
		$this->t['pos_shipping_force']		= $this->p->get(
'pos_shipping_force', 0 );
		$this->t['pos_input_autocomplete']	= $this->p->get(
'pos_input_autocomplete', 0 );
		$this->t['pos_sku_input_type']		= $this->p->get(
'pos_sku_input_type', 'text' );
		$this->t['pos_input_type']			= $this->p->get(
'pos_input_type', 'text' );
		$this->t['display_shipping_desc']	= $this->p->get(
'display_shipping_desc', 0 );
		$this->t['display_payment_desc']	= $this->p->get(
'display_payment_desc', 0 );
		$this->t['zero_shipping_price']		= $this->p->get(
'zero_shipping_price', 1 );
		$this->t['zero_payment_price']		= $this->p->get(
'zero_payment_price', 1 );
        $this->t['zero_attribute_price']	=
$this->p->get( 'zero_attribute_price', 1 );
		$this->t['enable_coupons']			= $this->p->get(
'enable_coupons', 2 );
		$this->t['enable_rewards']			= $this->p->get(
'enable_rewards', 1 );

		$this->t['display_view_product_button']				=
$this->p->get( 'display_view_product_button', 1 );
		$this->t['product_name_link']						= $this->p->get(
'product_name_link', 0 );
		$this->t['switch_image_category_items']				=
$this->p->get( 'switch_image_category_items', 0 );
		$this->t['pos_loyalty_card_number_input_type']		=
$this->p->get( 'pos_loyalty_card_number_input_type',
'text' );

		$this->t['lazy_load_category_items']	= $this->p->get(
'lazy_load_category_items', 0 );
		$this->t['medium_image_width']			= $this->p->get(
'medium_image_width', 300 );
		$this->t['medium_image_height']			= $this->p->get(
'medium_image_height', 200 );
		$this->t['display_webp_images']			= $this->p->get(
'display_webp_images', 0 );


		$this->t['pos_input_autocomplete_output'] = '';
		if ($this->t['pos_input_autocomplete'] == 0) {
			$this->t['pos_input_autocomplete_output'] = '
autocomplete="off" ';
		}

		if ((int)$this->t['pos_payment_force'] > 0) {
			$this->t['pos_payment_force'] =
PhocacartPayment::isPaymentMethodActive($this->t['pos_payment_force'])
=== true ? (int)$this->t['pos_payment_force'] : 0;
		}
		if ((int)$this->t['pos_shipping_force'] > 0) {
			$this->t['pos_shipping_force'] =
PhocacartShipping::isShippingMethodActive($this->t['pos_shipping_force'])
=== true ? (int)$this->t['pos_shipping_force'] : 0;
		}

		// 2) CHECK TICKET
		if ((int)$this->t['ticket']->id < 1) {
			echo '<div class="alert alert-error
alert-danger">'.JText::_('COM_PHOCACART_TICKET_DOES_NOT_EXIST').
'</div>';
			exit;
		}










		// 3) CHECK - SECTION EXISTS (if the asked not found, set the first
existing)
		if (isset($this->t['section']->id)) {
			// Set in PhocacartUser::defineUser() ->
PhocacartTicket::getTicket()
		} else {
			$this->t['section']->id = 0;
		}

		// 4) CHECK - UNIT EXISTS (if the asked not found, set the first existing
but by the section
		if (isset($this->t['unit']->id)) {
			// Set in PhocacartUser::defineUser() ->
PhocacartTicket::getTicket()
		} else {
			$this->t['unit']->id = 0;
		}

		$this->t['linkpos']				=
JRoute::_(PhocacartRoute::getPosRoute($this->t['ticket']->id,
$this->t['unit']->id,
$this->t['section']->id));



		// 5) CHECK - USER
		$this->t['userexists'] 			= false;
		$this->t['anonymoususerexists'] = false;
		if (isset($this->t['user']->id) &&
(int)$this->t['user']->id &&
isset($this->t['user']->name)) {
			$this->t['userexists'] = true;
		} else {
			// Try to find anonymous user (only loyalty card number added - which is
not stored in our database
			// such can be used for different features without having it stored in
our database
			$this->t['loyalty_card_number'] =
PhocacartPos::getCardByVendorAndTicket($this->t['vendor']->id,
$this->t['ticket']->id,
$this->t['unit']->id,
$this->t['section']->id, 0);
			if ($this->t['loyalty_card_number'] != '') {
				$this->t['anonymoususerexists'] = true;
			}
		}

		$this->t['shippingmethodexists'] 	= false;
		$this->t['paymentmethodexists'] 	= false;

		// CART
		$this->cart	= new PhocacartCartRendercheckout();
		$this->cart->setType(array(0,2));
		$this->cart->setFullItems();
		$this->t['shippingid'] 	=
$this->cart->getShippingId();


		if (isset($this->t['shippingid']) &&
(int)$this->t['shippingid'] > 0 &&
$this->t['shippingedit'] == 0) {
			$this->cart->addShippingCosts($this->t['shippingid']);
			$this->t['shippingmethodexists'] = true;
		}
		$this->t['paymentid'] 	= $this->cart->getPaymentId();
		if (isset($this->t['paymentid']) &&
(int)$this->t['paymentid'] > 0 &&
$this->t['paymentedit'] == 0) {
			$this->cart->addPaymentCosts($this->t['paymentid']);//
validity of payment will be checked
			$this->t['paymentmethodexists'] = true;
		}

		$this->cart->roundTotalAmount();
		$this->t['total']		= $this->cart->getTotal();


		//$this->t['paymentexists'] 	= false;
		//$this->t['plugin-pdf']		=
PhocacartUtilsExtension::getExtensionInfo('phocacart',
'plugin', 'phocapdf');
		//$this->t['component-pdf']		=
PhocacartUtilsExtension::getExtensionInfo('com_phocapdf');










		switch ($this->t['page']) {

			case 'main.input':
				parent::display('main_input');
			break;

			case 'main.content.customers':

				$this->items				=
$model->getItemList($this->t['user']->id,
$this->t['vendor']->id,
$this->t['ticket']->id,
$this->t['unit']->id,
$this->t['section']->id);
				$this->t['pagination']		= $model->getPagination();
				$this->t['ordering']		= $model->getOrdering();
				parent::display('main_content_customers');
			break;

			case 'main.content.shippingmethods':

				$shipping 					= new PhocacartShipping();
				$shipping->setType(array(0,2));// 0 all, 1 online shop, 2 pos
				$this->t['shippingmethods']	=
$shipping->checkAndGetShippingMethods(0,
$this->cart->getShippingId());
				$this->t['shippingedit'] 	= 1;

				parent::display('main_content_shipping_methods');
			break;

			case 'main.content.paymentmethods':

				$payment 					= new PhocacartPayment();
				$payment->setType(array(0,2));// 0 all, 1 online shop, 2 pos
				$this->t['paymentmethods']	=
$payment->checkAndGetPaymentMethods(0,
$this->cart->getPaymentId());
				$this->t['paymentedit'] 	= 1;

				$this->t['couponcodevalue'] = '';
				if ($this->cart->getCouponCode() != '') {
					$this->t['couponcodevalue'] =
$this->cart->getCouponCode();
				}

				// REWARD POINTS
				$reward							= new PhocacartReward();
				$this->t['rewards'] 			= array();
				$this->t['rewards']['apply'] 	= false;
				if ($this->t['enable_rewards']) {
					if ($this->t['user']->id > 0) {
						$this->t['rewards']['needed'] =
$this->cart->getRewardPointsNeeded();
						$this->t['rewards']['usertotal'] =
$reward->getTotalPointsByUserId($this->t['user']->id);

						$this->t['rewards']['usedvalue'] =
'';
						if ($this->cart->getRewardPointsUsed() != ''
&& (int)$this->cart->getRewardPointsUsed() > 0) {
							$this->t['rewards']['usedvalue'] =
$this->cart->getRewardPointsUsed();
						}

						if ($this->t['rewards']['usertotal'] > 0)
{
							$this->t['rewards']['text'] =
'<small>('.JText::_('COM_PHOCACART_AVAILABLE_REWARD_POINTS').':
'.(int)$this->t['rewards']['usertotal'].',
'.JText::_('COM_PHOCACART_MAXIMUM_REWARD_POINTS_TO_USE').':
'.(int)$this->t['rewards']['needed'].')</small>';
							$this->t['rewards']['apply'] 	= true;
						}
					}
				}

				parent::display('main_content_payment_methods');
			break;

			case 'main.content.payment':

				parent::display('main_content_payment');
			break;

			case 'main.content.order':

				parent::display('main_content_order');
			break;

			case 'main.content.orders':

				$this->items				=
$model->getItemList($this->t['user']->id,
$this->t['vendor']->id,
$this->t['ticket']->id,
$this->t['unit']->id,
$this->t['section']->id);
				$this->t['pagination']		= $model->getPagination();
				$this->t['ordering']		= $model->getOrdering();

				$media 						= new PhocacartRenderMedia();
				//$this->t['class-row-flex'] 	=
$media->loadEqualHeights();
				$this->t['class_thumbnail'] =
'ph-pos-thumbnail';

				parent::display('main_content_orders');
			break;

			case 'main.categories':
				// CATEGORIES
				$this->t['categories'] =
PhocacartCategoryMultiple::getAllCategories(1, array(0,2));

				parent::display('main_categories');
			break;


			case 'main.content':
			case 'main.content.products':
			default:
				$this->items				= $model->getItemList();
				$this->t['pagination']		= $model->getPagination();
				$this->t['ordering']		= $model->getOrdering();
				$this->t['action']			= $uri->toString();
				$this->t['actionbase64']	=
base64_encode($this->t['action']);
				$this->t['linkcheckout']	=
JRoute::_(PhocacartRoute::getCheckoutRoute(0));
				//$this->t['linkcomparison']	=
JRoute::_(PhocacartRoute::getComparisonRoute(0));
				//$this->t['linkwishlist']	=
JRoute::_(PhocacartRoute::getWishListRoute(0));
				//$this->t['limitstarturl'] 	=
$this->t['limitstart'] > 0 ?
'&start='.$this->t['limitstart'] :
'';
				$this->t['pathcat'] 		=
PhocacartPath::getPath('categoryimage');
				$this->t['pathitem'] 		=
PhocacartPath::getPath('productimage');

				$media 						= new PhocacartRenderMedia();
				//$this->t['class-row-flex'] 	=
$media->loadEqualHeights();
				$this->t['class_thumbnail'] =
'ph-pos-thumbnail';

				parent::display('main_content_products');
			break;
		}
	}
}
?>
views/question/index.html000064400000000054151167552070011555
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/question/metadata.xml000064400000000334151167552070012063
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view title="COM_PHOCACART_ASK_QUESTION_GROUP">
		<message><![CDATA[COM_PHOCACART_ASK_QUESTION_GROUP_DESC]]></message>
	</view>
	<view hidden="true" />
</metadata>views/question/tmpl/default.php000064400000013023151167552070012671
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

$layoutPC 	= new JLayoutFile('form_privacy_checkbox', null,
array('component' => 'com_phocacart'));


echo '<div id="ph-pc-question-box"
class="pc-question-view'.$this->p->get(
'pageclass_sfx' ).'">';
echo
PhocacartRenderFront::renderHeader(array(JText::_('COM_PHOCACART_ASK_A_QUESTION')));


if ( isset($this->item[0]->title) &&
$this->item[0]->title != '') {
	echo
'<h2>'.$this->item[0]->title.'</h2>';
}


if (isset($this->item[0])) {

	echo '<div
class="'.$this->s['c']['row'].'">';
	echo '<div
class="'.$this->s['c']['col.xs12.sm6.md6'].'">';
	$x = $this->item[0];

	$link = JRoute::_(PhocacartRoute::getItemRoute($x->id, $x->catid,
$x->alias, $x->catalias));
	// IMAGE
	echo '<div class="ph-item-image-full-box
ph-item-image-full-left-box">';
	$image 	=
PhocacartImage::getThumbnailName($this->t['pathitem'],
$x->image, 'medium');

	if (isset($image->rel) && $image->rel != '') {
		echo '<a href="'.$link.'" >';
		echo '<img
src="'.JURI::base(true).'/'.$image->rel.'"
alt=""
class="'.$this->s['c']['img-responsive'].'
img-thumbnail ph-image-full ph-img-block"';
		if (isset($this->t['image_width']) &&
(int)$this->t['image_width'] > 0 &&
isset($this->t['image_height']) &&
(int)$this->t['image_height'] > 0) {
			echo '
style="width:'.$this->t['image_width'].'px;height:'.$this->t['image_height'].'px"';
		}
		echo ' />';
		echo '</a>';
	}
	echo '</div>';

	echo '</div>'. "\n";
	echo '</div>'. "\n";

}

$hiddenfield =	' 		<div
class="'.$this->s['c']['control-group'].'
'.$this->p->get('hidden_field_class').'">'.
				'			<div
class="'.$this->s['c']['controls'].'
input-prepend input-group">'.
				'				'.
$this->form->getInput($this->p->get('hidden_field_name'))
.
				'			</div>'.
				'		</div>';

if ( isset($this->t['question_description']) &&
$this->t['question_description'] != '') {
	echo '<div class="ph-desc">'.
$this->t['question_description']. '</div>';
}
?>



<div>&nbsp;</div>
<div class="<?php echo
$this->s['c']['row'] ?>">
<div class="<?php echo
$this->s['c']['col.xs12.sm6.md6'] ?>">

<form action="<?php echo $this->t['action']
?>" method="post" name="adminForm"
id="adminForm" class="form-validate">

<div class="<?php echo
$this->s['c']['control-group'] ?>">
	<div class="<?php echo
$this->s['c']['control-label']
?>"><?php echo $this->form->getLabel('name');
?></div>
	<div class="<?php echo
$this->s['c']['controls'] ?>"><?php
echo $this->form->getInput('name');
	if($this->p->get('hidden_field_position')==1){echo
$hiddenfield;}  ?></div>
</div>
<div class="<?php echo
$this->s['c']['control-group'] ?>">
	<div class="<?php echo
$this->s['c']['control-label']
?>"><?php echo
$this->form->getLabel('email'); ?></div>
	<div class="<?php echo
$this->s['c']['controls'] ?>"><?php
echo $this->form->getInput('email');
	if($this->p->get('hidden_field_position')==2){echo
$hiddenfield;}  ?></div>
</div>
<div class="<?php echo
$this->s['c']['control-group'] ?>">
	<div class="<?php echo
$this->s['c']['control-label']
?>"><?php echo
$this->form->getLabel('phone'); ?></div>
	<div class="<?php echo
$this->s['c']['controls'] ?>"><?php
echo $this->form->getInput('phone');
	if($this->p->get('hidden_field_position')==3){echo
$hiddenfield;}  ?></div>
</div>
<div class="<?php echo
$this->s['c']['control-group'] ?>">
	<div class="<?php echo
$this->s['c']['control-label']
?>"><?php echo
$this->form->getLabel('message'); ?></div>
	<div class="<?php echo
$this->s['c']['controls'] ?>"><?php
echo $this->form->getInput('message');
	if($this->p->get('hidden_field_position')==4){echo
$hiddenfield;}  ?></div>
</div>

<div class="<?php echo
$this->s['c']['control-group'] ?>">
	<div class="<?php echo
$this->s['c']['control-label']
?>"><?php echo
$this->form->getLabel('phq_captcha'); ?></div>
	<div class="<?php echo
$this->s['c']['controls'] ?>"><?php
echo $this->form->getInput('phq_captcha');
?></div>
</div>

<?php
if ($this->t['display_question_privacy_checkbox'] > 0) {
	$d					= array();
	$d['s']			    = $this->s;
	$d['label_text']	=
$this->t['question_privacy_checkbox_label_text'];
	$d['id']			= 'phAskQuestionPrivacyCheckbox';
	$d['name']			= 'privacy';
	$d['class']			=
$this->s['c']['pull-right'] . ' '.
$this->s['c']['checkbox'] . '
ph-askquestion-checkbox-confirm';
	$d['display']		=
$this->t['display_question_privacy_checkbox'];

	echo '<div class="ph-cb"></div>';
	echo $layoutPC->render($d);
}
?>


<div class="btn-toolbar">
	<div class="btn-group">
		<button type="submit" class="<?php echo
$this->s['c']['btn.btn-primary'] ?>">
			<span class="<?php echo
$this->s['i']['submit'] ?>"></span>
<?php echo
JText::_('COM_PHOCACART_SUBMIT');?></button>
	</div>
</div>

	<?php
	echo $this->form->getInput('product_id');
	echo $this->form->getInput('category_id');
	?>
	<input type="hidden" name="view"
value="question" />
	<input type="hidden" name="cid"
value="cid" />
	<input type="hidden" name="id" value="id"
/>
	<input type="hidden" name="option"
value="com_phocacart" />
	<input type="hidden" name="task"
value="question.submit" />
	<?php echo Joomla\CMS\HTML\HTMLHelper::_('form.token');?>

</form>

</div>
</div>
</div>
<?php /*
<script type='text/javascript'>
setTimeout(function () { window.close();}, 1000);
</script>
*/ ?>


views/question/tmpl/default.xml000064400000000754151167552070012711
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_PHOCACART_ASK_QUESTION_LAYOUT">
		<message>
			<![CDATA[COM_PHOCACART_ASK_QUESTION_LAYOUT_DESC]]>
		</message>
	</layout>
	
		<name>COM_PHOCACART_ASK_QUESTION_LAYOUT</name>
		<description>COM_PHOCACART_ASK_QUESTION_LAYOUT_DESC</description>
		
		<fields name="params">
<fieldset name="basic"
addfieldpath="/administrator/components/com_phocacart/models/fields"
>

			
		</fieldset>
</fields>

</metadata>views/question/tmpl/index.html000064400000000054151167552070012531
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/question/view.html.php000064400000012153151167552070012211
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');

class PhocaCartViewQuestion extends JViewLegacy
{
	protected $t;
	protected $r;
	protected $p;
	protected $u;
	protected $s;
	protected $category;
	protected $item;
	protected $form;

	public function display($tpl = null) {

		$app								= JFactory::getApplication();
		$document							= JFactory::getDocument();
		$session 							= JFactory::getSession();

		$uri 								= \Joomla\CMS\Uri\Uri::getInstance();
		$this->t['action']					= $uri->toString();
		$this->t['actionbase64']			=
base64_encode($this->t['action']);
		$this->u							= PhocacartUser::getUser();
		$this->s                            =
PhocacartRenderStyle::getStyles();
		$this->p 							= $app->getParams();
		$this->t['question_description']	= $this->p->get(
'question_description', '' );
		$this->t['question_description']	=
PhocacartRenderFront::renderArticle($this->t['question_description']);

		$this->t['enable_ask_question'] 	=
$this->p->get('enable_ask_question', 0);
		if ($this->t['enable_ask_question'] == 0) {
			//throw new
Exception(JText::_('COM_PHOCACART_ASK_QUESTION_DISABLED'), 403);
			$app->enqueueMessage(JText::_('COM_PHOCACART_ASK_QUESTION_DISABLED'),
'error');
			return false;
		}

		// Ask Question Privacy checkbox
		$this->t['display_question_privacy_checkbox']	=
$this->p->get( 'display_question_privacy_checkbox', 0 );
		if ($this->t['display_question_privacy_checkbox'] > 0) {
			$this->t['question_privacy_checkbox_label_text']	=
$this->p->get( 'question_privacy_checkbox_label_text', 0
);
			$this->t['question_privacy_checkbox_label_text'] 	=
PhocacartRenderFront::renderArticle((int)$this->t['question_privacy_checkbox_label_text'],
'html', '');
		}

		// Security
		$namespace  = 'phccrt' .
$this->p->get('session_suffix');
		$session->set('form_id',
PhocacartUtils::getRandomString(mt_rand(6,10)), $namespace);

		if((int)$this->p->get('enable_time_check_question', 0)
> 0) {
			$sesstime = $session->get('time', time(), $namespace);
			$session->set('time', $sesstime, $namespace);
		}

		// Security Hidden Field
		if ($this->p->get('enable_hidden_field_question', 0) ==
1) {
			$this->p->set('hidden_field_position',
PhocacartSecurity::setHiddenFieldPos($this->p->get('display_name_form'),
$this->p->get('display_email_form'),
$this->p->get('display_phone_form'),
$this->p->get('display_message_form')));

			$session->set('hidden_field_id',
'hf'.PhocacartUtils::getRandomString(mt_rand(6,10)),
$namespace);
			$session->set('hidden_field_name',
'hf'.PhocacartUtils::getRandomString(mt_rand(6,10)),
$namespace);
			$session->set('hidden_field_class',
'pc'.PhocacartUtils::getRandomString(mt_rand(6,10)),
$namespace);

			$this->p->set('hidden_field_id',
$session->get('hidden_field_id', '', $namespace));
			$this->p->set('hidden_field_name',
$session->get('hidden_field_name', '',
$namespace));
			$this->p->set('hidden_field_class',
$session->get('hidden_field_class', '',
$namespace));

			$document->addCustomTag('<style type="text/css">
.'.$this->p->get('hidden_field_class').' {
'."\n\t".'display: none
!important;'."\n".'}</style>');
		} else {
			$this->p->set('hidden_field_position', -1);
		}


		$id						= $app->input->get('id', 0, 'int');
		$catid					= $app->input->get('catid', 0,
'int');
		$tmpl					= $app->input->get('tmpl', '',
'string');


		if ($id > 0 && $catid > 0) {
			//$modelP	= $this->getModel('Item',
'PhocaCartModel');
			jimport('joomla.application.component.model');
			JModelLegacy::addIncludePath(JPATH_SITE.'/components/com_phocacart/models');
			$modelP = JModelLegacy::getInstance( 'Item',
'PhocaCartModel' );

			$this->category			= $modelP->getCategory($id, $catid);

			$this->item				= $modelP->getItem($id, $catid);
			$this->t['catid']		= 0;
			if (isset($this->category[0]->id)) {
				$this->t['catid']	= (int)$this->category[0]->id;
			}

		}

		if ($tmpl == 'component') {

			$buffer = JFactory::getApplication()->sendHeaders();

			$document->addCustomTag( "<style
type=\"text/css\"> \n"
			." #ph-pc-question-box {
				margin: 20px
			} \n"
			." </style> \n");
		}

		$this->t['pathitem'] =
PhocacartPath::getPath('productimage');

		$this->form		= $this->get('Form');

		if (!empty($this->form) && $id > 0) {
			$this->form->setValue('product_id', null, (int)$id);
		}
		if (!empty($this->form) && $catid > 0) {
			$this->form->setValue('category_id', null,
(int)$catid);
		}


		$media = PhocacartRenderMedia::getInstance('main');
		$media->loadBase();
		$media->loadChosen();

		$media->loadSpec();
		$this->_prepareDocument();

		parent::display($tpl);
	}

	protected function _prepareDocument() {

		PhocacartRenderFront::prepareDocument($this->document, $this->p,
false, false, JText::_('COM_PHOCACART_ASK_A_QUESTION'));
	}
}
?>
views/response/index.html000064400000000054151167552070011544
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/response/metadata.xml000064400000000130151167552070012044
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view hidden="true" />
</metadata>views/response/tmpl/default.php000064400000001137151167552070012663
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
echo '<div id="ph-pc-response-box"
class="pc-response-view'.$this->p->get(
'pageclass_sfx' ).'">';

echo PhocacartRenderFront::renderHeader();


echo '</div>';// end ph-pc-response-box
echo '<div>&nbsp;</div>';
echo PhocacartUtilsInfo::getInfo();
?>views/response/tmpl/index.html000064400000000054151167552070012520
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/response/view.html.php000064400000002024151167552070012174
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');
class PhocaCartViewResponse extends JViewLegacy
{
	protected $t;
	protected $r;
	protected $p;
	protected $u;
	protected $s;

	function display($tpl = null) {

		$document					= JFactory::getDocument();
		$app						= JFactory::getApplication();
		$uri 						= \Joomla\CMS\Uri\Uri::getInstance();
		$this->u					= PhocacartUser::getUser();
		$this->p					= $app->getParams();
		$this->s                    = PhocacartRenderStyle::getStyles();

		$this->_prepareDocument();
		parent::display($tpl);
	}

	protected function _prepareDocument() {
		//PhocacartRenderFront::prepareDocument($this->document,
$this->p);
	}
}
?>
views/submit/index.html000064400000000054151167552070011211
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/submit/metadata.xml000064400000000320151167552070011512
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view title="COM_PHOCACART_SUBMIT_GROUP">
		<message><![CDATA[COM_PHOCACART_SUBMIT_GROUP_DESC]]></message>
	</view>
	<view hidden="true" />
</metadata>views/submit/tmpl/default.php000064400000026767151167552070012350
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
//Joomla\CMS\HTML\HTMLHelper::_('formbehavior.chosen',
'select');
$layoutPC = new JLayoutFile('form_privacy_checkbox', null,
array('component' => 'com_phocacart'));
$layoutUL = new JLayoutFile('user_login', null,
array('component' => 'com_phocacart'));
$layoutUR = new JLayoutFile('user_register', null,
array('component' => 'com_phocacart'));


echo '<div id="ph-pc-submit-item-box"
class="pc-submit-item-view' .
$this->p->get('pageclass_sfx') . '">';
echo
PhocacartRenderFront::renderHeader(array(JText::_('COM_PHOCACART_SUBMIT_ITEM')));


if (isset($this->t['submit_item_description']) &&
$this->t['submit_item_description'] != '') {
    echo '<div class="ph-desc">' .
$this->t['submit_item_description'] .
'</div>';
}

if (PhocacartSubmit::isAllowedToSubmit()) {

    $hiddenfield = '<div class="' .
$this->s['c']['control-group'] . ' ' .
$this->p->get('hidden_field_class') .
'">' .
        '<div class="' .
$this->s['c']['controls'] . ' input-prepend
input-group">' .
        '' .
$this->form->getInput($this->p->get('hidden_field_name'))
.
        '</div>' .
        '</div>';


    echo '<div>&nbsp;</div>';
    echo '<div class="' .
$this->s['c']['row'] . '">';
    echo '<div class="' .
$this->s['c']['col.xs12.sm12.md12'] .
'">';

    echo '<form action="' .
$this->t['action'] . '" method="post"
name="adminForm" id="adminForm"
class="form-validate"
enctype="multipart/form-data">';


    // All form items


    $fieldSets = $this->form->getFieldsets();


    foreach ($fieldSets as $name => $fieldSet) {

        if (isset($fieldSet->name) && $fieldSet->name ==
'items_item') {

            foreach ($this->form->getFieldset($name) as $field) {


                $isIncluded = 0;
                if (in_array($field->fieldname,
$this->t['items_item'])) {
                    $isIncluded = 1;// included
                }
                if (in_array($field->fieldname . '*',
$this->t['items_item'])) {
                    $isIncluded = 2;// included and required
                }


                if ($isIncluded > 0) {


                    if ($isIncluded == 2) {

                        //$field->addAttribute('required',
'true');
                        //$field->required = true;
                        $field->__set('required', true);
                    }

                    echo '<div class="' .
$this->s['c']['control-group'] .
'">';

                    echo '<div class="' .
$this->s['c']['control-label'] .
'">' . $field->label . '</div>';
                    echo '<div class="' .
$this->s['c']['controls'] . '">' .
$field->input . '</div>';

                    echo '</div>';

                }
            }
        }
    }
    /*
    if (!empty($this->t['items_item'])) {
        foreach ($this->t['items_item'] as $k => $v) {

            $field = trim($v);
            // Required
            if (strpos($field, '*') !== false) {

                $field = str_replace('*', '', $field);
                $this->form->setFieldAttribute($field,
'required', 'true');
            }
            $field = str_replace('*', '', $field);

            $fieldInput = $this->form->getInput($field);

            $fieldInput = str_replace('icon-calendar',
$this->s['i']['calendar'], $fieldInput);

            echo '<div
class="'.$this->s['c']['control-group'].'">';

            echo '<div
class="'.$this->s['c']['control-label'].'">'.$this->form->getLabel($field).'</div>';
            echo '<div
class="'.$this->s['c']['controls'].'">'.$fieldInput.'</div>';

            echo '</div>';

        }
    }*/
    if ($this->p->get('hidden_field_position') == 1) {
        echo $hiddenfield;
    }


    // Parameters
    foreach ($fieldSets as $name => $fieldSet) {

        if (isset($fieldSet->name) && $fieldSet->name ==
'items_parameter') {

            $parameters = PhocacartParameter::getAllParameters();

            foreach ($this->form->getFieldset($name) as $field) {

                // We store parameters with ID not aliases in DB
                $alias = '';
                $fN = (int)$field->fieldname;
                if (isset($parameters[$fN]->alias) &&
$parameters[$fN]->alias != '') {
                    $alias = $parameters[$fN]->alias;
                }


                $isIncluded = 0;
                if ($alias != '' && in_array($alias,
$this->t['items_parameter'])) {
                    $isIncluded = 1;// included
                }
                if ($alias != '' && in_array($alias .
'*', $this->t['items_parameter'])) {
                    $isIncluded = 2;// included and required
                }


                if ($isIncluded > 0) {


                    if ($isIncluded == 2) {

                        //$field->addAttribute('required',
'true');
                        //$field->required = true;
                        $field->__set('required', true);
                    }

                    echo '<div class="' .
$this->s['c']['control-group'] .
'">';

                    echo '<div class="' .
$this->s['c']['control-label'] .
'">' . $field->label . '</div>';
                    echo '<div class="' .
$this->s['c']['controls'] . '">' .
$field->input . '</div>';

                    echo '</div>';

                }
            }
        }
    }

    if ($this->p->get('hidden_field_position') == 2) {
        echo $hiddenfield;
    }

    // Contact information
    foreach ($fieldSets as $name => $fieldSet) {

        if (isset($fieldSet->name) && $fieldSet->name ==
'items_contact') {

            foreach ($this->form->getFieldset($name) as $field) {


                $isIncluded = 0;
                if (in_array($field->fieldname,
$this->t['items_contact'])) {
                    $isIncluded = 1;// included
                }
                if (in_array($field->fieldname . '*',
$this->t['items_contact'])) {
                    $isIncluded = 2;// included and required
                }


                if ($isIncluded > 0) {


                    if ($isIncluded == 2) {

                        //$field->addAttribute('required',
'true');
                        //$field->required = true;
                        $field->__set('required', true);
                    }

                    echo '<div class="' .
$this->s['c']['control-group'] .
'">';

                    echo '<div class="' .
$this->s['c']['control-label'] .
'">' . $field->label . '</div>';
                    echo '<div class="' .
$this->s['c']['controls'] . '">' .
$field->input . '</div>';

                    echo '</div>';

                }
            }
        }
    }
    /*
    if (!empty($this->t['items_contact'])) {

        echo '<div
class="ph-submititem-header-contact">'.JText::_('COM_PHOCACART_CONTACT_INFORMATION').'</div>';
        foreach ($this->t['items_contact'] as $k => $v) {

            $field = trim($v);
            // Required
            if (strpos($field, '*') !== false) {

                $field = str_replace('*', '', $field);
                $this->form->setFieldAttribute($field,
'required', 'true');
            }
            $field = str_replace('*', '', $field);

            $fieldInput = $this->form->getInput($field);
            $fieldInput = str_replace('icon-calendar',
$this->s['i']['calendar'], $fieldInput);

            echo '<div
class="'.$this->s['c']['control-group'].'">';

            echo '<div
class="'.$this->s['c']['control-label'].'">'.$this->form->getLabel($field).'</div>';
            echo '<div
class="'.$this->s['c']['controls'].'">'.$fieldInput.'</div>';

            echo '</div>';

        }
    }*/
    if ($this->p->get('hidden_field_position') == 3) {
        echo $hiddenfield;
    }

    // Captcha
    echo '<div class="' .
$this->s['c']['control-group'] .
'">';
    echo '<div class="' .
$this->s['c']['control-label'] .
'">' .
$this->form->getLabel('phq_captcha') .
'</div>';
    echo '<div class="' .
$this->s['c']['controls'] . '">' .
$this->form->getInput('phq_captcha') .
'</div>';
    echo '</div>';
    if ($this->p->get('hidden_field_position') == 4) {
        echo $hiddenfield;
    }

    // Privacy Checkbox
    if ($this->t['display_submit_item_privacy_checkbox'] >
0) {
        $d = array();
        $d['s'] = $this->s;
        $d['label_text'] =
$this->t['submit_item_privacy_checkbox_label_text'];
        $d['id'] = 'phSubmitItemPrivacyCheckbox';
        $d['name'] = 'privacy';
        $d['class'] =
$this->s['c']['pull-left'] . ' ' .
$this->s['c']['checkbox'] . '
ph-submititem-checkbox-confirm';
        $d['display'] =
$this->t['display_submit_item_privacy_checkbox'];

        echo '<div class="ph-cb"></div>';
        echo $layoutPC->render($d);
        echo '<div class="ph-cb"></div>';
    }
    if ($this->p->get('hidden_field_position') == 5) {
        echo $hiddenfield;
    }

    // Submit button
    echo '<div class="btn-toolbar">';
    echo '<div class="btn-group">';
    echo '<button type="submit" class="' .
$this->s['c']['btn.btn-primary'] .
'">';
    echo '<span class="' .
$this->s['i']['submit'] .
'"></span> ' .
JText::_('COM_PHOCACART_SUBMIT') . '</button>';
    echo '</div>';
    echo '</div>';


    echo '<input type="hidden" name="view"
value="submit" />';
    //echo '<input type="hidden" name="cid"
value="cid" />';
    //echo '<input type="hidden" name="id"
value="id" />';
    echo '<input type="hidden" name="option"
value="com_phocacart" />';
    echo '<input type="hidden" name="task"
value="submit.submit" />';

    echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
    echo '</form>';

    echo '</div>';
    echo '</div>';

} else {

    require_once JPATH_SITE .
'/components/com_users/helpers/route.php';
    jimport('joomla.application.module.helper');
    $module = JModuleHelper::getModule('mod_login');
    $mP = new JRegistry();
    $mP->loadString($module->params);

    $lang = JFactory::getLanguage();
    $lang->load('mod_login');

    echo '<div class="' .
$this->s['c']['row'] . '
ph-account-box-row" >';
    //echo '<div class="ph-account-box-header"
id="phaccountloginedit"><div
class="ph-pull-right"><span
class="'.$this->s['i']['remove-circle'].'
ph-account-icon-not-ok"></span></div><h3>1.
'.JText::_('COM_PHOCACART_LOGIN_REGISTER').'</h3></div>';
    echo '<div class="' .
$this->s['c']['col.xs12.sm12.md12'] . '
ph-account-box-header"
id="phaccountloginedit"><h3>' .
JText::_('COM_PHOCACART_LOGIN_REGISTER') .
'</h3></div>';
    echo '</div>';


    echo '<div class="' .
$this->s['c']['row'] . '
ph-account-box-action">';


    echo '<div class="' .
$this->s['c']['col.xs12.sm8.md8'] . '
ph-right-border">';

    $d = array();
    $d['s'] = $this->s;
    $d['t'] = $this->t;
    echo $layoutUL->render($d);

    echo '</div>' . "\n";// end columns

    echo '<div class="' .
$this->s['c']['col.xs12.sm4.md4'] . '
ph-left-border">';

    $d = array();
    $d['s'] = $this->s;
    $d['t'] = $this->t;
    echo $layoutUR->render($d);

    echo '</div>' . "\n";// end columns

    echo '<div class="ph-cb"></div>';

    echo '</div>' . "\n";// end account box
login

    echo '</form>' . "\n";


}
echo '</div>';
echo '<div>&nbsp;</div>';
echo PhocacartUtilsInfo::getInfo();
?>


views/submit/tmpl/default.xml000064400000000750151167552070012341
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_PHOCACART_SUBMIT_ITEM_LAYOUT">
		<message>
			<![CDATA[COM_PHOCACART_SUBMIT_ITEM_LAYOUT_DESC]]>
		</message>
	</layout>
	
		<name>COM_PHOCACART_SUBMIT_ITEM_LAYOUT</name>
		<description>COM_PHOCACART_SUBMIT_ITEM_LAYOUT_DESC</description>
		
		<fields name="params">
<fieldset name="basic"
addfieldpath="/administrator/components/com_phocacart/models/fields"
>

			
		</fieldset>
</fields>

</metadata>views/submit/tmpl/index.html000064400000000054151167552070012165
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/submit/view.html.php000064400000013714151167552070011651
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');

class PhocaCartViewSubmit extends JViewLegacy
{
	protected $t;
	protected $r;
	protected $p;
	protected $u;
	protected $s;
	protected $category;
	protected $item;
	protected $form;

	public function display($tpl = null) {

		$app								= JFactory::getApplication();
		$document							= JFactory::getDocument();
		$session 							= JFactory::getSession();

		$uri 								= \Joomla\CMS\Uri\Uri::getInstance();
		$this->t['action']					= $uri->toString();
		$this->t['actionbase64']			=
base64_encode($this->t['action']);
		$this->u							= PhocacartUser::getUser();
		$this->s                            =
PhocacartRenderStyle::getStyles();
		$this->p 							= $app->getParams();


		$this->t['enable_submit_item'] 		=
$this->p->get('enable_submit_item', 0);

		if ($this->t['enable_submit_item'] == 0) {
			//throw new
Exception(JText::_('COM_PHOCACART_SUBMIT_ITEM_DISABLED'), 500);
			$app->enqueueMessage(JText::_('COM_PHOCACART_SUBMIT_ITEM_DISABLED'),
'error');
			return false;
		}


		$this->t['submit_item_description'] =
$this->p->get('submit_item_description', '');
		$this->t['submit_item_description'] =
PhocacartRenderFront::renderArticle($this->t['submit_item_description']);
		if (PhocacartSubmit::isAllowedToSubmit()) {




			$this->t['submit_item_form_fields'] =
$this->p->get('submit_item_form_fields', '');
			//$this->t['submit_item_form_fields'] = 'title, alias,
catid_multiple, image, sku, upc, ean, jan, isbn, mpn, serial_number,
registration_key, external_id, external_key, external_link, external_text,
external_link2, external_text2, price, price_original, tax_id,
manufacturer_id, description, description_long, features, video, type,
unit_amount, unit_unit, length, width, height, weight, volume, condition,
type_feed, type_category_feed, delivery_date, metatitle, metakey, metadesc,
date, date_update, tags, taglabels';

			$this->t['items_item'] = array_map('trim',
explode(',', $this->t['submit_item_form_fields']));
			$this->t['items_item'] =
array_unique($this->t['items_item']);

			// Contact
			$this->t['submit_item_form_fields_contact'] =
$this->p->get('submit_item_form_fields_contact',
'');
			//$this->t['submit_item_form_fields_contact'] =
'name*, email*, phone, message';

			$this->t['items_contact'] = array_map('trim',
explode(',',
$this->t['submit_item_form_fields_contact']));
			$this->t['items_contact'] =
array_unique($this->t['items_contact']);


			$this->t['submit_item_form_fields_parameters'] =
$this->p->get('submit_item_form_fields_parameters',
'');
			$this->t['items_parameter'] = array_map('trim',
explode(',',
$this->t['submit_item_form_fields_parameters']));
			$this->t['items_parameter'] =
array_unique($this->t['items_parameter']);




			$this->t['enable_submit_item'] =
$this->p->get('enable_submit_item', 0);
			if ($this->t['enable_submit_item'] == 0) {
				//throw new
Exception(JText::_('COM_PHOCACART_SUBMIT_ITEM_DISABLED'), 403);
				$app->enqueueMessage(JText::_('COM_PHOCACART_SUBMIT_ITEM_DISABLED'),
'error');
				return false;
			}

			// Submit Item Privacy checkbox
			$this->t['display_submit_item_privacy_checkbox'] =
$this->p->get('display_submit_item_privacy_checkbox', 0);
			if ($this->t['display_submit_item_privacy_checkbox'] >
0) {
				$this->t['submit_item_privacy_checkbox_label_text'] =
$this->p->get('submit_item_privacy_checkbox_label_text',
0);
				$this->t['submit_item_privacy_checkbox_label_text'] =
PhocacartRenderFront::renderArticle((int)$this->t['submit_item_privacy_checkbox_label_text'],
'html', '');
			}

			// Security
			$namespace = 'phccrt' .
$this->p->get('session_suffix');
			$session->set('form_id',
PhocacartUtils::getRandomString(mt_rand(6, 10)), $namespace);

			if ((int)$this->p->get('enable_time_check_submit_item',
0) > 0) {
				$sesstime = $session->get('time', time(), $namespace);
				$session->set('time', $sesstime, $namespace);
			}

			// Security Hidden Field
			if ($this->p->get('enable_hidden_field_submit_item', 0)
== 1) {

				$this->p->set('hidden_field_position', rand(1, 5));
				$session->set('hidden_field_id', 'hf' .
PhocacartUtils::getRandomString(mt_rand(6, 10)), $namespace);
				$session->set('hidden_field_name', 'hf' .
PhocacartUtils::getRandomString(mt_rand(6, 10)), $namespace);
				$session->set('hidden_field_class', 'pc' .
PhocacartUtils::getRandomString(mt_rand(6, 10)), $namespace);

				$this->p->set('hidden_field_id',
$session->get('hidden_field_id', '', $namespace));
				$this->p->set('hidden_field_name',
$session->get('hidden_field_name', '',
$namespace));
				$this->p->set('hidden_field_class',
$session->get('hidden_field_class', '',
$namespace));

				$document->addCustomTag('<style
type="text/css"> .' .
$this->p->get('hidden_field_class') . ' { ' .
"\n\t" . 'display: none !important;' . "\n" .
'}</style>');
			} else {
				$this->p->set('hidden_field_position', -1);
			}

			$tmpl = $app->input->get('tmpl', '',
'string');

			if ($tmpl == 'component') {

				$buffer = JFactory::getApplication()->sendHeaders();

				$document->addCustomTag("<style
type=\"text/css\"> \n"
					. " #ph-pc-question-box {
					margin: 20px
				} \n"
					. " </style> \n");
			}

			$this->form = $this->get('Form');
		}

		$media = PhocacartRenderMedia::getInstance('main');
		$media->loadBase();
		$media->loadChosen();
		//$media->loadFileInput();

		$media->loadSpec();
		$this->_prepareDocument();

		parent::display($tpl);
	}

	protected function _prepareDocument() {

		PhocacartRenderFront::prepareDocument($this->document, $this->p,
false, false, JText::_('COM_PHOCACART_SUBMIT_ITEM'));
	}
}
?>
views/terms/index.html000064400000000054151167552070011040
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/terms/metadata.xml000064400000000316151167552070011346
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view title="COM_PHOCACART_TERMS_GROUP">
		<message><![CDATA[COM_PHOCACART_TERMS_GROUP_DESC]]></message>
	</view>
	<view hidden="true" />
</metadata>views/terms/tmpl/default.php000064400000001222151167552070012152
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

echo '<div id="ph-pc-terms-box"
class="pc-terms-view'.$this->p->get(
'pageclass_sfx' ).'">';

echo
PhocacartRenderFront::renderHeader(array(JText::_('COM_PHOCACART_TERMS_AND_CONDITIONS')));

echo '<div class="ph-terms-box-in">';
echo $this->t['terms_conditions'];
echo '</div>';

echo '</div>';
?>views/terms/tmpl/default.xml000064400000000720151167552070012165
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_PHOCACART_TERMS_LAYOUT">
		<message>
			<![CDATA[COM_PHOCACART_TERMS_LAYOUT_DESC]]>
		</message>
	</layout>
	
		<name>COM_PHOCACART_TERMS_LAYOUT</name>
		<description>COM_PHOCACART_TERMS_LAYOUT_DESC</description>
		
		<fields name="params">
<fieldset name="basic"
addfieldpath="/administrator/components/com_phocacart/models/fields"
>

			
		</fieldset>
</fields>

</metadata>views/terms/tmpl/index.html000064400000000054151167552070012014
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/terms/view.html.php000064400000002342151167552070011473
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');

class PhocaCartViewTerms extends JViewLegacy
{
	protected $t;
	protected $r;
	protected $p;
	protected $u;
	protected $s;

	public function display($tpl = null) {

		$app						= JFactory::getApplication();
		$this->p 					= $app->getParams();
		$this->s                    = PhocacartRenderStyle::getStyles();
		$this->t['terms_conditions']= $this->p->get(
'terms_conditions', '' );
		$this->t['terms_conditions']=
PhocacartRenderFront::renderArticle($this->t['terms_conditions']);

		$media = PhocacartRenderMedia::getInstance('main');
		$media->loadBase();
		$media->loadSpec();

		$this->_prepareDocument();
		parent::display($tpl);

	}

	protected function _prepareDocument() {
		PhocacartRenderFront::prepareDocument($this->document, $this->p,
false, false, JText::_('COM_PHOCACART_TERMS_AND_CONDITIONS'));
	}
}
?>
views/wishlist/index.html000064400000000054151167552070011554
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/wishlist/metadata.xml000064400000000275151167552070012066
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view title="COM_PHOCACART_WISH_LIST_GROUP">
		<message><![CDATA[COM_PHOCACART_WISH_LIST_GROUP_DESC]]></message>
	</view>
</metadata>views/wishlist/tmpl/default.php000064400000012706151167552070012677
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

$layoutI	= new JLayoutFile('image', null,
array('component' => 'com_phocacart'));

echo '<div id="ph-pc-wishlist-box"
class="pc-wishlist-view'.$this->p->get(
'pageclass_sfx' ).'">';
echo
PhocacartRenderFront::renderHeader(array(JText::_('COM_PHOCACART_WISH_LIST')));

if (!empty($this->t['items'])) {

	echo '<div
class="'.$this->s['c']['row'].'">';

	echo '<div
class="'.$this->s['c']['col.xs12.sm2.md2'].'"><b>'.JText::_('COM_PHOCACART_IMAGE').'</b></div>';

	echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'"><b>'.JText::_('COM_PHOCACART_PRODUCT').'</b></div>';

	if (isset($this->t['value']['stock']) &&
$this->t['value']['stock'] == 1)	{
		echo '<div
class="'.$this->s['c']['col.xs12.sm2.md2'].'"><b>'.JText::_('COM_PHOCACART_AVAILABILITY').'</b></div>';
	} else {
		echo '<div
class="'.$this->s['c']['col.xs12.sm2.md2'].'"></div>';
	}

	if ($this->t['can_display_price']) {
		echo '<div
class="'.$this->s['c']['col.xs12.sm2.md2'].'"><b>'.JText::_('COM_PHOCACART_PRICE').'</b></div>';
	} else {
		echo '<div
class="'.$this->s['c']['col.xs12.sm2.md2'].'"></div>';
	}

	echo '<div
class="'.$this->s['c']['col.xs12.sm2.md2'].'"><b>'.JText::_('COM_PHOCACART_ACTION').'</b></div>';

	echo '</div>';



	$count = count($this->t['items']);
	$price = new PhocacartPrice();



	foreach($this->t['items'] as $k => $v) {

		echo '<div
class="'.$this->s['c']['row'].'">';

		if (isset($v['catid2']) && (int)$v['catid2']
> 0 && isset($v['catalias2']) &&
$v['catalias2'] != '') {
			$link 	= JRoute::_(PhocacartRoute::getItemRoute($v['id'],
$v['catid2'], $v['alias'],
$v['catalias2']));
		} else {
			$link 	= JRoute::_(PhocacartRoute::getItemRoute($v['id'],
$v['catid'], $v['alias'], $v['catalias']));
		}

		$image 	=
PhocacartImage::getThumbnailName($this->t['pathitem'],
$v['image'], 'small');
		$imageO = '';
		if (isset($image->rel) && $image->rel != '') {
			$imageO = '<div class="ph-center" >';
			$imageO .= '<a href="'.$link.'">';

            $d						= array();
            $d['t']					= $this->t;
            $d['s']					= $this->s;
            $d['src']				=
JURI::base(true).'/'.$image->rel;
            $d['srcset-webp']		=
JURI::base(true).'/'.$image->rel_webp;
            $d['alt-value']			=
PhocaCartImage::getAltTitle($v['title'], $image->rel);
            $d['class']				=
$this->s['c']['img-responsive'];

            $imageO .= $layoutI->render($d);


			$imageO .= '</a>';
			$imageO .= '</div>';
		}

		echo '<div
class="'.$this->s['c']['col.xs12.sm2.md2'].'
phVMiddle">'.$imageO.'</div>';

		echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'
phVMiddle">'.$v['title'].'</div>';

		if (isset($this->t['value']['stock']) &&
$this->t['value']['stock'] == 1)	{
			echo '<div
class="'.$this->s['c']['col.xs12.sm2.md2'].'
phVMiddle">'.JText::_($v['stock']).'</div>';
		} else {
			echo '<div
class="'.$this->s['c']['col.xs12.sm2.md2'].'
phVMiddle"></div>';
		}

		if ($this->t['can_display_price']) {
			echo '<div
class="'.$this->s['c']['col.xs12.sm2.md2'].'
phVMiddle">'.$price->getPriceItem($v['price'],
$v['group_price']).'</div>';
		} else {
			echo '<div
class="'.$this->s['c']['col.xs12.sm2.md2'].'
phVMiddle"></div>';
		}

		echo '<div
class="'.$this->s['c']['col.xs12.sm2.md2'].'
phVMiddle">';

		echo '<form
action="'.$this->t['linkwishlist'].'"
method="post">';
		echo '<input type="hidden" name="id"
value="'.(int)$v['id'].'">';
		echo '<input type="hidden" name="task"
value="wishlist.remove">';
		echo '<input type="hidden" name="tmpl"
value="component" />';
		echo '<input type="hidden" name="option"
value="com_phocacart" />';
		echo '<input type="hidden" name="return"
value="'.$this->t['actionbase64'].'"
/>';
		//echo '<div class="ph-center">';
		echo '<button type="submit"
class="'.$this->s['c']['btn.btn-danger'].'
ph-btn"
title="'.JText::_('COM_PHOCACART_REMOVE').'"><span
class="'.$this->s['i']['remove'].'"></span></button>';
		//echo '</div>';


		echo ' ';

		$link = JRoute::_(PhocacartRoute::getItemRoute($v['id'],
$v['catid'], $v['alias'], $v['catalias']));
		echo '<a href="'.$link.'"
class="'.$this->s['c']['btn.btn-primary'].'
ph-btn" role="button"
title="'.JText::_('COM_PHOCACART_VIEW_PRODUCT').'"><span
class="'.$this->s['i']['search'].'"></span></a>';

		echo Joomla\CMS\HTML\HTMLHelper::_('form.token');
		echo '</form>';

		echo '</div>';
		/*
		if ($this->t['value']['attrib'] == 1) 	{
			$c['attrib'] 	.= '<td>';
			if(!empty($v['attr_options'])) {
				foreach ($v['attr_options'] as $k2 => $v2) {
					$c['attrib'] 	.=
'<div>'.$v2->title.'</div>';
					if(!empty($v2->options)) {
						$c['attrib'] 	.= '<ul>';
						foreach ($v2->options as $k3 => $v3) {
							$c['attrib'] 	.=
'<li>'.$v3->title.'</li>';
						}
						$c['attrib'] 	.= '</ul>';
					}
				}

			}
			$c['attrib'] 	.= '</td>';
		} */


		echo '</div>';// end row
	}


	echo $this->loadTemplate('login');

} else {
	echo '<div class="alert alert-error
alert-danger">'.JText::_('COM_PHOCACART_THERE_ARE_NO_PRODUCTS_IN_YOUR_WISH_LIST').'</div>';
}



echo '</div>';// end wishlist box
echo '<div>&nbsp;</div>';
echo PhocacartUtilsInfo::getInfo();
?>
views/wishlist/tmpl/default.xml000064400000000745151167552070012710
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_PHOCACART_WISH_LIST_LAYOUT">
		<message>
			<![CDATA[COM_PHOCACART_WISH_LIST_LAYOUT_DESC]]>
		</message>
	</layout>
	
		<name>COM_PHOCACART_WISH_LIST_LAYOUT</name>
		<description>COM_PHOCACART_WISH_LIST_LAYOUT_DESC</description>
		
		<fields name="params">
<fieldset name="basic"
addfieldpath="/administrator/components/com_phocacart/models/fields"
>

			
			
		</fieldset>
</fields>

</metadata>views/wishlist/tmpl/default_login.php000064400000004125151167552070014063
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
$layoutUL 		= new JLayoutFile('user_login', null,
array('component' => 'com_phocacart'));


if((int)$this->u->id >  0) {
	// User is logged in
} else {

	echo '<p>&nbsp</p>';

	echo '<div class="alert
alert-error">'.JText::_('COM_PHOCACART_YOUR_WISHLIST_WILL_BE_SAVED_ONLY_IF_YOU_LOGIN').'</div>';


	echo '<div
class="'.$this->s['c']['row'].'
ph-account-box-row" >';
	echo '<div
class="'.$this->s['c']['col.xs12.sm12.md12'].'
ph-account-box-header"
id="phaccountloginedit"><h3>'.JText::_('COM_PHOCACART_LOGIN_REGISTER').'</h3></div>';
	echo '</div>';

	echo '<div
class="'.$this->s['c']['row'].'
ph-account-box-action">';

	echo '<div
class="'.$this->s['c']['col.xs12.sm8.md8'].'
ph-wishlist-login-box-row  ph-right-border" >';

	$d = array();
	$d['s'] = $this->s;
	$d['t'] = $this->t;
	echo $layoutUL->render($d);

	echo '</div>'. "\n";// end columns

	echo '<div
class="'.$this->s['c']['col.xs12.sm4.md4'].'
ph-left-border">';

	$usersConfig = JComponentHelper::getParams('com_users');

	//echo '<ul class="unstyled">'. "\n";
	if ($usersConfig->get('allowUserRegistration')) {
		echo '<div
class="ph-box-header">'.JText::_('COM_PHOCACART_REGISTER').'</div>'.
"\n";
		//echo '<li><a href="'.
JRoute::_('index.php?option=com_users&view=registration').'">'.JText::_('MOD_LOGIN_REGISTER').'<span
class="icon-arrow-right"></span></a></li>'.
"\n";

		echo '<a
class="'.$this->s['c']['btn.btn-primary.btn-sm'].'
ph-checkout-btn-login" href="'.
JRoute::_('index.php?option=com_users&view=registration').'"><span
class="'.$this->s['i']['user'].'"></span>
 '.JText::_('MOD_LOGIN_REGISTER').'</a>'.
"\n";

	}
	//echo '</ul>'. "\n";


	echo '</div>'. "\n";// end columns
	echo '<div class="ph-cb"></div>';

	echo '</div>'. "\n";// end row
}
?>
views/wishlist/tmpl/index.html000064400000000054151167552070012530
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/wishlist/view.html.php000064400000006535151167552070012217
0ustar00<?php
/* @package Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @extension Phoca Extension
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');

class PhocaCartViewWishList extends JViewLegacy
{
	protected $t;
	protected $r;
	protected $s;
	protected $p;
	protected $u;

	function display($tpl = null)
	{
		$app								= JFactory::getApplication();
		$model								= $this->getModel();
		$document							= JFactory::getDocument();
		$this->p 							= $app->getParams();
		$this->u							= PhocacartUser::getUser();
		$this->s							= PhocacartRenderStyle::getStyles();

		$rights							= new PhocacartAccessRights();
		$this->t['can_display_price']	=
$rights->canDisplayPrice();

		//$this->t['categories']				=
$model->getCategoriesList();

		$this->t['cart_metakey'] 			= $this->p->get(
'cart_metakey', '' );
		$this->t['cart_metadesc'] 			= $this->p->get(
'cart_metadesc', '' );

        $this->t['display_webp_images']			=
$this->p->get( 'display_webp_images', 0 );
		//$this->t['hide_addtocart']			= $this->p->get(
'hide_addtocart', 0 );
		//$this->t['category_addtocart']		= $this->p->get(
'category_addtocart', 1 );



		$uri 						= \Joomla\CMS\Uri\Uri::getInstance();
		$this->t['action']			= $uri->toString();
		$this->t['actionbase64']	=
base64_encode($this->t['action']);
		$this->t['linkwishlist']	=
JRoute::_(PhocacartRoute::getWishListRoute());

		$wishlist = new PhocacartWishlist();
		$this->t['items'] = $wishlist->getFullItems();


		if (!empty($this->t['items'])) {

			foreach ($this->t['items'] as $k => $v) {

			/*	$this->t['items'][$k]['attr_options']=
PhocacartAttribute::getAttributesAndOptions((int)$v['id']);
				if
(!empty($this->t['items'][$k]['attr_options'])) {
					$this->t['value']['attrib'] = 1;
				}

				$this->t['items'][$k]['specifications']=
PhocacartSpecification::getSpecificationGroupsAndSpecifications((int)$v['id']);
				if
(!empty($this->t['items'][$k]['specifications'])) {
					foreach($this->t['items'][$k]['specifications']
as $k2 => $v2) {
						//$this->t['spec'][$k2] = $v2[0];
						$newV2 = $v2;
						unset($newV2[0]);
						if (!empty($newV2)) {
							foreach($newV2 as $k3 => $v3) {
								$this->t['spec'][$v2[0]][$v3['title']][$k] =
$v3['value'];
								//$this->t['spec'][$k2][$k3][$k3] =
$v3['value'];
							}
						}

					}
				}*/

				$stockStatus =
PhocacartStock::getStockStatus((int)$v['stock'],
(int)$v['min_quantity'],
(int)$v['min_multiple_quantity'],
(int)$v['stockstatus_a_id'], 
(int)$v['stockstatus_n_id']);
				$this->t['items'][$k]['stock'] =
PhocacartStock::getStockStatusOutput($stockStatus);
				if ($this->t['items'][$k]['stock'] !=
'') {
					$this->t['value']['stock'] = 1;
				}
			}
		}

		$media = PhocacartRenderMedia::getInstance('main');
		$media->loadBase();
        $media->loadSpec();

		$this->t['pathitem'] =
PhocacartPath::getPath('productimage');
		$this->_prepareDocument();
		parent::display($tpl);

	}

	protected function _prepareDocument() {
		PhocacartRenderFront::prepareDocument($this->document, $this->p,
false, false, JText::_('COM_PHOCACART_WISH_LIST'));
	}
}
?>