Esempio n. 1
0
 /**
  * Checks the entry to maintain DB integrity
  * @return unknown_type
  */
 function check()
 {
     $config = Tienda::getInstance();
     if (!$this->addresstype_id) {
         $this->addresstype_id = '1';
     }
     $address_type = $this->addresstype_id;
     if (empty($this->user_id)) {
         $this->user_id = JFactory::getUser()->id;
         if (empty($this->user_id)) {
             $this->setError(JText::_('COM_TIENDA_USER_REQUIRED'));
         }
     }
     Tienda::load('TiendaHelperAddresses', 'helpers.addresses');
     $elements = TiendaHelperAddresses::getAddressElementsData($address_type);
     if (empty($this->address_name)) {
         $this->address_name = $this->address_1;
     }
     if (empty($this->address_name) && $elements['address_name'][1]) {
         $this->setError(JText::_("COM_TIENDA_PLEASE_INCLUDE_AN_ADDRESS_TITLE" . $address_type));
     }
     $address_checks = array(array('first_name', 'name', "COM_TIENDA_FIRST_NAME_REQUIRED"), array('middle_name', 'middle', "COM_TIENDA_MIDDLE_NAME_REQUIRED"), array('last_name', 'last', "COM_TIENDA_LAST_NAME_REQUIRED"), array('address_1', 'address1', "COM_TIENDA_AT_LEAST_ONE_ADDRESS_LINE_IS_REQUIRED"), array('address_2', 'address2', "COM_TIENDA_SECOND_ADDRESS_LINE_IS_REQUIRED"), array('company', 'company', "COM_TIENDA_COMPANY_REQUIRED"), array('tax_number', 'tax_number', "COM_TIENDA_COMPANY_TAX_NUMBER_REQUIRED"), array('city', 'city', "COM_TIENDA_CITY_REQUIRED"), array('postal_code', 'zip', "COM_TIENDA_POSTAL_CODE_REQUIRED"), array('phone_1', 'phone', "COM_TIENDA_PHONE_REQUIRED"));
     for ($i = 0, $c = count($address_checks); $i < $c; $i++) {
         $current = $address_checks[$i];
         if (empty($this->{$current}[0]) && $elements[$current[1]][1]) {
             $this->setError(JText::_($current[2]));
         }
     }
     if (empty($this->country_id)) {
         if ($elements['country'][1]) {
             $this->setError(JText::_('COM_TIENDA_COUNTRY_REQUIRED'));
         } else {
             $this->country_id = 9999;
         }
     }
     $countryA = explode(',', trim($config->get('ignored_countries', '83,188,190')));
     if (empty($this->zone_id) && !in_array($this->country_id, $countryA)) {
         if ($elements['zone'][1]) {
             $this->setError(JText::_('COM_TIENDA_ZONE_REQUIRED'));
         } else {
             $this->zone_id = 9999;
         }
     }
     return parent::check();
 }
Esempio n. 2
0
Tienda::load('TiendaHelperAddresses', 'helpers.addresses');
$config = Tienda::getInstance();
$one_page = $config->get('one_page_checkout', 0);
$guest_enabled = $config->get('guest_checkout_enabled', 0);
switch ($this->form_prefix) {
    case 'shipping_input_':
        $address_type = '2';
        break;
    default:
    case 'billing_input_':
        $address_type = '1';
        break;
}
$elements = TiendaHelperAddresses::getAddressElementsData($address_type);
$js_strings = array('COM_TIENDA_UPDATING_SHIPPING_RATES', 'COM_TIENDA_UPDATING_CART', 'COM_TIENDA_UPDATING_ADDRESS', 'COM_TIENDA_UPDATING_PAYMENT_METHODS');
TiendaHelperAddresses::addJsTranslationStrings($js_strings);
?>

<div id="<?php 
echo $this->form_prefix;
?>
addressForm" class="address_form">
	<?php 
if ($elements['address_name'][0]) {
    if ($this->guest && !$one_page) {
        echo '<input value="' . JText::_('COM_TIENDA_TEMPORARY') . '" name="' . $this->form_prefix . 'address_name" id="' . $this->form_prefix . 'address_name" type="hidden" />';
    } else {
        ?>
	<label class="key" for="<?php 
        echo $this->form_prefix;
        ?>
Esempio n. 3
0
<?php

defined('_JEXEC') or die('Restricted access');
JHTML::_('script', 'tienda.js', 'media/com_tienda/js/');
JHTML::_('stylesheet', 'tienda.css', 'media/com_tienda/css/');
switch ($this->form_prefix) {
    case 'shipping_input_':
        $address_type = '2';
        break;
    default:
    case 'billing_input_':
        $address_type = '1';
        break;
}
Tienda::load('TiendaHelperAddresses', 'helpers.addresses');
$elements = TiendaHelperAddresses::getAddressElementsData($address_type);
$session = JFactory::getSession();
$user_type = $session->get('user_type', '', 'tienda_pos');
$guest = true;
if ($user_type == "existing" || $user_type == "new") {
    $guest = false;
}
$key_style = 'width: 140px; text-align: right;';
?>


	<table class="table table-striped table-bordered" style="clear: both;" data-type="<?php 
echo substr($this->form_prefix, 0, -1);
?>
">
		<tbody>