Пример #1
0
 /**
  * Checks the entry to maintain DB integrity
  * @return unknown_type
  */
 function check()
 {
     $config = Citruscart::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_CITRUSCART_USER_REQUIRED'));
         }
     }
     Citruscart::load('CitruscartHelperAddresses', 'helpers.addresses');
     $elements = CitruscartHelperAddresses::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_CITRUSCART_PLEASE_INCLUDE_AN_ADDRESS_TITLE" . $address_type));
     }
     $address_checks = array(array('first_name', 'name', "COM_CITRUSCART_FIRST_NAME_REQUIRED"), array('middle_name', 'middle', "COM_CITRUSCART_MIDDLE_NAME_REQUIRED"), array('last_name', 'last', "COM_CITRUSCART_LAST_NAME_REQUIRED"), array('address_1', 'address1', "COM_CITRUSCART_AT_LEAST_ONE_ADDRESS_LINE_IS_REQUIRED"), array('address_2', 'address2', "COM_CITRUSCART_SECOND_ADDRESS_LINE_IS_REQUIRED"), array('company', 'company', "COM_CITRUSCART_COMPANY_REQUIRED"), array('tax_number', 'tax_number', "COM_CITRUSCART_COMPANY_TAX_NUMBER_REQUIRED"), array('city', 'city', "COM_CITRUSCART_CITY_REQUIRED"), array('postal_code', 'zip', "COM_CITRUSCART_POSTAL_CODE_REQUIRED"), array('phone_1', 'phone', "COM_CITRUSCART_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_CITRUSCART_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 (isset($elements['zone'][1])) {
             $this->setError(JText::_('COM_CITRUSCART_ZONE_REQUIRED'));
         } else {
             $this->zone_id = 9999;
         }
     }
     return parent::check();
 }
Пример #2
0
-------------------------------------------------------------------------*/
/** ensure this file is being included by a parent file */
defined('_JEXEC') or die('Restricted access');
JHtml::_('script', 'media/citruscart/js/citruscart.js', false, false);
JHtml::_('stylesheet', 'media/citruscart/css/citruscart.css');
switch ($this->form_prefix) {
    case 'shipping_input_':
        $address_type = '2';
        break;
    default:
    case 'billing_input_':
        $address_type = '1';
        break;
}
Citruscart::load('CitruscartHelperAddresses', 'helpers.addresses');
$elements = CitruscartHelperAddresses::getAddressElementsData($address_type);
$session = JFactory::getSession();
$user_type = $session->get('user_type', '', 'citruscart_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>
Пример #3
0
<!-- Get the application -->
<?php 
$app = JFactory::getApplication();
?>

<?php 
$cart_itemid = $this->router->findItemid(array('view' => 'carts'));
if (empty($cart_itemid)) {
    //$cart_itemid = JRequest::getInt('Itemid');
    $cart_itemid = $app->input->getInt('Itemid');
}
$guest_checkout_enabled = $this->defines->get('guest_checkout_enabled');
$failureUrl = $this->defines->get('opc_failure_url', JRoute::_("index.php?option=com_citruscart&view=carts&Itemid=" . $cart_itemid));
Citruscart::load('CitruscartHelperAddresses', 'helpers.addresses');
$js_strings = array('COM_CITRUSCART_PLEASE_CHOOSE_REGISTER', 'COM_CITRUSCART_PLEASE_CHOOSE_REGISTER_OR_CHECKOUT_AS_GUEST');
CitruscartHelperAddresses::addJsTranslationStrings($js_strings);
$doc = JFactory::getDocument();
$js = 'citruscartJQ(document).ready(function(){
    Opc = new CitruscartOpc("#opc-checkout-steps", { guestCheckoutEnabled: ' . $guest_checkout_enabled . ', urls: { failure: "' . $failureUrl . '" } });';
if (empty($this->user->id)) {
    $js .= 'Opc.gotoSection("checkout-method");';
} else {
    $js .= 'Opc.gotoSection("billing");';
}
if (!empty($this->showShipping)) {
    $js .= 'Opc.shipping = new CitruscartShipping("#opc-shipping-form");';
}
$js .= 'Opc.payment = new CitruscartPayment("#opc-payment-form");';
$js .= '});';
$doc->addScriptDeclaration($js);
?>