Ejemplo n.º 1
0
 protected function getInput()
 {
     VmConfig::loadConfig();
     VmConfig::loadJLang('com_virtuemart');
     if (!is_array($this->value)) {
         $this->value = array($this->value);
     }
     $categorylist = ShopFunctions::categoryListTree($this->value);
     $name = $this->name;
     if ($this->multiple) {
         $name = $this->name;
         $this->multiple = ' multiple="multiple" ';
     }
     $id = VmHtml::ensureUniqueId('vmcategories');
     $html = '<select id="' . $id . '" class="inputbox"   name="' . $name . '" ' . $this->multiple . ' >';
     if (!$this->multiple) {
         $html .= '<option value="0">' . vmText::_('COM_VIRTUEMART_CATEGORY_FORM_TOP_LEVEL') . '</option>';
     }
     $html .= $categorylist;
     $html .= "</select>";
     return $html;
 }
Ejemplo n.º 2
0
    public static function list_option($name, $options, $list_selected = array(), $attrib = "onchange='submit();'", $key = 'value', $text = 'text', $zero = true, $tranlsate = true)
    {
        $doc = JFactory::getDocument();
        $doc->addScript(JUri::root() . '/media/system/js/jQuery-Plugin-For-Bootstrap-Button-Group-Toggles/select-toggleizer.js');
        ob_start();
        ?>
        <script type="text/javascript">
            jQuery(document).ready(function ($) {
                $('select[name="<?php 
        echo $name;
        ?>
"]').toggleize({});
            });
        </script>
        <?php 
        $js_content = ob_get_clean();
        $js_content = TSMUtility::remove_string_javascript($js_content);
        $doc->addScriptDeclaration($js_content);
        $attrib .= ' disable_chosen="true" ';
        $html = VmHtml::genericlist($options, $name, $attrib, $key, $text, $list_selected, false, $tranlsate);
        return $html;
    }
Ejemplo n.º 3
0
    public static function renderMetaEdit($obj)
    {
        $options = array('' => vmText::_('JGLOBAL_INDEX_FOLLOW'), 'noindex, follow' => vmText::_('JGLOBAL_NOINDEX_FOLLOW'), 'index, nofollow' => vmText::_('JGLOBAL_INDEX_NOFOLLOW'), 'noindex, nofollow' => vmText::_('JGLOBAL_NOINDEX_NOFOLLOW'), 'noodp, noydir' => vmText::_('COM_VIRTUEMART_NOODP_NOYDIR'), 'noodp, noydir, nofollow' => vmText::_('COM_VIRTUEMART_NOODP_NOYDIR_NOFOLLOW'));
        $html = '<table>
					' . VmHTML::row('input', 'COM_VIRTUEMART_CUSTOM_PAGE_TITLE', 'customtitle', $obj->customtitle) . '
					' . VmHTML::row('textarea', 'COM_VIRTUEMART_METAKEY', 'metakey', $obj->metakey, 'class="inputbox"', 80) . '
					' . VmHTML::row('textarea', 'COM_VIRTUEMART_METADESC', 'metadesc', $obj->metadesc, 'class="inputbox"', 80) . '
					' . VmHtml::row('selectList', 'COM_VIRTUEMART_METAROBOTS', 'metarobot', $obj->metarobot, $options) . '
					' . VmHTML::row('input', 'COM_VIRTUEMART_METAAUTHOR', 'metaauthor', $obj->metaauthor) . '
				</table>';
        return $html;
    }
Ejemplo n.º 4
0
    vmJsApi::popup('#full-tos', '#terms-of-service');
    if (!class_exists('VirtueMartCart')) {
        require VMPATH_SITE . DS . 'helpers' . DS . 'cart.php';
    }
    $cart = VirtuemartCart::getCart();
    $cart->prepareVendor();
    if (empty($tos) and !VmConfig::get('agree_to_tos_onorder', true)) {
        if (is_array($cart->BT) and !empty($cart->BT['tos'])) {
            $tos = $cart->BT['tos'];
        }
    }
}
if (!class_exists('VmHtml')) {
    require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
}
echo VmHtml::checkbox($_prefix . $field['name'], $tos, 1, 0, 'class="terms-of-service required"', 'tos');
if (VmConfig::get('oncheckout_show_legal_info', 1) and $app->isSite()) {
    ?>
<div class="terms-of-service">
	<label for="tos">
		<a href="<?php 
    echo JRoute::_('index.php?option=com_virtuemart&view=vendor&layout=tos&virtuemart_vendor_id=1', FALSE);
    ?>
" class="terms-of-service" id="terms-of-service" rel="facebox"
		   target="_blank">
			<span class="vmicon vm2-termsofservice-icon"></span>
			<?php 
    echo vmText::_('COM_VIRTUEMART_CART_TOS_READ_AND_ACCEPTED');
    ?>
		</a>
	</label>
Ejemplo n.º 5
0
    static function jDate($date = '', $name = "date", $id = NULL, $resetBt = TRUE, $yearRange = '')
    {
        if ($yearRange) {
            $yearRange = 'yearRange: "' . $yearRange . '",';
        }
        $test = (int) str_replace(array('-', ' ', ':'), '', $date);
        if (empty($test)) {
            $date = 0;
        }
        if (empty($id)) {
            $id = str_replace(array('[]', '[', ']'), '.', $name);
            $id = str_replace('..', '.', $id);
        }
        static $jDate;
        if (!class_exists('VmHtml')) {
            require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
        }
        $id = VmHtml::ensureUniqueId($id);
        $dateFormat = vmText::_('COM_VIRTUEMART_DATE_FORMAT_INPUT_J16');
        //="m/d/y"
        $search = array('m', 'd', 'Y');
        $replace = array('mm', 'dd', 'yy');
        $jsDateFormat = str_replace($search, $replace, $dateFormat);
        if ($date) {
            $formatedDate = JHtml::_('date', $date, $dateFormat);
        } else {
            $formatedDate = vmText::_('COM_VIRTUEMART_NEVER');
        }
        $display = '<input class="datepicker-db" id="' . $id . '" type="hidden" name="' . $name . '" value="' . $date . '" />';
        $display .= '<input id="' . $id . '_text" class="datepicker" type="text" value="' . $formatedDate . '" />';
        if ($resetBt) {
            $display .= '<span class="vmicon vmicon-16-logout icon-nofloat js-date-reset"></span>';
        }
        // If exist exit
        if ($jDate) {
            return $display;
        }
        self::addJScript('datepicker', '
			jQuery(document).ready( function($) {
			jQuery(document).on( "focus",".datepicker", function() {
				jQuery( this ).datepicker({
					changeMonth: true,
					changeYear: true,
					' . $yearRange . '
					dateFormat:"' . $jsDateFormat . '",
					altField: $(this).prev(),
					altFormat: "yy-mm-dd"
				});
			});
			jQuery(document).on( "click",".js-date-reset", function() {
				jQuery(this).prev("input").val("' . vmText::_('COM_VIRTUEMART_NEVER') . '").prev("input").val("0");
			});
		});
		');
        vmJsApi::css('ui/jquery.ui.all');
        $lg = JFactory::getLanguage();
        $lang = $lg->getTag();
        $vlePath = vmJsApi::setPath('i18n/jquery.ui.datepicker-' . $lang, FALSE, '', $minified = NULL, 'js', true);
        if (!file_exists($vlePath) or is_dir($vlePath)) {
            $lang = 'en-GB';
        }
        vmJsApi::addJScript('i18n/jquery.ui.datepicker-' . $lang);
        $jDate = TRUE;
        return $display;
    }
Ejemplo n.º 6
0
				class="hasTip"
				title="<?php 
echo vmText::_('COM_VIRTUEMART_PRODUCT_FORM_CALCULATE_PRICE_FINAL_TIP');
?>
">
			<?php 
echo vmText::_('COM_VIRTUEMART_PRODUCT_FORM_CALCULATE_PRICE_FINAL');
?>
			</span>
			</strong>

			<br />
 <?php 
// 							echo VmHtml::checkbox('override',$this->product->override);
$options = array(0 => vmText::_('COM_VIRTUEMART_DISABLED'), 1 => vmText::_('COM_VIRTUEMART_OVERWRITE_FINAL'), -1 => vmText::_('COM_VIRTUEMART_OVERWRITE_PRICE_TAX'));
echo VmHtml::radioList('mprices[override][' . $this->priceCounter . ']', $this->product->allPrices[$this->product->selectedPrice]['override'], $options, '', ' ');
?>
        </td>
		<td style="background: #d5d5d5;padding:0;width:1px;"></td>
        <td>
            <div style="font-weight: bold;">
				<?php 
echo vmText::_('COM_VIRTUEMART_PRODUCT_PRICE_QUANTITY_RANGE');
?>
            </div>
            <input type="text"
                   size="12"
                   style="text-align:right;" name="mprices[price_quantity_start][]"
                   value="<?php 
echo $this->product->allPrices[$this->product->selectedPrice]['price_quantity_start'];
?>
Ejemplo n.º 7
0
?>
                        </div>
                    </div>
                </div>
                <div class="row-fluid">
                    <div class="span12">
                        <h3 class="build-your-room"><?php 
echo JText::_('Build your room');
?>
</h3>
                    </div>
                </div>
                <div class="row-fluid">
                    <div class="span12">
                        <?php 
echo VmHtml::build_room(array(), "build_room", "", $privategrouptrip, $passenger_config);
?>

                    </div>
                </div>
                <div class="row-fluid">
                    <div class="span12">
                        <div class="pull-right">
                            <button type="submit" class="btn btn-primary btn-large control-next "><span title="" class="icon-next "></span><?php 
echo JText::_('Next');
?>
</button>
                        </div>
                    </div>
                </div>
?>



		<?php 
// Continue and Checkout Button
?>
		<div class="checkout-button-top">

			<?php 
// Terms Of Service Checkbox
JLoader::register('VmModel', JPATH_VM_ADMINISTRATOR . '/helpers/vmmodel.php');
$userFieldsModel = VmModel::getModel('userfields');
if ($userFieldsModel->getIfRequired('agreed')) {
    JLoader::register('VmHtml', JPATH_VM_ADMINISTRATOR . '/helpers/html.php');
    echo VmHtml::checkbox('tosAccepted', $this->cart->tosAccepted, 1, 0, 'class="terms-of-service"');
    if (VmConfig::get('oncheckout_show_legal_info', 1)) {
        ?>
					<div class="terms-of-service">

						<label for="tosAccepted">
							<a href="<?php 
        JRoute::_('index.php?option=com_virtuemart&view=vendor&layout=tos&virtuemart_vendor_id=1', FALSE);
        ?>
" class="terms-of-service" id="terms-of-service" rel="facebox"
							 target="_blank">
								<span class="vmicon vm2-termsofservice-icon"></span>
								<?php 
        echo JText::_('COM_VIRTUEMART_CART_TOS_READ_AND_ACCEPTED');
        ?>
							</a>
Ejemplo n.º 9
0
?>
<span class="price">$US 780</span></div>
                                <div class="span4"><?php 
echo JText::_('Balance');
?>
<span class="price">$US 780</span></div>
                            </div>
                        </div>

                    </div>
                </div>
                <div class="row-fluid">
                    <div class="span12">

                        <?php 
echo VmHtml::build_payment_cardit_card('payment', $total_price, 300);
?>

                    </div>
                </div>


                <div class="row-fluid">
                    <div class="span12">
                        <div class="pull-right">
                            <button type="submit" class="btn btn-primary btn-large control-pay-now "><span title="" class="icon-next "></span><?php 
echo JText::_('Pay now');
?>
</button>
                        </div>
                    </div>
Ejemplo n.º 10
0
foreach ($this->userFieldsCart["fields"] as $field) {
    if ($field['name'] == 'tos') {
        $tosenabled = true;
    }
}
if ($tosenabled) {
    ?>
                <section title=".squaredTwo">
					    <div class="squaredTwo">
						  <?php 
    if ($params->get('check_terms')) {
        $checked = 1;
    } else {
        $checked = 0;
    }
    echo VmHtml::checkbox('tos', $checked, 1, 0, 'class="terms-of-service" id="squaredTwo"');
    ?>
					      <label for="squaredTwo"></label>
					    </div>
				 </section>

			<a class="opg-link opg-text-small" style="cursor:pointer;" data-opg-modal="{target:'#full-tos'}"><?php 
    echo JText::_('COM_VIRTUEMART_CART_TOS_READ_AND_ACCEPTED');
    ?>
</a>
		<?php 
}
$showextraterms = $params->get('show_extraterms', 0);
if ($showextraterms) {
    ?>
		  <div id="privcacy_div" class="opg-width-1-1 opg-margin-small">
Ejemplo n.º 11
0
 function getLimitBox($sequence = 0)
 {
     $app = JFactory::getApplication();
     // Initialize variables
     $limits = array();
     $selected = $this->limit;
     // Build the select list
     if ($app->isAdmin()) {
         if (empty($sequence)) {
             $sequence = VmConfig::get('pagseq', 0);
         }
         if (!empty($sequence)) {
             $sequenceArray = explode(',', $sequence);
             if (count($sequenceArray > 1)) {
                 foreach ($sequenceArray as $items) {
                     $limits[$items] = JHtml::_('select.option', $items);
                 }
             }
         }
         if (empty($limits)) {
             $limits[15] = JHtml::_('select.option', 15);
             $limits[30] = JHtml::_('select.option', 30);
             $limits[50] = JHtml::_('select.option', 50);
             $limits[100] = JHtml::_('select.option', 100);
             $limits[200] = JHtml::_('select.option', 200);
             $limits[400] = JHtml::_('select.option', 400);
         }
         if (!array_key_exists($this->limit, $limits)) {
             $limits[$this->limit] = JHtml::_('select.option', $this->limit);
             ksort($limits);
         }
         $namespace = 'Joomla.';
         $id = VmHtml::ensureUniqueId('limit');
         $html = JHtml::_('select.genericlist', $limits, 'limit', 'class="inputbox" size="1" onchange="' . $namespace . 'submitform();"', 'value', 'text', $selected, $id);
     } else {
         $getArray = vRequest::getGet();
         $link = '';
         unset($getArray['limit']);
         foreach ($getArray as $key => $value) {
             if (is_array($value)) {
                 foreach ($value as $k => $v) {
                     $link .= '&' . urlencode($key) . '[' . urlencode($k) . ']' . '=' . urlencode($v);
                 }
             } else {
                 $link .= '&' . urlencode($key) . '=' . urlencode($value);
             }
         }
         $link = 'index.php?' . ltrim($link, '&');
         if (empty($sequence)) {
             $sequence = VmConfig::get('pagseq_' . $this->_perRow);
         }
         if (!empty($sequence)) {
             $sequenceArray = explode(',', $sequence);
             if (count($sequenceArray > 1)) {
                 foreach ($sequenceArray as $items) {
                     $limits[$items] = JHtml::_('select.option', JRoute::_($link . '&limit=' . $items, false), $items);
                 }
             }
         }
         if (empty($limits) or !is_array($limits)) {
             if ($this->_perRow === 1) {
                 $this->_perRow = 5;
             }
             $limits[$this->_perRow * 5] = JHtml::_('select.option', JRoute::_($link . '&limit=' . $this->_perRow * 5, false), $this->_perRow * 5);
             $limits[$this->_perRow * 10] = JHtml::_('select.option', JRoute::_($link . '&limit=' . $this->_perRow * 10, false), $this->_perRow * 10);
             $limits[$this->_perRow * 20] = JHtml::_('select.option', JRoute::_($link . '&limit=' . $this->_perRow * 20, false), $this->_perRow * 20);
             $limits[$this->_perRow * 50] = JHtml::_('select.option', JRoute::_($link . '&limit=' . $this->_perRow * 50, false), $this->_perRow * 50);
         }
         if (!array_key_exists($this->limit, $limits)) {
             $limits[$this->limit] = JHtml::_('select.option', JRoute::_($link . '&limit=' . $this->limit, false), $this->limit);
             ksort($limits);
         }
         $selected = JRoute::_($link . '&limit=' . $selected, false);
         $js = 'onchange="window.top.location.href=this.options[this.selectedIndex].value"';
         $id = VmHtml::ensureUniqueId('limit');
         $html = JHtml::_('select.genericlist', $limits, '', 'class="inputbox" size="1" ' . $js, 'value', 'text', $selected, $id);
     }
     return $html;
 }
Ejemplo n.º 12
0
        require VMPATH_SITE . DS . 'helpers' . DS . 'cart.php';
    }
    $cart = VirtuemartCart::getCart();
    $cart->prepareVendor();
    if (is_array($cart->BT) and !empty($cart->BT['tos'])) {
        $tos = $cart->BT['tos'];
    } else {
        $tos = 0;
    }
} else {
    $tos = $field['value'];
}
if (!class_exists('VmHtml')) {
    require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
}
echo VmHtml::checkbox($_prefix . $field['name'], $tos, 1, 0, 'class="terms-of-service" id="tos"');
if (VmConfig::get('oncheckout_show_legal_info', 1) and $app->isSite()) {
    ?>
<div class="terms-of-service-wrapper">

	<label for="tos">
		<a href="<?php 
    echo JRoute::_('index.php?option=com_virtuemart&view=vendor&layout=tos&virtuemart_vendor_id=1', FALSE);
    ?>
" class="terms-of-service" id="terms-of-service" rel="facebox"
		   target="_blank">
			<span class="icon-list"></span>
			<?php 
    echo vmText::_('COM_VIRTUEMART_CART_TOS_READ_AND_ACCEPTED');
    ?>
		</a>
Ejemplo n.º 13
0
                        </div>
                    </div>

                    <div class="joint_group_note joint_group_note_2">
                        <div class="row-fluid">
                            <div class="span12">
                                <?php 
echo $this->lipsum->words(50);
?>
                            </div>
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span12">
                            <?php 
echo VmHtml::build_excursion_addon(array(), "build_excursion_addon", "", $privategrouptrip, $passenger_config, $this->list_excursion_addon);
?>

                        </div>
                    </div>


                    <div class="row-fluid">
                        <div class="span12">
                            <div class="pull-right">
                                <button type="submit" class="btn btn-primary btn-large control-skip "><span title=""
                                                                                                            class="icon-next "></span><?php 
echo JText::_('Skip');
?>
                                </button>
                                <button type="submit" class="btn btn-primary btn-large control-next "><span title=""
Ejemplo n.º 14
0

                <div class="row-fluid">
                    <div class="span12">
                        <h3 class="pull-right build-your-room"><?php 
echo JText::_('Service total');
?>
</h3>
                    </div>
                </div>

                <div class="row-fluid">
                    <div class="span12">

                        <?php 
echo VmHtml::build_passenger_summary_confirm(array(), "passenger_summary", "", $privategrouptrip, $passenger_config, $this->product);
?>

                    </div>
                </div>
                <div class="row-fluid">
                    <div class="span12">
                        <div class="payment-overview">
                            <h4><?php 
echo JText::_('Tour fee summary');
?>
</h4>
                            <div class="row-fluid">
                                <div class="span4"><?php 
echo JText::_('Total fee');
?>
Ejemplo n.º 15
0
                    $checkValue = $customfield->override;
                }
                $titel = vmText::sprintf('COM_VIRTUEMART_CUSTOM_OVERRIDE', $checkValue);
                if ($customfield->disabler != 0) {
                    $titel = vmText::sprintf('COM_VIRTUEMART_CUSTOM_DISABLED', $checkValue);
                }
                if ($customfield->override != 0) {
                    $titel = vmText::sprintf('COM_VIRTUEMART_CUSTOM_OVERRIDE', $checkValue);
                }
            } else {
                if ($customfield->virtuemart_product_id == $this->product->product_parent_id) {
                    $titel = vmText::_('COM_VIRTUEMART_CUSTOM_INHERITED') . '<br/>';
                }
            }
            if (!empty($titel)) {
                $text = '<span style="white-space: nowrap;" > d:' . VmHtml::checkbox('field[' . $i . '][disabler]', $customfield->disabler, $checkValue) . ' o:' . VmHtml::checkbox('field[' . $i . '][override]</span>', $customfield->override, $checkValue);
            }
            $tables['fields'] .= '<tr class="removable">
							<td><span >' . $titel . $text . '<br />' . vmText::_($customfield->custom_title) . '</span></td>
							<td>' . $customfield->display . '</td>
							<td>
								<span class="vmicon vmicon-16-' . $cartIcone . '"></span>' . vmText::_($this->fieldTypes[$customfield->field_type]) . VirtueMartModelCustomfields::setEditCustomHidden($customfield, $i) . '</td>
							<td><span class="vmicon vmicon-16-move"></span>
								<span class="vmicon vmicon-16-remove"></span>' . '</td>
						 </tr>';
        }
        $i++;
    }
}
$emptyTable = '
				<tr>
Ejemplo n.º 16
0
		<span><span class="vmicon vm2-shipto-icon"></span>
			<?php 
echo vmText::_('COM_VIRTUEMART_USER_FORM_SHIPTO_LBL');
?>
</span>
		<?php 
// Output Bill To Address
?>
		<div class="output-shipto">
			<?php 
if (!class_exists('VmHtml')) {
    require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
}
if ($this->cart->user->virtuemart_user_id == 0) {
    echo vmText::_('COM_VIRTUEMART_USER_FORM_ST_SAME_AS_BT');
    echo VmHtml::checkbox('STsameAsBT', $this->cart->STsameAsBT, 1, 0, 'id="STsameAsBTjs"') . '<br />';
} else {
    if (!empty($this->cart->lists['shipTo'])) {
        echo $this->cart->lists['shipTo'];
    }
}
if (empty($this->cart->STsameAsBT) and !empty($this->cart->ST) and !empty($this->cart->STaddress['fields'])) {
    ?>
				<div id="output-shipto-display">
					<?php 
    foreach ($this->cart->STaddress['fields'] as $item) {
        if (!empty($item['value'])) {
            ?>
							<!-- <span class="titles"><?php 
            echo $item['title'];
            ?>
Ejemplo n.º 17
0
$i = 0;
?>
<table class="adminform">
	<tbody>
	<tr class="row<?php 
echo $i;
?>
">
		<td width="21%" valign="top">
			<?php 
$mail_options = array('customer' => vmText::_('COM_VIRTUEMART_PRODUCT_SHOPPERS'), 'notify' => vmText::_('COM_VIRTUEMART_PRODUCT_WAITING_LIST_USERLIST'));
$mail_default = 'notify';
if (VmConfig::get('stockhandle', 0) != 'disableadd' or empty($this->waitinglist)) {
    echo '<input type="hidden" name="customer_email_type" value="customer" id="customer_email_type0">';
} else {
    echo VmHtml::radioList('customer_email_type', $mail_default, $mail_options);
}
?>

			<div id="notify_particulars" style="padding-left:20px;">
				<div><input type="checkbox" name="notification_template" id="notification_template" value="1" CHECKED>
					<label for="notification_template">
						<span class="hasTip" title="<?php 
echo vmText::_('COM_VIRTUEMART_PRODUCT_USE_NOTIFY_TEMPLATE_TIP');
?>
">
						<?php 
echo vmText::_('COM_VIRTUEMART_PRODUCT_USE_NOTIFY_TEMPLATE');
?>
</span>
					</label>
Ejemplo n.º 18
0

				
					

			    <?php 
    if (!class_exists('VmHtml')) {
        require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
    }
    if (VmConfig::get('oncheckout_show_legal_info', 1)) {
        ?>

                <section title=".squaredTwo">
					    <div class="squaredTwo">
						  <?php 
        echo VmHtml::checkbox('tos', $this->cart->tos, 1, 0, 'class="terms-of-service" id="squaredTwo"');
        ?>
					      <label for="squaredTwo"></label>
					    </div>
				 </section>

			<a class="opg-link opg-text-small" style="cursor:pointer;" data-opg-modal="{target:'#full-tos'}"><?php 
        echo JText::_('COM_VIRTUEMART_CART_TOS_READ_AND_ACCEPTED');
        ?>
</a>
		    <div id="full-tos" class="opg-modal">
			  <div class="opg-modal-dialog opg-text-left">
			        <a class="opg-modal-close opg-close"></a>
					<strong><?php 
        echo JText::_('COM_VIRTUEMART_CART_TOS');
        ?>
Ejemplo n.º 19
0
 /**
  * @author Max Milbers
  * @param $product
  * @param $customfield
  */
 public function displayProductCustomfieldFE(&$product, &$customfields)
 {
     if (!class_exists('calculationHelper')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'calculationh.php';
     }
     $calculator = calculationHelper::getInstance();
     $selectList = array();
     $dynChilds = 1;
     //= array();
     $session = JFactory::getSession();
     $virtuemart_category_id = $session->get('vmlastvisitedcategoryid', 0, 'vm');
     foreach ($customfields as $k => &$customfield) {
         if (!isset($customfield->display)) {
             $customfield->display = '';
         }
         $calculator->_product = $product;
         if (!class_exists('vmCustomPlugin')) {
             require VMPATH_PLUGINLIBS . DS . 'vmcustomplugin.php';
         }
         if ($customfield->field_type == "E") {
             JPluginHelper::importPlugin('vmcustom');
             $dispatcher = JDispatcher::getInstance();
             $ret = $dispatcher->trigger('plgVmOnDisplayProductFEVM3', array(&$product, &$customfield));
             continue;
         }
         $fieldname = 'field[' . $product->virtuemart_product_id . '][' . $customfield->virtuemart_customfield_id . '][customfield_value]';
         $customProductDataName = 'customProductData[' . $product->virtuemart_product_id . '][' . $customfield->virtuemart_custom_id . ']';
         //This is a kind of fallback, setting default of custom if there is no value of the productcustom
         $customfield->customfield_value = empty($customfield->customfield_value) ? $customfield->custom_value : $customfield->customfield_value;
         $type = $customfield->field_type;
         $idTag = (int) $product->virtuemart_product_id . '-' . $customfield->virtuemart_customfield_id;
         $idTag = $idTag . 'customProductData';
         $idTag = VmHtml::ensureUniqueId($idTag);
         if (!class_exists('CurrencyDisplay')) {
             require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php';
         }
         $currency = CurrencyDisplay::getInstance();
         switch ($type) {
             case 'C':
                 $html = '';
                 $dropdowns = array();
                 if (isset($customfield->options->{$product->virtuemart_product_id})) {
                     $productSelection = $customfield->options->{$product->virtuemart_product_id};
                 } else {
                     $productSelection = false;
                 }
                 $ignore = array();
                 foreach ($customfield->options as $product_id => $variants) {
                     foreach ($variants as $k => $variant) {
                         //if(in_array($variant,$ignore)){ vmdebug('Product to ignore, continue',$product_id,$k,$variant);continue;}
                         if (!isset($dropdowns[$k]) or !is_array($dropdowns[$k])) {
                             $dropdowns[$k] = array();
                         }
                         if (!in_array($variant, $dropdowns[$k])) {
                             if ($k == 0 or !$productSelection) {
                                 $dropdowns[$k][] = $variant;
                             } else {
                                 if ($k > 0 and $productSelection[$k - 1] == $variants[$k - 1]) {
                                     $break = false;
                                     for ($h = 1; $h <= $k; $h++) {
                                         if ($productSelection[$h - 1] != $variants[$h - 1]) {
                                             //$ignore[] = $variant;
                                             $break = true;
                                         }
                                     }
                                     if (!$break) {
                                         $dropdowns[$k][] = $variant;
                                     }
                                 } else {
                                     //	break;
                                 }
                             }
                         }
                     }
                 }
                 $tags = array();
                 foreach ($customfield->selectoptions as $k => $soption) {
                     $options = array();
                     $selected = false;
                     foreach ($dropdowns[$k] as $i => $elem) {
                         $elem = trim((string) $elem);
                         $text = $elem;
                         if ($soption->clabel != '' and in_array($soption->voption, self::$dimensions)) {
                             $rd = $soption->clabel;
                             if (is_numeric($rd) and is_numeric($elem)) {
                                 $text = number_format(round((double) $elem, (int) $rd), $rd);
                             }
                             //vmdebug('($dropdowns[$k] in DIMENSION value = '.$elem.' r='.$rd.' '.$text);
                         } else {
                             if ($soption->voption === 'clabels' and $soption->clabel != '') {
                                 $text = vmText::_($elem);
                             }
                         }
                         if ($elem == '0') {
                             $text = vmText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION');
                         }
                         $options[] = array('value' => $elem, 'text' => $text);
                         if ($productSelection and $productSelection[$k] == $elem) {
                             $selected = $elem;
                         }
                     }
                     if (empty($selected)) {
                         $product->orderable = false;
                     }
                     $idTagK = $idTag . 'cvard' . $k;
                     if ($customfield->showlabels) {
                         if (in_array($soption->voption, self::$dimensions)) {
                             $soption->slabel = vmText::_('COM_VIRTUEMART_' . strtoupper($soption->voption));
                         } else {
                             if (!empty($soption->clabel) and !in_array($soption->voption, self::$dimensions)) {
                                 $soption->slabel = vmText::_($soption->clabel);
                             }
                         }
                         if (isset($soption->slabel)) {
                             $html .= '<span class="vm-cmv-label" >' . $soption->slabel . '</span>';
                         }
                     }
                     $attribs = array('class' => 'vm-chzn-select cvselection no-vm-bind', 'data-dynamic-update' => '1');
                     if ('productdetails' != vRequest::getCmd('view')) {
                         $attribs['reload'] = '1';
                     }
                     $html .= JHtml::_('select.genericlist', $options, $fieldname, $attribs, "value", "text", $selected, $idTagK);
                     $tags[] = $idTagK;
                 }
                 $Itemid = vRequest::getInt('Itemid', '');
                 // '&Itemid=127';
                 if (!empty($Itemid)) {
                     $Itemid = '&Itemid=' . $Itemid;
                 }
                 //create array for js
                 $jsArray = array();
                 $url = '';
                 foreach ($customfield->options as $product_id => $variants) {
                     $url = JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $product_id . $Itemid);
                     $jsArray[] = '["' . $url . '","' . implode('","', $variants) . '"]';
                 }
                 vmJsApi::addJScript('cvfind', false, false);
                 $jsVariants = implode(',', $jsArray);
                 $j = "\n\t\t\t\t\t\tjQuery('#" . implode(',#', $tags) . "').off('change',Virtuemart.cvFind);\n\t\t\t\t\t\tjQuery('#" . implode(',#', $tags) . "').on('change', { variants:[" . $jsVariants . "] },Virtuemart.cvFind);\n\t\t\t\t\t";
                 $hash = md5(implode('', $tags));
                 vmJsApi::addJScript('cvselvars' . $hash, $j, false);
                 //Now we need just the JS to reload the correct product
                 $customfield->display = $html;
                 break;
             case 'A':
                 $html = '';
                 //if($selectedFound) continue;
                 $options = array();
                 $productModel = VmModel::getModel('product');
                 //Note by Jeremy Magne (Daycounts) 2013-08-31
                 //Previously the the product model is loaded but we need to ensure the correct product id is set because the getUncategorizedChildren does not get the product id as parameter.
                 //In case the product model was previously loaded, by a related product for example, this would generate wrong uncategorized children list
                 $productModel->setId($customfield->virtuemart_product_id);
                 $uncatChildren = $productModel->getUncategorizedChildren($customfield->withParent);
                 if (!$customfield->withParent or $customfield->withParent and $customfield->parentOrderable) {
                     $options[0] = array('value' => JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $customfield->virtuemart_product_id, FALSE), 'text' => vmText::_('COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT'));
                 }
                 $selected = vRequest::getInt('virtuemart_product_id', 0);
                 $selectedFound = false;
                 if (empty($calculator) and $customfield->wPrice) {
                     if (!class_exists('calculationHelper')) {
                         require VMPATH_ADMIN . DS . 'helpers' . DS . 'calculationh.php';
                     }
                     $calculator = calculationHelper::getInstance();
                 }
                 $parentStock = 0;
                 foreach ($uncatChildren as $k => $child) {
                     if (!isset($child[$customfield->customfield_value])) {
                         vmdebug('The child has no value at index ' . $customfield->customfield_value, $customfield, $child);
                     } else {
                         $productChild = $productModel->getProduct((int) $child['virtuemart_product_id'], false);
                         if (!$productChild) {
                             continue;
                         }
                         $available = $productChild->product_in_stock - $productChild->product_ordered;
                         if (VmConfig::get('stockhandle', 'none') == 'disableit_children' and $available <= 0) {
                             continue;
                         }
                         $parentStock += $available;
                         $priceStr = '';
                         if ($customfield->wPrice) {
                             //$product = $productModel->getProductSingle((int)$child['virtuemart_product_id'],false);
                             $productPrices = $calculator->getProductPrices($productChild);
                             $priceStr = ' (' . $currency->priceDisplay($productPrices['salesPrice']) . ')';
                         }
                         $options[] = array('value' => JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $child['virtuemart_product_id']), 'text' => $child[$customfield->customfield_value] . $priceStr);
                         if ($selected == $child['virtuemart_product_id']) {
                             $selectedFound = true;
                             vmdebug($customfield->virtuemart_product_id . ' $selectedFound by vRequest ' . $selected);
                         }
                         //vmdebug('$child productId ',$child['virtuemart_product_id'],$customfield->customfield_value,$child);
                     }
                 }
                 if (!$selectedFound) {
                     $pos = array_search($customfield->virtuemart_product_id, $product->allIds);
                     if (isset($product->allIds[$pos - 1])) {
                         $selected = $product->allIds[$pos - 1];
                         //vmdebug($customfield->virtuemart_product_id.' Set selected to - 1 allIds['.($pos-1).'] = '.$selected.' and count '.$dynChilds);
                         //break;
                     } elseif (isset($product->allIds[$pos])) {
                         $selected = $product->allIds[$pos];
                         //vmdebug($customfield->virtuemart_product_id.' Set selected to allIds['.$pos.'] = '.$selected.' and count '.$dynChilds);
                     } else {
                         $selected = $customfield->virtuemart_product_id;
                         //vmdebug($customfield->virtuemart_product_id.' Set selected to $customfield->virtuemart_product_id ',$selected,$product->allIds);
                     }
                 }
                 $url = 'index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $selected;
                 $html .= JHtml::_('select.genericlist', $options, $fieldname, 'onchange="window.top.location.href=this.options[this.selectedIndex].value" size="1" class="vm-chzn-select no-vm-bind" data-dynamic-update="1" ', "value", "text", JRoute::_($url, false), $idTag);
                 vmJsApi::chosenDropDowns();
                 if ($customfield->parentOrderable == 0) {
                     if ($product->product_parent_id == 0) {
                         $product->orderable = FALSE;
                     } else {
                         $product->product_in_stock = $parentStock;
                     }
                 } else {
                 }
                 $dynChilds++;
                 $customfield->display = $html;
                 break;
                 /*Date variant*/
             /*Date variant*/
             case 'D':
                 if (empty($customfield->custom_value)) {
                     $customfield->custom_value = 'LC2';
                 }
                 //Customer selects date
                 if ($customfield->is_input) {
                     $customfield->display = '<span class="product_custom_date">' . vmJsApi::jDate($customfield->customfield_value, $customProductDataName) . '</span>';
                     //vmJsApi::jDate($field->custom_value, 'field['.$row.'][custom_value]','field_'.$row.'_customvalue').$priceInput;
                 } else {
                     $customfield->display = '<span class="product_custom_date">' . vmJsApi::date($customfield->customfield_value, $customfield->custom_value, TRUE) . '</span>';
                 }
                 break;
                 /* text area or editor No vmText, only displayed in BE */
             /* text area or editor No vmText, only displayed in BE */
             case 'X':
             case 'Y':
                 $customfield->display = $customfield->customfield_value;
                 break;
                 /* string or integer */
             /* string or integer */
             case 'B':
             case 'S':
             case 'M':
                 if ($type == 'M') {
                     $selectType = 'select.radiolist';
                     $class = '';
                 } else {
                     $selectType = 'select.genericlist';
                     if (!empty($customfield->is_input)) {
                         vmJsApi::chosenDropDowns();
                         $class = 'class="vm-chzn-select"';
                     }
                 }
                 if ($customfield->is_list and $customfield->is_list != 2) {
                     if (!empty($customfield->is_input)) {
                         $options = array();
                         $values = explode(';', $customfield->custom_value);
                         foreach ($values as $key => $val) {
                             if ($type == 'M') {
                                 $tmp = array('value' => $val, 'text' => $this->displayCustomMedia($val, 'product', $customfield->width, $customfield->height));
                                 $options[] = (object) $tmp;
                             } else {
                                 $options[] = array('value' => $val, 'text' => vmText::_($val));
                             }
                         }
                         $currentValue = $customfield->customfield_value;
                         $customfield->display = JHtml::_($selectType, $options, $customProductDataName . '[' . $customfield->virtuemart_customfield_id . ']', $class, 'value', 'text', $currentValue, $idTag);
                     } else {
                         if ($type == 'M') {
                             $customfield->display = $this->displayCustomMedia($customfield->customfield_value, 'product', $customfield->width, $customfield->height);
                         } else {
                             $customfield->display = vmText::_($customfield->customfield_value);
                         }
                     }
                 } else {
                     if (!empty($customfield->is_input)) {
                         if (!isset($selectList[$customfield->virtuemart_custom_id])) {
                             $tmpField = clone $customfield;
                             $tmpField->options = null;
                             $customfield->options[$customfield->virtuemart_customfield_id] = $tmpField;
                             $selectList[$customfield->virtuemart_custom_id] = $k;
                             $customfield->customProductDataName = $customProductDataName;
                         } else {
                             $customfields[$selectList[$customfield->virtuemart_custom_id]]->options[$customfield->virtuemart_customfield_id] = $customfield;
                             unset($customfields[$k]);
                             //$customfield->options[$customfield->virtuemart_customfield_id] = $customfield;
                         }
                         $default = reset($customfields[$selectList[$customfield->virtuemart_custom_id]]->options);
                         foreach ($customfields[$selectList[$customfield->virtuemart_custom_id]]->options as &$productCustom) {
                             $price = self::_getCustomPrice($productCustom->customfield_price, $currency, $calculator);
                             if ($type == 'M') {
                                 $productCustom->text = $this->displayCustomMedia($productCustom->customfield_value, 'product', $customfield->width, $customfield->height) . ' ' . $price;
                             } else {
                                 $trValue = vmText::_($productCustom->customfield_value);
                                 if ($productCustom->customfield_value != $trValue and strpos($trValue, '%1') !== false) {
                                     $productCustom->text = vmText::sprintf($productCustom->customfield_value, $price);
                                 } else {
                                     $productCustom->text = $trValue . ' ' . $price;
                                 }
                             }
                         }
                         $customfields[$selectList[$customfield->virtuemart_custom_id]]->display = JHtml::_($selectType, $customfields[$selectList[$customfield->virtuemart_custom_id]]->options, $customfields[$selectList[$customfield->virtuemart_custom_id]]->customProductDataName, $class, 'virtuemart_customfield_id', 'text', $default->customfield_value, $idTag);
                         //*/
                     } else {
                         if ($type == 'M') {
                             $customfield->display = $this->displayCustomMedia($customfield->customfield_value, 'product', $customfield->width, $customfield->height);
                         } else {
                             $customfield->display = vmText::_($customfield->customfield_value);
                         }
                     }
                 }
                 break;
             case 'Z':
                 if (empty($customfield->customfield_value)) {
                     break;
                 }
                 $html = '';
                 $q = 'SELECT * FROM `#__virtuemart_categories_' . VmConfig::$vmlang . '` as l INNER JOIN `#__virtuemart_categories` AS c using (`virtuemart_category_id`) WHERE `published`=1 AND l.`virtuemart_category_id`= "' . (int) $customfield->customfield_value . '" ';
                 $db = JFactory::getDBO();
                 $db->setQuery($q);
                 if ($category = $db->loadObject()) {
                     if (empty($category->virtuemart_category_id)) {
                         break;
                     }
                     $q = 'SELECT `virtuemart_media_id` FROM `#__virtuemart_category_medias`WHERE `virtuemart_category_id`= "' . $category->virtuemart_category_id . '" ';
                     $db->setQuery($q);
                     $thumb = '';
                     if ($media_id = $db->loadResult()) {
                         $thumb = $this->displayCustomMedia($media_id, 'category', $customfield->width, $customfield->height);
                     }
                     $customfield->display = JHtml::link(JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $category->virtuemart_category_id), $thumb . ' ' . $category->category_name, array('title' => $category->category_name, 'target' => '_blank'));
                 }
                 break;
             case 'R':
                 if (empty($customfield->customfield_value)) {
                     $customfield->display = 'customfield related product has no value';
                     break;
                 }
                 $pModel = VmModel::getModel('product');
                 $related = $pModel->getProduct((int) $customfield->customfield_value, TRUE, $customfield->wPrice, TRUE, 1);
                 if (!$related) {
                     break;
                 }
                 $thumb = '';
                 if ($customfield->wImage) {
                     if (!empty($related->virtuemart_media_id[0])) {
                         $thumb = $this->displayCustomMedia($related->virtuemart_media_id[0], 'product', $customfield->width, $customfield->height) . ' ';
                     } else {
                         $thumb = $this->displayCustomMedia(0, 'product', $customfield->width, $customfield->height) . ' ';
                     }
                 }
                 $customfield->display = shopFunctionsF::renderVmSubLayout('related', array('customfield' => $customfield, 'related' => $related, 'thumb' => $thumb));
                 break;
         }
     }
 }
								</span>
							</div>
						</td>
						<td>
							<input type="text" size="12" style="text-align:right;" name="product_override_price" value="<?php 
echo $this->product->product_override_price;
?>
"/>
							<?php 
echo $this->vendor_currency;
?>
						</td>
						<td><?php 
// 							echo VmHtml::checkbox('override',$this->product->override);
$options = array(0 => 'Disabled', 1 => 'Overwrite final', -1 => 'Overwrite price to tax');
echo VmHtml::radioList('override', $this->product->override, $options);
?>
						</td>
					</tr>
				</table>
			</fieldset> <!-- Product rules overrides -->
			<fieldset>
			<legend>
			<?php 
echo JText::_('COM_VIRTUEMART_PRODUCT_FORM_RULES_OVERRIDES');
?>
</legend>
			<table class="adminform">
				<tr class="row0">
					<td width="17%"><div style="text-align: right; font-weight: bold;">
						<?php 
Ejemplo n.º 21
0
                }
                $titel = vmText::sprintf('COM_VIRTUEMART_CUSTOM_OVERRIDE', $checkValue) . '</br>';
                if ($customfield->disabler != 0) {
                    $titel = vmText::sprintf('COM_VIRTUEMART_CUSTOM_DISABLED', $checkValue) . '</br>';
                }
                if ($customfield->override != 0) {
                    $titel = vmText::sprintf('COM_VIRTUEMART_CUSTOM_OVERRIDE', $checkValue) . '</br>';
                }
            } else {
                if ($customfield->virtuemart_product_id == $this->product->product_parent_id) {
                    $titel = vmText::_('COM_VIRTUEMART_CUSTOM_INHERITED') . '</br>';
                }
            }
            if (!empty($titel)) {
                $text = '<span style="white-space: nowrap;" class="hasTip" title="' . htmlentities(vmText::_('COM_VIRTUEMART_CUSTOMFLD_DIS_DER_TIP')) . '">d:' . VmHtml::checkbox('field[' . $i . '][disabler]', $customfield->disabler, $checkValue) . '</span>
							<span style="white-space: nowrap;" class="hasTip" title="' . htmlentities(vmText::_('COM_VIRTUEMART_DIS_DER_CUSTOMFLD_OVERR_DER_TIP')) . '">o:' . VmHtml::checkbox('field[' . $i . '][override]', $customfield->override, $checkValue) . '</span>';
            }
            $tables['fields'] .= '<tr class="removable">
							<td >
							<b>' . vmText::_($type) . '</b> ' . vmText::_($customfield->custom_title) . '</span><br/>
								' . $titel . ' ' . $text . '
								<span class="vmicon vmicon-16-' . $cartIcone . '"></span>
								<span class="vmicon vmicon-16-move"></span>
								<span class="vmicon vmicon-16-remove"></span>

						' . VirtueMartModelCustomfields::setEditCustomHidden($customfield, $i) . '</td>
							<td ' . $colspan . '>' . $customfield->display . '</td>
						 </tr>';
        }
        $i++;
    }
Ejemplo n.º 22
0
		<?php 
echo JText::_('COM_VIRTUEMART_USER_FORM_ADD_SHIPTO_LBL');
?>
		</a>
		<?php 
// Output Bill To Address
?>
		<div class="output-shipto">
			<?php 
if (empty($this->cart->STaddress['fields'])) {
    echo JText::sprintf('COM_VIRTUEMART_USER_FORM_EDIT_BILLTO_EXPLAIN', JText::_('COM_VIRTUEMART_USER_FORM_ADD_SHIPTO_LBL'));
} else {
    if (!class_exists('VmHtml')) {
        require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
    }
    echo JText::_('COM_VIRTUEMART_USER_FORM_ST_SAME_AS_BT') . VmHtml::checkbox('STsameAsBT', $this->cart->STsameAsBT) . '<br />';
    foreach ($this->cart->STaddress['fields'] as $item) {
        if (!empty($item['value'])) {
            ?>
			
			<!-- <span class="titles"><?php 
            echo $item['title'];
            ?>
</span> -->
			
			<?php 
            if ($item['name'] == 'first_name' || $item['name'] == 'middle_name' || $item['name'] == 'zip') {
                ?>
			<span class="values<?php 
                echo '-' . $item['name'];
                ?>
Ejemplo n.º 23
0
		<span><span class="vmicon vm2-shipto-icon"></span>
			<?php 
echo tsmText::_('COM_VIRTUEMART_USER_FORM_SHIPTO_LBL');
?>
</span>
		<?php 
// Output Bill To Address
?>
		<div class="output-shipto">
			<?php 
if (!class_exists('VmHtml')) {
    require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
}
if ($this->cart->user->virtuemart_user_id == 0) {
    echo tsmText::_('COM_VIRTUEMART_USER_FORM_ST_SAME_AS_BT');
    echo VmHtml::checkbox('STsameAsBT', $this->cart->STsameAsBT, 1, 0, 'id="STsameAsBTjs" data-dynamic-update=1') . '<br />';
} else {
    if (!empty($this->cart->lists['shipTo'])) {
        echo $this->cart->lists['shipTo'];
    }
}
if (empty($this->cart->STsameAsBT) and !empty($this->cart->ST) and !empty($this->cart->STaddress['fields'])) {
    ?>
				<div id="output-shipto-display">
					<?php 
    foreach ($this->cart->STaddress['fields'] as $item) {
        if (!empty($item['value'])) {
            ?>
							<!-- <span class="titles"><?php 
            echo $item['title'];
            ?>
Ejemplo n.º 24
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     //Load languages
     $language = JFactory::getLanguage();
     $language->load('plg_k2_k2mart', JPATH_ADMINISTRATOR);
     $language->load('com_virtuemart', JPATH_ADMINISTRATOR);
     //Get params
     $params = JComponentHelper::getParams('com_k2mart');
     $mainframe = JFactory::getApplication();
     $db = JFactory::getDBO();
     //Add scripts and styles
     $document = JFactory::getDocument();
     $document->addStyleSheet(JURI::root(true) . '/plugins/k2/k2mart/tmpl/admin/css/admin.style.css');
     $document->addStyleSheet(JURI::root(true) . '/administrator/components/com_k2mart/css/chosen.css');
     $document->addScript(JURI::root(true) . '/plugins/k2/k2mart/includes/js/admin.k2mart.js');
     $document->addScript(JURI::root(true) . '/administrator/components/com_k2mart/js/chosen.jquery.min.js');
     $document->addScript(JURI::root(true) . '/components/com_virtuemart/assets/js/fancybox/jquery.fancybox-1.3.4.js');
     $document->addScript(JURI::root(true) . '/administrator/components/com_virtuemart/assets/js/vm2admin.js');
     $document->addScript(JURI::root(true) . '/administrator/components/com_virtuemart/assets/js/jquery.coookie.js');
     //Get K2 Item
     $itemID = JRequest::getInt('cid');
     $productID = 0;
     if ($itemID) {
         $query = "SELECT referenceID FROM #__k2mart WHERE baseID = {$itemID}";
         $db->setQuery($query);
         $productID = $db->loadResult();
     }
     //Include Virtuemart classes
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
     $config = VmConfig::loadConfig();
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'shopfunctions.php';
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'html.php';
     JModel::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models');
     //Get product
     $model = JModel::getInstance('Product', 'VirtuemartModel');
     $product = $model->getProductSingle($productID, false);
     //Get product children
     $product->children = method_exists($model, 'getProductChilds') ? $model->getProductChilds($productID) : $model->getProductChildIds($productID);
     //Get product parent
     JModel::addIncludePath(JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'models');
     $K2Model = JModel::getInstance('Itemlist', 'K2Model');
     $tree = $K2Model->getCategoryTree($params->get('catalogRoot', 0));
     $query = "SELECT id AS value, title AS text FROM #__k2_items WHERE catid IN(" . implode(',', $tree) . ")";
     $db->setQuery($query);
     $items = $db->loadObjectList();
     $option = new JObject();
     $option->value = 0;
     $option->text = JText::_('K2MART_NONE');
     array_unshift($items, $option);
     $parent = 0;
     if ($product->product_parent_id) {
         $query = "SELECT baseID FROM #__k2mart WHERE referenceID = {$product->product_parent_id}";
         $db->setQuery($query);
         $parent = $db->loadResult();
     }
     $lists['product_parent_id'] = JHTML::_('select.genericlist', $items, 'product_parent_id', 'class="inputbox"', 'value', 'text', $parent);
     //Get category tree
     if (isset($product->categories)) {
         $lists['categories'] = ShopFunctions::categoryListTree($product->categories);
     } else {
         $lists['categories'] = ShopFunctions::categoryListTree();
     }
     //Get vendors
     if (Vmconfig::get('multix', 'none') !== 'none') {
         $lists['vendors'] = Shopfunctions::renderVendorList($product->virtuemart_vendor_id);
     }
     //Get images
     $model->addImages($product);
     if (is_array($product->images) && isset($product->images[0])) {
         $product->image = $product->images[0];
     } else {
         $product->image = new JObject();
         $product->image->virtuemart_media_id = 0;
         $product->image->file_title = '';
         $product->image->file_description = '';
         $product->image->file_meta = '';
         $product->image->file_url = '';
         $product->image->file_url_thumb = '';
         $product->image->file_title = '';
     }
     //Get manufacturers
     $model = JModel::getInstance('Manufacturer', 'VirtuemartModel');
     $manufacturers = $model->getManufacturerDropdown($product->virtuemart_manufacturer_id);
     if (count($manufacturers) > 0) {
         $lists['manufacturers'] = JHTML::_('select.genericlist', $manufacturers, 'virtuemart_manufacturer_id', 'class="inputbox"', 'value', 'text', $product->virtuemart_manufacturer_id);
     }
     //Get shopper groups
     if (isset($product->shoppergroups)) {
         $lists['shopperGroups'] = ShopFunctions::renderShopperGroupList($product->shoppergroups, true);
     }
     //Get product price
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'calculationh.php';
     $calculator = calculationHelper::getInstance();
     $product->prices = $calculator->getProductPrices($product);
     // Get product price override options
     $options = array(0 => 'Disabled', 1 => 'Overwrite final', -1 => 'Overwrite price to tax');
     $lists['price_override_options'] = VmHtml::radioList('override', $product->override, $options);
     // Get tax rules
     $dbTax = '';
     foreach ($calculator->rules['DBTax'] as $rule) {
         $dbTax .= $rule['calc_name'] . '<br />';
     }
     $dbTaxRules = $dbTax;
     $tax = JText::_('COM_VIRTUEMART_TAX_EFFECTING');
     foreach ($calculator->rules['Tax'] as $rule) {
         $tax .= $rule['calc_name'] . '<br />';
     }
     $taxRules = $tax;
     $daTax = '';
     foreach ($calculator->rules['DATax'] as $rule) {
         $daTax .= $rule['calc_name'] . '<br />';
     }
     $daTaxRules = $daTax;
     // Removed in VM 2.0.4
     //$override = $calculator->override;
     //$product_override_price = $calculator->product_override_price;
     if (!isset($product->product_tax_id)) {
         $product->product_tax_id = 0;
     }
     $lists['taxrates'] = ShopFunctions::renderTaxList($product->product_tax_id, 'product_tax_id');
     // Discounts
     if (!isset($product->product_discount_id)) {
         $product->product_discount_id = 0;
     }
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models' . DS . 'calc.php';
     $discounts = VirtueMartModelCalc::getDiscounts();
     $discountrates = array();
     $discountrates[] = JHTML::_('select.option', '-1', JText::_('COM_VIRTUEMART_PRODUCT_DISCOUNT_NONE'), 'product_discount_id');
     $discountrates[] = JHTML::_('select.option', '0', JText::_('COM_VIRTUEMART_PRODUCT_DISCOUNT_NO_SPECIAL'), 'product_discount_id');
     foreach ($discounts as $discount) {
         $discountrates[] = JHTML::_('select.option', $discount->virtuemart_calc_id, $discount->calc_name, 'product_discount_id');
     }
     $lists['discounts'] = JHTML::_('select.genericlist', $discountrates, 'product_discount_id', '', 'product_discount_id', 'text', $product->product_discount_id);
     //Define Virtuemart image path
     if (is_Dir(VmConfig::get('vmtemplate') . DS . 'images' . DS . 'availability' . DS)) {
         $imagePath = VmConfig::get('vmtemplate') . '/images/availability/';
     } else {
         $imagePath = '/components/com_virtuemart/assets/images/availability/';
     }
     // Get currencies
     $model = JModel::getInstance('Currency', 'VirtuemartModel');
     $vendorModel = JModel::getInstance('Vendor', 'VirtuemartModel');
     $vendorModel->setId(1);
     $vendor = $vendorModel->getVendor();
     if (empty($product->product_currency)) {
         $product->product_currency = $vendor->vendor_currency;
     }
     $lists['currencies'] = JHTML::_('select.genericlist', $model->getCurrencies(), 'product_currency', '', 'virtuemart_currency_id', 'currency_name', $product->product_currency);
     $currency = $model->getCurrency($product->product_currency);
     $productCurrency = $currency->currency_symbol;
     $currency = $model->getCurrency($vendor->vendor_currency);
     $vendorCurrency = $currency->currency_symbol;
     //Get dimensions
     $lists['product_weight_uom'] = ShopFunctions::renderWeightUnitList('product_weight_uom', !isset($product->product_weight_uom) ? $config->get('weight_unit_default') : $product->product_weight_uom);
     $lists['product_lwh_uom'] = ShopFunctions::renderLWHUnitList('product_lwh_uom', !isset($product->product_lwh_uom) ? $config->get('lwh_unit_default') : $product->product_lwh_uom);
     //Get custom fields
     $model = JModel::getInstance('CustomFields', 'VirtuemartModel');
     $fieldTypes = $model->getField_types();
     $customsList = JHTML::_('select.genericlist', $model->getCustomsList(), 'customlist');
     if (!isset($product->customfields)) {
         $product->customfields = array();
     }
     //Set some script variables
     $document->addScriptDeclaration('var k2martVmImagePath="' . JURI::root(true) . $imagePath . '"; var tip_image="' . JURI::root(true) . '/components/com_virtuemart/assets/js/images/vtip_arrow.png"; var k2martVmCustomFieldsNum = "' . count($product->customfields) . '";');
     //Edit icon
     $application = JFactory::getApplication('admin');
     $editIcon = JURI::root(true) . '/administrator/templates/' . $application->getTemplate() . '/images/menu/icon-16-edit.png';
     //Output
     ob_start();
     include JPATH_SITE . DS . 'plugins' . DS . 'k2' . DS . 'k2mart' . DS . 'tmpl' . DS . 'admin' . DS . 'form.php';
     $contents = ob_get_clean();
     return $contents;
 }
Ejemplo n.º 25
0
echo JText::_('COM_VIRTUEMART_USER_FORM_SHIPTO_LBL');
?>
</span>
		<?php 
// Output Bill To Address
?>
		<div class="output-shipto">
			<?php 
if (empty($this->cart->STaddress['fields'])) {
    echo JText::sprintf('COM_VIRTUEMART_USER_FORM_EDIT_BILLTO_EXPLAIN', JText::_('COM_VIRTUEMART_USER_FORM_ADD_SHIPTO_LBL'));
} else {
    if (!class_exists('VmHtml')) {
        require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
    }
    echo JText::_('COM_VIRTUEMART_USER_FORM_ST_SAME_AS_BT');
    echo VmHtml::checkbox('STsameAsBTjs', $this->cart->STsameAsBT) . '<br />';
    ?>
				<div id="output-shipto-display">
					<?php 
    foreach ($this->cart->STaddress['fields'] as $item) {
        if (!empty($item['value'])) {
            ?>
							<!-- <span class="titles"><?php 
            echo $item['title'];
            ?>
</span> -->
							<?php 
            if ($item['name'] == 'first_name' || $item['name'] == 'middle_name' || $item['name'] == 'zip') {
                ?>
								<span class="values<?php 
                echo '-' . $item['name'];
				class="hasTip"
				title="<?php 
echo JText::_('COM_VIRTUEMART_PRODUCT_FORM_CALCULATE_PRICE_FINAL_TIP');
?>
">
			<?php 
echo JText::_('COM_VIRTUEMART_PRODUCT_FORM_CALCULATE_PRICE_FINAL');
?>
			</span>
			</strong>

			<br />
 <?php 
// 							echo VmHtml::checkbox('override',$this->product->override);
$options = array(0 => JText::_('COM_VIRTUEMART_OVERWRITE_OFF'), 1 => JText::_('COM_VIRTUEMART_OVERWRITE_FINAL'), -1 => JText::_('COM_VIRTUEMART_OVERWRITE_PRICE_TAX'));
echo VmHtml::radioList('mprices[override][' . $this->priceCounter . ']', $this->tempProduct->override, $options, '', ' ');
?>
        </td>
		<td style="background: #d5d5d5;padding:0;width:1px;"></td>
        <td>
            <div style="font-weight: bold;">
				<?php 
echo JText::_('COM_VIRTUEMART_PRODUCT_PRICE_QUANTITY_RANGE');
?>
            </div>
            <input type="text"
                   size="12"
                   style="text-align:right;" name="mprices[price_quantity_start][]"
                   value="<?php 
echo $this->tempProduct->price_quantity_start;
?>
Ejemplo n.º 27
0
    /**
     * This displays a media handler. It displays the full and the thumb (icon) of the media.
     * It also gives a possibility to upload/change/thumbnail media
     *
     * @param string $imageArgs html atttributes, Just for displaying the fullsized image
     */
    public function displayFileHandler()
    {
        VmConfig::loadJLang('com_virtuemart_media');
        $this->addHiddenByType();
        $html = '<fieldset class="checkboxes">';
        $html .= '<legend>' . vmText::_('COM_VIRTUEMART_IMAGE_INFORMATION') . '</legend>';
        $html .= '<div class="vm__img_autocrop">';
        $imageArgs = array('id' => 'vm_display_image');
        $html .= $this->displayMediaFull($imageArgs, false, '', false) . '</div>';
        //This makes problems, when there is already a form, and there would be form in a form. breaks js in some browsers
        //		$html .= '<form name="adminForm" id="adminForm" method="post" enctype="multipart/form-data">';
        $html .= ' <table class="adminform"> ';
        if ($this->published || $this->virtuemart_media_id === 0) {
            $checked = 1;
        } else {
            $checked = 0;
        }
        $html .= '<tr>';
        //  The following was removed bacause the check box (publish/unpublish) was not functioning...
        // 			$this->media_published = $this->published;
        $html .= '<td class="labelcell" style="width:20em">
	<label for="published">' . vmText::_('COM_VIRTUEMART_FILES_FORM_FILE_PUBLISHED') . '</label>
</td>
<td>';
        if (!class_exists('VmHtml')) {
            require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
        }
        $html .= VmHtml::checkbox('media[media_published]', $checked, 1, 0, 'class="inputbox"', 'media[media_published]');
        //<input type="checkbox" class="inputbox" id="media_published'.$identify.'" name="media_published'.$identify.'" '.$checked.' size="16" value="1" />
        $html .= '</td>';
        $imgWidth = VmConfig::get('img_width', '');
        if (!empty($imgWidth)) {
            $imgWidth = 'width:' . VmConfig::get('img_width', 90) . 'px;';
        } else {
            $imgWidth = 'max-width:200px;width:auto;';
        }
        $imgHeight = VmConfig::get('img_height', '');
        if (!empty($imgHeight)) {
            $imgHeight = 'height:' . VmConfig::get('img_height', 90) . 'px;';
        } else {
            $imgHeight = '';
        }
        $html .= '<td rowspan = "8" min-width = "' . (VmConfig::get('img_width', 90) + 10) . 'px" overflow="hidden">';
        $thumbArgs = array('class' => 'vm_thumb_image', 'style' => 'overflow: auto;' . $imgWidth . $imgHeight);
        $html .= $this->displayMediaThumb($thumbArgs);
        //JHTML::image($this->file_url_thumb, 'thumbnail', 'id="vm_thumb_image" style="overflow: auto; float: right;"');
        // $html .= $this->displayMediaThumb('',false,'id="vm_thumb_image" style="overflow: auto; float: right;"');
        $html .= '</td>';
        $html .= '</tr>';
        if (vmAccess::manager('media')) {
            $readonly = 'readonly';
        } else {
            $readonly = '';
        }
        $html .= $this->displayRow('COM_VIRTUEMART_FILES_FORM_FILE_TITLE', 'file_title');
        $html .= $this->displayRow('COM_VIRTUEMART_FILES_FORM_FILE_DESCRIPTION', 'file_description');
        $html .= $this->displayRow('COM_VIRTUEMART_FILES_FORM_FILE_META', 'file_meta');
        $html .= $this->displayRow('COM_VIRTUEMART_FILES_FORM_FILE_CLASS', 'file_class');
        $html .= $this->displayRow('COM_VIRTUEMART_FILES_FORM_FILE_URL', 'file_url', $readonly);
        //remove the file_url_thumb in case it is standard
        if (!empty($this->file_url_thumb) and is_a($this, 'VmImage')) {
            $file_url_thumb = $this->createThumbFileUrl();
            //vmdebug('my displayFileHandler ',$this,$file_url_thumb);
            if ($this->file_url_thumb == $file_url_thumb) {
                $this->file_url_thumb = vmText::sprintf('COM_VIRTUEMART_DEFAULT_URL', $file_url_thumb);
            }
        }
        $html .= $this->displayRow('COM_VIRTUEMART_FILES_FORM_FILE_URL_THUMB', 'file_url_thumb', $readonly);
        $this->addMediaAttributesByType();
        $html .= '<tr>
				<td class="labelcell">' . vmText::_('COM_VIRTUEMART_FILES_FORM_ROLE') . '</td>
				<td><fieldset class="checkboxes">' . JHtml::_('select.radiolist', $this->getOptions($this->_mRoles), 'media[media_roles]', '', 'value', 'text', $this->media_role) . '</fieldset></td></tr>';
        // 			$html .= '<tr><td class="labelcell">'.VmHTML::checkbox('file_is_forSale', $this->file_is_forSale);
        // 			$html .= VmHTML::checkbox('file_is_downloadable', $this->file_is_downloadable);
        if (!empty($this->file_type)) {
            $html .= '<tr>
					<td class="labelcell">' . vmText::_('COM_VIRTUEMART_FILES_FORM_LOCATION') . '</td>
					<td><fieldset class="checkboxes">' . vmText::_('COM_VIRTUEMART_FORM_MEDIA_SET_' . strtoupper($this->file_type)) . '</fieldset></td></tr>';
        } else {
            $mediaattribtemp = $this->media_attributes;
            if (empty($this->media_attributes)) {
                $mediaattribtemp = 'product';
            }
            $html .= '<tr>
					<td class="labelcell">' . vmText::_('COM_VIRTUEMART_FILES_FORM_LOCATION') . '</td>
					<td><fieldset class="checkboxes">' . JHtml::_('select.radiolist', $this->getOptions($this->_mLocation), 'media[media_attributes]', '', 'value', 'text', $mediaattribtemp) . '</fieldset></td></tr>';
        }
        // select language for image
        $active_languages = VmConfig::get('active_languages');
        if (count($active_languages) > 1) {
            $selectedImageLangue = explode(",", $this->file_lang);
            $configM = VmModel::getModel('config');
            $languages = $configM->getActiveLanguages($selectedImageLangue, 'media[active_languages][]');
            $html .= '<tr>
					<td class="labelcell"><span class="hasTip" title="' . vmText::_('COM_VIRTUEMART_FILES_FORM_LANGUAGE_TIP') . '">' . vmText::_('COM_VIRTUEMART_FILES_FORM_LANGUAGE') . '</span></td>
					<td><fieldset class="inputbox">' . $languages . '</fieldset></td>
					</tr>';
        }
        if (VmConfig::get('multix', 'none') != 'none') {
            if (empty($this->virtuemart_vendor_id)) {
                $vendorId = vmAccess::isSuperVendor();
            } else {
                $vendorId = $this->virtuemart_vendor_id;
            }
            if (!class_exists('ShopFunctions')) {
                require VMPATH_ADMIN . DS . 'helpers' . DS . 'shopfunctions.php';
            }
            $vendorList = ShopFunctions::renderVendorList($vendorId, 'media[virtuemart_vendor_id]');
            $html .= VmHTML::row('raw', 'COM_VIRTUEMART_VENDOR', $vendorList);
        }
        $html .= '</table>';
        $html .= '<br /></fieldset>';
        $this->addMediaActionByType();
        $html .= '<fieldset class="checkboxes">';
        $html .= '<legend>' . vmText::_('COM_VIRTUEMART_FILE_UPLOAD') . '</legend>';
        $html .= vmText::_('COM_VIRTUEMART_IMAGE_ACTION') . JHtml::_('select.radiolist', $this->getOptions($this->_actions), 'media[media_action]', '', 'value', 'text', 0) . '<br /><br style="clear:both" />';
        $html .= vmText::_('COM_VIRTUEMART_FILE_UPLOAD') . ' <input type="file" name="upload" id="upload" size="50" class="inputbox" /><br />';
        $html .= '<br />' . $this->displaySupportedImageTypes();
        $html .= '<br /></fieldset>';
        $html .= $this->displayFoldersWriteAble();
        $html .= $this->displayHidden();
        //		$html .= '</form>';
        return $html;
    }
Ejemplo n.º 28
0
 /**
  *
  * @author Patrick Kohl
  * @param array $options( value & text)
  * @param string $name option name
  * @param string $defaut defaut value
  * @param string $key option value
  * @param string $text option text
  * @param boolean $zero add  a '0' value in the option
  * return a select list
  */
 public static function select($name, $options, $default = '0', $attrib = "onchange='submit();'", $key = 'value', $text = 'text', $zero = true, $chosenDropDowns = true, $tranlsate = true)
 {
     if ($zero == true) {
         $option = array($key => "0", $text => vmText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION'));
         $options = array_merge(array($option), $options);
     }
     if ($chosenDropDowns) {
         vmJsApi::chosenDropDowns();
         $attrib .= ' class="vm-chzn-select"';
     }
     return VmHtml::genericlist($options, $name, $attrib, $key, $text, $default, false, $tranlsate);
 }
Ejemplo n.º 29
0
?>

<form action="index.php" method="post" name="adminForm" id="adminForm">
	<div id="header">
		<div id="filterbox">
		<table>
		  <tr>
			 <td align="left" width="100%">
				<?php 
echo $this->displayDefaultViewSearch('COM_VIRTUEMART_NAME', 'searchMedia') . ' ' . $this->lists['search_type'] . ' ' . $this->lists['search_role'];
?>

			 </td>
			  <td>
				  <?php 
echo VmHtml::checkbox('missing', 'missing');
?>

			  </td>
		  </tr>
		</table>
		</div>
		<div id="resultscounter"><?php 
echo $this->pagination->getResultsCounter();
?>
</div>
	</div>
<?php 
$productfileslist = $this->files;
//$roles = $this->productfilesroles;
?>
Ejemplo n.º 30
0
    $cart = VirtuemartCart::getCart();
    $cart->prepareVendor();
    if (empty($tos) and !VmConfig::get('agree_to_tos_onorder', true)) {
        if (is_array($cart->BT) and !empty($cart->BT['tos'])) {
            $tos = $cart->BT['tos'];
        }
    }
}
if (!class_exists('VmHtml')) {
    require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
}
$class = 'terms-of-service';
if (!empty($field['required'])) {
    $class .= ' required';
}
echo VmHtml::checkbox($_prefix . $field['name'], $tos, 1, 0, 'class="' . $class . '"', 'tos');
if ($app->isSite()) {
    ?>
<div class="terms-of-service">
	<label for="tos">
		<a href="<?php 
    echo JRoute::_('index.php?option=com_virtuemart&view=vendor&layout=tos&virtuemart_vendor_id=1', FALSE);
    ?>
" class="terms-of-service" id="terms-of-service" rel="facebox"
		   target="_blank">
			<span class="vmicon vm2-termsofservice-icon"></span>
			<?php 
    echo vmText::_('COM_VIRTUEMART_CART_TOS_READ_AND_ACCEPTED');
    ?>
		</a>
	</label>