Example #1
0
<?php

/**
 * @package	HikaShop for Joomla!
 * @version	2.6.1
 * @author	hikashop.com
 * @copyright	(C) 2010-2016 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
if (!hikashop_acl('product/edit/variants') || empty($this->product->product_id)) {
    return;
}
?>
<div>
	<div style="float:right">
		<button class="btn btn-success" onclick="return window.productMgr.addVariants(this, <?php 
echo (int) $this->product->product_id;
?>
);"><img src="<?php 
echo HIKASHOP_IMAGES;
?>
add.png" alt="" style="vertical-align:middle;"/> <?php 
echo JText::_('HIKA_ADD_VARIANTS');
?>
</button>
	</div>
	<div id="hikashop_variant_bundle_toolbar" style="display:none;">
		<button class="btn btn-danger" onclick="return window.productMgr.deleteVariants(this, <?php 
echo (int) $this->product->product_id;
?>
Example #2
0
<?php

/**
 * @package	HikaShop for Joomla!
 * @version	2.6.1
 * @author	hikashop.com
 * @copyright	(C) 2010-2016 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
$ajax = false;
if (!empty($this->upload_ajax)) {
    $ajax = true;
}
$product_type = !empty($this->params->product_type) && $this->params->product_type == 'variant' ? 'variant' : 'product';
$upload = hikashop_acl('product/edit/files/upload');
$options = array('classes' => array('mainDiv' => 'hikashop_main_file_div', 'contentClass' => 'hikashop_product_files', 'btn_add' => 'hika_add_btn', 'btn_upload' => 'hika_upload_btn'), 'upload' => $upload, 'toolbar' => array($this->popup->display('<span class="hika_add_btn"></span>', JText::_('ADD_FILE'), hikashop_completeLink('product&task=selectfile&pid=' . @$this->product->product_id, true), 'hikashop_file_add', 750, 460, 'onclick="return window.productMgr.addFile(this,' . (int) @$this->product->product_id . ',\'' . $product_type . '\');"' . ' data-toggle="hk-tooltip" data-title="' . JText::_('ADD_FILE') . '"', '', 'link')), 'tooltip' => true, 'text' => $upload ? JText::_('HIKA_PRODUCT_FILES_EMPTY_UPLOAD') : JText::_('HIKA_PRODUCT_FILES_EMPTY'), 'uploader' => array('product', 'product_file'), 'vars' => array('product_id' => @$this->product->product_id, 'product_type' => $product_type, 'file_type' => 'file'), 'ajax' => $ajax);
$content = array();
if (!empty($this->product->files)) {
    foreach ($this->product->files as $k => $file) {
        $file->product_id = $this->product->product_id;
        $file->product_type = $product_type;
        $this->params = $file;
        $content[] = $this->loadTemplate('file_entry');
    }
}
if (empty($this->editing_variant)) {
    echo $this->uploaderType->displayFileMultiple('hikashop_product_file', $content, $options);
} else {
    echo $this->uploaderType->displayFileMultiple('hikashop_product_variant_file', $content, $options);
}
Example #3
0
 public function getUploadSetting($upload_key, $caller = '')
 {
     if (!hikashop_acl('product/edit')) {
         return false;
     }
     $product_id = JRequest::getInt('product_id', 0);
     if (empty($upload_key)) {
         return false;
     }
     $upload_value = null;
     $upload_keys = array('product_image' => array('type' => 'image', 'view' => 'form_image_entry', 'file_type' => 'product'), 'product_file' => array('type' => 'file', 'view' => 'form_file_entry', 'file_type' => 'file'));
     if (empty($upload_keys[$upload_key])) {
         return false;
     }
     $upload_value = $upload_keys[$upload_key];
     $config = hikashop_config(false);
     $options = array();
     if ($upload_value['type'] == 'image') {
         $options['upload_dir'] = $config->get('uploadfolder');
         $options['processing'] = 'resize';
     } else {
         $options['upload_dir'] = $config->get('uploadsecurefolder');
     }
     $options['max_file_size'] = null;
     $product_type = JRequest::getCmd('product_type', 'product');
     if (!in_array($product_type, array('product', 'variant'))) {
         $product_type = 'product';
     }
     return array('limit' => 1, 'type' => $upload_value['type'], 'layout' => 'product', 'view' => $upload_value['view'], 'options' => $options, 'extra' => array('product_id' => $product_id, 'file_type' => $upload_value['file_type'], 'product_type' => $product_type));
 }
Example #4
0
	<div class="hkc-lg-clear"></div>

<?php 
JPluginHelper::importPlugin('hikashop');
$dispatcher = JDispatcher::getInstance();
$html = array();
$dispatcher->trigger('onProductFormDisplay', array(&$this->product, &$html));
if (!empty($this->fields) && hikashop_acl('product/edit/customfields') || !empty($html)) {
    ?>
	<div class="hkc-xl-4 hkc-lg-6 hikashop_product_block hikashop_product_edit_fields"><div>
		<div class="hikashop_product_part_title hikashop_product_edit_fields_title"><?php 
    echo JText::_('FIELDS');
    ?>
</div>
<?php 
    if (!empty($this->fields) && hikashop_acl('product/edit/customfields')) {
        $this->fieldsClass->prefix = 'variant_' . time() . '_';
        foreach ($this->fields as $fieldName => $oneExtraField) {
            ?>
		<dl id="hikashop_product_<?php 
            echo $fieldName;
            ?>
" class="hika_options">
			<dt class="hikashop_product_<?php 
            echo $fieldName;
            ?>
"><label><?php 
            echo $this->fieldsClass->getFieldName($oneExtraField);
            ?>
</label></dt>
			<dd class="hikashop_product_<?php 
Example #5
0
File: form.php Project: rodhoff/MNW
		</table>
<?php 
    }
    ?>
	</div></div>
<?php 
}
$html = array();
$dispatcher->trigger('onProductDisplay', array(&$this->product, &$html));
if (!empty($html)) {
    echo '<div style="clear:both"></div>';
    foreach ($html as $h) {
        echo $h;
    }
}
if (hikashop_acl('product/edit/plugin')) {
    $html = array();
    JPluginHelper::importPlugin('hikashop');
    $dispatcher = JDispatcher::getInstance();
    $dispatcher->trigger('onProductBlocksDisplay', array(&$this->product, &$html));
    if (!empty($html)) {
        echo '<div style="clear:both"></div>';
        foreach ($html as $h) {
            echo $h;
        }
    }
}
?>
	</div></div>

	<div id="hikashop_product_edition_tab_2" style="display:none;">
Example #6
0
<?php

/**
 * @package	HikaShop for Joomla!
 * @version	2.6.0
 * @author	hikashop.com
 * @copyright	(C) 2010-2015 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
$ajax = false;
if (!empty($this->upload_ajax)) {
    $ajax = true;
}
$product_type = !empty($this->params->product_type) && $this->params->product_type == 'variant' ? 'variant' : 'product';
$upload = hikashop_acl('product/edit/images/upload');
$options = array('classes' => array('mainDiv' => 'hikashop_main_image_div', 'contentClass' => 'hikashop_product_images', 'firstImg' => 'hikashop_product_main_image_thumb', 'otherImg' => 'hikashop_small_image_div', 'btn_add' => 'hika_add_btn', 'btn_upload' => 'hika_upload_btn'), 'upload' => $upload, 'gallery' => $upload, 'text' => $upload ? JText::_('HIKA_PRODUCT_IMAGES_EMPTY_UPLOAD') : JText::_('HIKA_PRODUCT_IMAGES_EMPTY'), 'tooltip' => true, 'uploader' => array('product', 'product_image'), 'vars' => array('product_id' => @$this->product->product_id, 'product_type' => $product_type, 'file_type' => 'product'), 'ajax' => $ajax);
$content = array();
if (!empty($this->product->images)) {
    foreach ($this->product->images as $k => $image) {
        $image->product_id = $this->product->product_id;
        $image->product_type = $product_type;
        $this->params = $image;
        $content[] = $this->loadTemplate('image_entry');
    }
}
if (empty($this->editing_variant)) {
    echo $this->uploaderType->displayImageMultiple('hikashop_product_image', $content, $options);
} else {
    echo $this->uploaderType->displayImageMultiple('hikashop_product_variant_image', $content, $options);
}
Example #7
0
 public function addcharacteristic_ajax()
 {
     JRequest::checkToken('request') || die('Invalid Token');
     $tmpl = JRequest::getCmd('tmpl', '');
     $characteristic_parent_id = JRequest::getInt('characteristic_parent_id', 0);
     $characteristic_type = JRequest::getCmd('characteristic_type', '');
     $value = JRequest::getString('value', '');
     if (empty($value)) {
         return false;
     }
     $value = trim($value);
     $vendor_id = 0;
     $ret = false;
     if ($characteristic_type == 'value') {
         if (!hikashop_acl('characteristic/values/add')) {
             return false;
         }
         if ($characteristic_parent_id <= 0) {
             return false;
         }
         $characteristicClass = hikashop_get('class.characteristic');
         $characteristic_vendor_id = $vendor_id;
         if ($characteristic_vendor_id == 0 && hikashop_acl('characteristic/values/edit/vendor')) {
             $characteristic_vendor_id = (int) JRequest::getInt('characteristic_vendor_id', 0);
         }
         if ($characteristicClass->findValue($value, $characteristic_parent_id, $characteristic_vendor_id) > 0) {
             return false;
         }
         // hikamarket::deny('vendor', JText::sprintf('HIKAM_ACTION_ERROR', JText::_('HIKAM_WRONG_DATA')));
         $element = new stdClass();
         $element->characteristic_parent_id = $characteristic_parent_id;
         $element->characteristic_value = $value;
         if (!empty($characteristic_vendor_id)) {
             $element->characteristic_vendor_id = $characteristic_vendor_id;
         }
         $ret = $characteristicClass->save($element);
     } else {
         if (!hikashop_acl('characteristic/add')) {
             return false;
         }
         $characteristicClass = hikashop_get('class.characteristic');
         $characteristic_vendor_id = $vendor_id;
         if ($characteristic_vendor_id == 0 && hikashop_acl('characteristic/edit/vendor')) {
             $characteristic_vendor_id = (int) JRequest::getInt('characteristic_vendor_id', 0);
         }
         if ($characteristicClass->findValue($value, 0, $characteristic_vendor_id) > 0) {
             return false;
         }
         $element = new stdClass();
         $element->characteristic_parent_id = 0;
         $element->characteristic_value = $value;
         $element->characteristic_alias = strtolower($value);
         $ret = $characteristicClass->save($element);
     }
     if ($tmpl == 'json') {
         if (!empty($ret)) {
             $data = array('value' => $ret, 'name' => $value);
             echo json_encode($data);
         } else {
             echo '{err:"failed"}';
         }
         exit;
     }
     JRequest::setVar('layout', 'listing');
     return parent::display();
 }
Example #8
0
 public function publishVariant($variant_id)
 {
     if (!hikashop_acl('product/variant')) {
         return false;
     }
     if (empty($this->db)) {
         $this->db = JFactory::getDBO();
     }
     $variant = $this->get((int) $variant_id);
     if (!isset($variant->product_published)) {
         return false;
     }
     if ($variant->product_published) {
         $query = 'UPDATE ' . hikashop_table('product') . ' SET product_published = 0 WHERE product_id = ' . (int) $variant_id;
     } else {
         $query = 'UPDATE ' . hikashop_table('product') . ' SET product_published = 1 WHERE product_id = ' . (int) $variant_id;
     }
     $this->db->setQuery($query);
     $success = $this->db->query();
     return $success;
 }
Example #9
0
<?php

/**
 * @package	HikaShop for Joomla!
 * @version	2.6.0
 * @author	hikashop.com
 * @copyright	(C) 2010-2015 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
$acls = array('value' => hikashop_acl('product/edit/price/value'), 'tax' => hikashop_acl('product/edit/price/tax') && !$this->config->get('floating_tax_prices', 0), 'currency' => hikashop_acl('product/edit/price/currency') && count($this->currencies) > 1, 'quantity' => hikashop_acl('product/edit/price/quantity'), 'acl' => hikashop_level(2) && hikashop_acl('product/edit/price/acl'));
$show_minimal = !$acls['currency'] && !$acls['quantity'] && !$acls['acl'];
$jms_integration = false;
if (file_exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_multisites' . DS . 'helpers' . DS . 'utils.php')) {
    include_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_multisites' . DS . 'helpers' . DS . 'utils.php';
    if (class_exists('MultisitesHelperUtils') && method_exists('MultisitesHelperUtils', 'getComboSiteIDs')) {
        $comboSiteIDs = str_replace('class="inputbox"', 'class="inputbox chzn-done"', MultisitesHelperUtils::getComboSiteIDs('', 'price[price_site_id][##]', JText::_('SELECT_A_SITE')));
        $jms_integration = !empty($comboSiteIDs);
    }
}
$form_key = 'price';
if (!empty($this->editing_variant)) {
    $form_key = 'variantprice';
}
if (!$show_minimal) {
    ?>
<table style="width:100%">
	<thead>
		<tr>
			<th class="title"><?php 
    echo JText::_('PRICE');
Example #10
0
                    $this->editor->name = 'translation_' . $fieldName . '_' . $language_id;
                    $this->editor->content = @$translation->{$fieldName}->value;
                    echo $this->editor->display();
                    ?>
<div style="clear:both"></div>
					</div>
<?php 
                }
            }
        }
        ?>
	</div></div>

	</dl>
<?php 
        if (hikashop_acl('product/edit/description')) {
            ?>
	<div class="hikashop_product_title_div_wysiwyg"><?php 
            echo JText::_('DESCRIPTION');
            ?>
</div>
	<div><?php 
            $this->editor->name = 'translation_product_description_' . $language_id;
            $this->editor->content = @$translation->product_description->value;
            echo $this->editor->display();
            ?>
<div style="clear:both"></div>
	</div>
<?php 
        }
    }