Inheritance: extends AxisPrototype
 /**
  *
  * @param mixed $value
  * @return mixed
  */
 public static function getSaveValue($value)
 {
     if (!is_array($value)) {
         return $value;
     }
     function remove_quotes(&$str)
     {
         $str = str_replace(array('"', "'"), '', $str);
     }
     $filename = Axis::config()->system->path . '/var/export/' . current($value);
     if (@(!($fp = fopen($filename, 'r')))) {
         Axis::message()->addError(Axis::translate('core')->__("Can't open file : %s", $filename));
         return current($value);
     }
     $titles = fgetcsv($fp, 2048, ',', "'");
     array_walk($titles, 'remove_quotes');
     $rowSize = count($titles);
     Axis::table('shippingtable_rate')->delete("site_id = " . $value['siteId']);
     while (!feof($fp)) {
         $data = fgetcsv($fp, 2048, ',', "'");
         if (!is_array($data)) {
             continue;
         }
         $data = array_pad($data, $rowSize, '');
         array_walk($data, 'remove_quotes');
         $data = array_combine($titles, $data);
         Axis::table('shippingtable_rate')->insert(array('site_id' => $value['siteId'], 'country_id' => Axis::single('location/country')->getIdByIsoCode3($data['Country']), 'zone_id' => Axis::single('location/zone')->getIdByCode($data['Region/State']), 'zip' => $data['Zip'], 'value' => $data['Value'], 'price' => $data['Price']));
     }
     return current($value);
 }
Example #2
0
 /**
  *
  * @return array
  */
 protected function _loadCollection()
 {
     if (empty($this->_collection)) {
         $themes = Axis::model('core/option_theme');
         $layouts = array();
         $designPath = Axis::config('system/path') . '/app/design/front';
         foreach ($themes as $theme) {
             $path = $designPath . '/' . $theme . '/layouts';
             if (!file_exists($path)) {
                 continue;
             }
             $dir = opendir($path);
             while ($file = readdir($dir)) {
                 if (is_dir($path . '/' . $file) || substr($file, 0, 7) != 'layout_') {
                     continue;
                 }
                 $layout = substr($file, 0, -6);
                 if (isset($layouts[$layout])) {
                     $layouts[$layout]['themes'][] = $theme;
                     continue;
                 }
                 $layouts[$layout] = array('name' => $layout, 'themes' => array($theme));
             }
         }
         $collection = array();
         foreach ($layouts as $key => $layout) {
             $collection[$key] = $layout['name'] . ' (' . implode(', ', $layout['themes']) . ')';
         }
         $this->_collection = $collection;
     }
     return $this->_collection;
 }
Example #3
0
 /**
  *
  * @static
  * @return array
  */
 public static function collect()
 {
     if (null === self::$_collection) {
         $themes = Axis_Collect_Theme::collect();
         $layouts = array();
         $designPath = Axis::config('system/path') . '/app/design/front';
         foreach ($themes as $theme) {
             $path = $designPath . '/' . $theme . '/layouts';
             if (!file_exists($path)) {
                 continue;
             }
             $dir = opendir($path);
             while ($file = readdir($dir)) {
                 if (is_dir($path . '/' . $file) || substr($file, 0, 7) != 'layout_') {
                     continue;
                 }
                 $layout = substr($file, 0, -6);
                 if (isset($layouts[$layout])) {
                     $layouts[$layout]['themes'][] = $theme;
                     continue;
                 }
                 $layouts[$layout] = array('name' => $layout, 'themes' => array($theme));
             }
         }
         $collection = array();
         foreach ($layouts as $key => $layout) {
             $collection[$key] = $layout['name'] . ' (' . implode(', ', $layout['themes']) . ')';
         }
         self::$_collection = $collection;
     }
     return self::$_collection;
 }
Example #4
0
 /**
  *
  * @static
  * @param string  $code
  * @return string
  */
 public static function getName($code)
 {
     if (!$code) {
         return '';
     }
     return Axis::single('locale/currency')->getTitleByCode($code);
 }
Example #5
0
 public function init()
 {
     $categories = Axis::single('catalog/category')->select('*')->addName(Axis_Locale::getLanguageId())->addKeyWord()->order('cc.lft')->addSiteFilter(Axis::getSiteId())->addDisabledFilter()->fetchAll();
     if (!is_array($this->_activeCategories)) {
         $this->_activeCategories = array();
         if (Zend_Registry::isRegistered('catalog/current_category')) {
             $this->_activeCategories = array_keys(Zend_Registry::get('catalog/current_category')->cache()->getParentItems());
         }
     }
     $container = $_container = new Zend_Navigation();
     $lvl = 0;
     $view = $this->getView();
     foreach ($categories as $_category) {
         $uri = $view->hurl(array('cat' => array('value' => $_category['id'], 'seo' => $_category['key_word']), 'controller' => 'catalog', 'action' => 'view'), false, true);
         $class = 'nav-' . str_replace('.', '-', $_category['key_word']);
         $page = new Zend_Navigation_Page_Uri(array('label' => $_category['name'], 'title' => $_category['name'], 'uri' => $uri, 'order' => $_category['lft'], 'class' => $class, 'visible' => 'enabled' === $_category['status'] ? true : false, 'active' => in_array($_category['id'], $this->_activeCategories)));
         $lvl = $lvl - $_category['lvl'] + 1;
         for ($i = 0; $i < $lvl; $i++) {
             $_container = $_container->getParent();
         }
         $lvl = $_category['lvl'];
         $_container->addPage($page);
         $_container = $page;
     }
     $this->setData('menu', $container);
     return true;
 }
Example #6
0
 public function up()
 {
     $_pickup = array('RDP' => Axis_ShippingUps_Model_Option_Standard_Pickup::RDP, 'CC' => Axis_ShippingUps_Model_Option_Standard_Pickup::CC, 'OTP' => Axis_ShippingUps_Model_Option_Standard_Pickup::OTP, 'OCA' => Axis_ShippingUps_Model_Option_Standard_Pickup::OCA, 'LC' => Axis_ShippingUps_Model_Option_Standard_Pickup::LC);
     $rowset = Axis::single('core/config_value')->select()->where('path = ?', 'shipping/Ups_Standard/pickup')->fetchRowset();
     foreach ($rowset as $row) {
         $row->value = isset($_pickup[$row->value]) ? $_pickup[$row->value] : Axis_ShippingUps_Model_Option_Standard_Pickup::CC;
         $row->save();
     }
     ///////////////////////////
     $_package = array('CP' => Axis_ShippingUps_Model_Option_Standard_Package::CP, 'ULE' => Axis_ShippingUps_Model_Option_Standard_Package::ULE, 'UT' => Axis_ShippingUps_Model_Option_Standard_Package::UT, 'UEB' => Axis_ShippingUps_Model_Option_Standard_Package::UEB);
     $rowset = Axis::single('core/config_value')->select()->where('path = ?', 'shipping/Ups_Standard/package')->fetchRowset();
     foreach ($rowset as $row) {
         $row->value = isset($_package[$row->value]) ? $_package[$row->value] : Axis_ShippingUps_Model_Option_Standard_Package::CP;
         $row->save();
     }
     ///////////////////////////
     $_dest = array('RES' => Axis_ShippingUps_Model_Option_Standard_DestinationType::RES, 'COM' => Axis_ShippingUps_Model_Option_Standard_DestinationType::COM);
     $rowset = Axis::single('core/config_value')->select()->where('path = ?', 'shipping/Ups_Standard/res')->fetchRowset();
     foreach ($rowset as $row) {
         $row->value = isset($_dest[$row->value]) ? $_dest[$row->value] : Axis_ShippingUps_Model_Option_Standard_DestinationType::RES;
         $row->save();
     }
     ///////////////////////////
     $paths = array('shipping/Ups_Standard/pickup' => 'shippingUps/option_standard_pickup', 'shipping/Ups_Standard/package' => 'shippingUps/option_standard_package', 'shipping/Ups_Standard/res' => 'shippingUps/option_standard_destinationType', 'shipping/Ups_Standard/measure' => 'shippingUps/option_standard_measure', 'shipping/Ups_Standard/type' => 'shippingUps/option_standard_requestType', 'shipping/Ups_Standard/types' => 'shippingUps/option_standard_service', 'shipping/Ups_Standard/xmlOrigin' => 'shippingUps/option_standard_origin');
     $rowset = Axis::single('core/config_field')->select()->fetchRowset();
     foreach ($rowset as $row) {
         if (isset($paths[$row->path])) {
             $row->model = $paths[$row->path];
             $row->save();
         }
     }
 }
Example #7
0
 public function postProcess(Axis_Sales_Model_Order_Row $order)
 {
     $this->saveCreditCard($order);
     $cc = $this->getCreditCard();
     $options = $this->getLineItemDetails();
     $billing = $order->getBilling();
     $optionsAll = array_merge($options, array('STREET' => $billing->getStreetAddress(), 'ZIP' => $billing->getPostcode(), 'BUTTONSOURCE' => $this->_buttonSourceDP, 'CURRENCY' => $this->getBaseCurrencyCode(), 'IPADDRESS' => $_SERVER['REMOTE_ADDR']));
     if ($cc->getCcIssueMonth() && $cc->getCcIssueYear()) {
         $optionsAll['CARDSTART'] = $cc->getCcIssueMonth() . substr($cc->getCcIssueYear(), -2);
     }
     $optionsNVP = array('CITY' => $billing->getCity(), 'STATE' => $billing->getZone()->getCode() ? $billing->getZone()->getCode() : $billing->getCity(), 'COUNTRYCODE' => $billing->getCountry()->getIsoCode2(), 'EXPDATE' => $cc->getCcExpiresMonth() . $cc->getCcExpiresYear(), 'PAYMENTACTION' => $this->_config->paymentAction == 'Authorization' ? 'Authorization' : 'Sale');
     $delivery = $order->getDelivery();
     $optionsShip = array('SHIPTONAME' => $delivery->getFirstname() . ' ' . $delivery->getLastname(), 'SHIPTOSTREET' => $delivery->getStreetAddress(), 'SHIPTOSTREET2' => $delivery->getSuburb(), 'SHIPTOCITY' => $delivery->getCity(), 'SHIPTOZIP' => $delivery->getPostcode(), 'SHIPTOSTATE' => $delivery->getZone()->getCode() ? $delivery->getZone()->getCode() : $delivery->getCity(), 'SHIPTOCOUNTRYCODE' => $delivery->getCountry()->getIsoCode2());
     // if these optional parameters are blank, remove them from transaction
     if (isset($optionsShip['SHIPTOSTREET2']) && empty($optionsShip['SHIPTOSTREET2'])) {
         unset($optionsShip['SHIPTOSTREET2']);
     }
     $response = $this->getApi()->DoDirectPayment(sprintf('%.2f', $this->getAmountInBaseCurrency($order->order_total)), $cc->getCcNumber(), $cc->getCcCvv(), $cc->getCcExpiresMonth() . $cc->getCcExpiresYear(), $billing->getFirstname(), $billing->getLastname(), $cc->getCcType(), $optionsAll, array_merge($optionsNVP, $optionsShip));
     if ($response['ACK'] != 'Success') {
         $this->log("Response : " . Zend_Debug::dump($response, null, false));
         foreach ($this->getMessages($response) as $severity => $messages) {
             Axis::message()->batchAdd($messages, $severity);
         }
         throw new Axis_Exception('DoDirectPayment Failure');
     }
 }
Example #8
0
 /**
  * Add product to order
  *
  * @param array $product
  * @param int $orderId
  * @return int orderProductId
  */
 public function add($product, $orderId)
 {
     $stock = Axis::single('catalog/product_stock')->find($product['product_id'])->current();
     $backorder = $stock->backorder;
     $productVariationId = isset($product['variation_id']) ? $product['variation_id'] : null;
     $stockQuantity = $stock->getQuantity($productVariationId);
     if ($stockQuantity - $product['quantity'] > $stock->min_qty) {
         $backorder = 0;
     }
     //calculate tax
     $taxClassId = Axis::single('catalog/product')->getTaxClassId($product['product_id']);
     $orderRow = Axis::single('sales/order')->find($orderId)->current();
     $countryId = Axis::single('location/country')->getIdByName($orderRow->delivery_country);
     $zoneId = 0;
     if (!empty($orderRow->delivery_state)) {
         $zoneId = Axis::single('location/zone')->getIdByName($orderRow->delivery_state);
     }
     $geozoneIds = Axis::single('location/geozone')->getIds($countryId, $zoneId);
     $customerGroupId = Axis::single('account/customer')->getGroupId($orderRow->customer_id);
     $productTax = Axis::single('tax/rate')->calculateByPrice($product['final_price'], $taxClassId, $geozoneIds, $customerGroupId);
     $orderProductId = $this->insert(array('order_id' => $orderId, 'product_id' => $product['product_id'], 'variation_id' => $productVariationId, 'sku' => $product['sku'], 'name' => $product['name'], 'price' => $product['price'], 'tax' => $productTax, 'final_price' => $product['final_price'], 'final_weight' => $product['final_weight'], 'quantity' => $product['quantity'], 'backorder' => $backorder));
     // $orderProductId = $this->getAdapter()->lastInsertId();
     if (isset($product['attributes']) && is_array($product['attributes'])) {
         $modelAttributte = Axis::single('sales/order_product_attribute');
         foreach ($product['attributes'] as $attribute) {
             $modelAttributte->insert(array('order_product_id' => $orderProductId, 'product_option' => $attribute['product_option'], 'product_option_value' => $attribute['product_option_value']));
         }
     }
     $productRow = Axis::single('catalog/product')->find($product['product_id'])->current();
     $productRow->ordered += 1;
     //$product['quantity'];
     $productRow->save();
     return $orderProductId;
 }
 /**
  * Sets the bar style, adding an extra unit
  */
 public function Bar()
 {
     if (!$this->rounded_up) {
         $this->orig_max_value += $this->min_unit;
         parent::Bar();
     }
 }
Example #10
0
 protected function _beforeRender()
 {
     if (!$this->hasData('product_id')) {
         return true;
     }
     if (!is_array($this->review_count)) {
         return true;
     }
     /* if review already loaded */
     if (in_array($this->product_id, array_keys($this->review_count))) {
         return true;
     }
     if (!is_array($this->product_ids)) {
         $this->setProductIds(array($this->product_id));
     } elseif (!in_array($this->product_id, $this->getProductIds())) {
         $productIds = $this->product_ids;
         $productIds[] = $this->product_id;
         $this->setProductIds($productIds);
     }
     $productIds = array_diff($this->getProductIds(), array_keys($this->review_count));
     $modelCommunityReview = Axis::single('community/review');
     $this->review_count += $modelCommunityReview->cache()->getCountByProductId($productIds);
     $this->ratings += $modelCommunityReview->cache()->getAverageProductRating($productIds, $this->getView()->config('community/review/merge_average'));
     return true;
 }
 public function removeAction()
 {
     $data = Zend_Json::decode($this->_getParam('data'));
     Axis::model('account/customer_valueSet')->delete($this->db->quoteInto('id IN (?)', $data));
     Axis::message()->addSuccess(Axis::translate('admin')->__('Group was deleted successfully'));
     return $this->_helper->json->sendSuccess();
 }
Example #12
0
 /**
  *
  * @static
  * @param int $id
  * @return string
  */
 public static function getName($id)
 {
     if (!$id) {
         return '';
     }
     return Axis::single('core/site')->getNameById($id);
 }
Example #13
0
 public function __construct()
 {
     $select = Axis::model('discount/discount')->select('*');
     $select->joinLeft('discount_eav', 'de.discount_id = d.id', '*')->order('d.priority DESC');
     $this->_select = $select;
     $this->_filters = new Axis_Object();
 }
Example #14
0
 /**
  * Build rating stars, according to recieved ratings array
  *
  * @param array $ratings
  *  array(
  *      array(
  *          'mark' => int,
  *          'title' => string,
  *          'product_id' => int[optional]
  *      ),...
  *  )
  * @param string $url [optional]
  * @param boolean $smallStars [optional]
  * @return string
  */
 public function ratings($ratings, $url = '', $smallStars = true)
 {
     if (isset($this->_config['rating_enabled']) && !$this->_config['rating_enabled']) {
         return '';
     }
     if (!is_array($ratings)) {
         $ratings = array();
     }
     $url = empty($url) ? '#' : $url;
     $hasRating = false;
     $html = '';
     foreach ($ratings as $rating) {
         if (!count($rating)) {
             continue;
         }
         $hasRating = true;
         $html .= '<li>';
         $html .= $this->_getRatingTitle($rating['title']);
         $html .= '<a href="' . $url . '" class="review-stars review-rate' . ($smallStars ? '-sm' : '') . ' "title="' . $rating['title'] . ': ' . $rating['mark'] . ' ' . Axis::translate('community')->__('stars') . '">
                   <span style="width: ' . $rating['mark'] * 100 / 5 . '%">' . Axis::translate('community')->__("%s stars", $rating['mark']) . '</span>
         </a>';
         $html .= '</li>';
     }
     if ($hasRating) {
         $html = '<ul class="review-ratings">' . $html . '</ul>';
     }
     return $html;
 }
Example #15
0
 public function removeAction()
 {
     $customerGroupIds = Zend_Json::decode($this->_getParam('data'));
     $isValid = true;
     if (in_array(Axis_Account_Model_Customer_Group::GROUP_GUEST_ID, $customerGroupIds)) {
         $isValid = false;
         Axis::message()->addError(Axis::translate('admin')->__("Your can't delete default Guest group id: %s ", Axis_Account_Model_Customer_Group));
     }
     if (in_array(Axis_Account_Model_Customer_Group::GROUP_ALL_ID, $customerGroupIds)) {
         $isValid = false;
         Axis::message()->addError(Axis::translate('admin')->__("Your can't delete default All group id: %s ", Axis_Account_Model_Customer_Group::GROUP_ALL_ID));
     }
     if (true === in_array(Axis::config()->account->main->defaultCustomerGroup, $customerGroupIds)) {
         $isValid = false;
         Axis::message()->addError(Axis::translate('admin')->__("Your can't delete default customer group id: %s ", $id));
     }
     if (!sizeof($customerGroupIds)) {
         $isValid = false;
         Axis::message()->addError(Axis::translate('admin')->__('No data to delete'));
     }
     if ($isValid) {
         Axis::single('account/customer_group')->delete($this->db->quoteInto('id IN(?)', $customerGroupIds));
         Axis::message()->addSuccess(Axis::translate('admin')->__('Group was deleted successfully'));
     }
     $this->_helper->json->sendJson(array('success' => $isValid));
 }
Example #16
0
 public function up()
 {
     $installer = $this->getInstaller();
     $installer->run("\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('log_url')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('log_url')}` (\n          `url_id` int(11) NOT NULL,\n          `visitor_id` int(11) NOT NULL,\n          `visit_at` datetime default NULL,\n          `site_id` smallint(9) NOT NULL,\n          PRIMARY KEY  (`url_id`,`visitor_id`)\n        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('log_url_info')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('log_url_info')}` (\n          `id` mediumint(7) NOT NULL auto_increment,\n          `url` varchar(255) default NULL,\n          `refer` varchar(255) default NULL,\n          PRIMARY KEY  (`id`)\n        ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('log_visitor')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('log_visitor')}` (\n          `id` mediumint(7) unsigned NOT NULL auto_increment,\n          `session_id` char(32) default NULL,\n          `customer_id` int(11) default NULL,\n          `last_url_id` int(11) default NULL,\n          `last_visit_at` datetime default NULL,\n          `site_id` smallint(9) NOT NULL,\n          PRIMARY KEY  (`id`),\n          UNIQUE KEY `UNQ_LOG_VISITOR` (`session_id`,`customer_id`)\n        ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('log_visitor_info')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('log_visitor_info')}` (\n          `visitor_id` int(11) NOT NULL,\n          `http_refer` varchar(255) default NULL,\n          `user_agent` varchar(255) default NULL,\n          `http_accept_charset` varchar(128) default NULL,\n          `http_accept_language` varchar(128) default NULL,\n          `server_addr` varchar(128) default NULL,\n          `remote_addr` varchar(128) default NULL,\n          PRIMARY KEY  (`visitor_id`),\n          KEY `fk_log_visitor_info_log_visitor` (`visitor_id`)\n        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n        ");
     $this->getConfigBuilder()->section('log', 'Log')->setTranslation('Axis_Log')->section('main', 'General')->option('enabled', 'Enabled', true)->setType('radio')->setModel('core/option_boolean')->option('php', 'Php log', '/var/logs/php.log')->setDescription('Path relative to AXIS_ROOT')->option('payment', 'Payment log', '/var/logs/payment.log')->setDescription('Path relative to AXIS_ROOT')->option('shipping', 'Shipping log', '/var/logs/shipping.log')->setDescription('Path relative to AXIS_ROOT')->section('/');
     Axis::single('core/page')->add('account/*/*');
 }
Example #17
0
 /**
  * @static
  * @return array
  */
 public static function collect()
 {
     if (null === self::$_collection) {
         self::$_collection = Axis::single('location/country')->select(array('id', 'name'))->fetchPairs();
     }
     return self::$_collection;
 }
Example #18
0
 protected function _initConfig()
 {
     $this->bootstrap('Loader');
     $config = Zend_Registry::get('config');
     Zend_Registry::set('config', new Axis_Config($config, true));
     return Axis::config();
 }
Example #19
0
 protected function _beforeRender()
 {
     $visitor = Axis::model('log/visitor')->getVisitor();
     // select all viewed products by current visitor
     $selectInner = Axis::model('log/event')->select(array('id', 'object_id'))->order('le.id DESC');
     $customerId = $visitor->customer_id;
     if ($customerId && $customerId === Axis::getCustomerId()) {
         $selectInner->join('log_visitor', 'le.visitor_id = lv.id')->where('lv.customer_id = ?', $customerId);
     } else {
         $selectInner->where('visitor_id = ?', $visitor->id);
     }
     // filter unique product_ids from correctly ordered query
     // using adapter for specific from statement
     // this subquery is used to get the correct order for products
     // bigfix for not displayed product if the user viewed it some time ago and now opened it again
     // with single query this product will not outputted first in a row
     $adapter = Axis::model('log/event')->getAdapter();
     $select = $adapter->select()->from(array('le' => $selectInner), 'object_id')->group('le.object_id')->order('le.id DESC')->limit($this->getProductsCount());
     $productIds = $adapter->fetchCol($select);
     if (empty($productIds)) {
         return false;
     }
     $products = Axis::model('catalog/product')->select('*')->addFilterByAvailability()->addCommonFields()->addFinalPrice()->joinCategory()->where('cc.site_id = ?', Axis::getSiteId())->where('cp.id IN (?)', $productIds)->fetchProducts($productIds);
     if (empty($products)) {
         return false;
     }
     $this->products = $products;
     return $this->hasProducts();
 }
Example #20
0
 public function up()
 {
     $installer = $this->getInstaller();
     $installer->run("\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('location_address_format')}`;\n\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('location_address_format')}` (\n            `id` smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,\n            `name` varchar(32) NOT NULL,\n            `address_format` TEXT NOT NULL DEFAULT '',\n            `address_summary` TEXT NOT NULL DEFAULT '',\n            PRIMARY KEY  (`id`)\n        ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('location_country')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('location_country')}` (\n            `id` mediumint(8) UNSIGNED NOT NULL AUTO_INCREMENT,\n            `name` varchar(64) NOT NULL default '',\n            `iso_code_2` char(2) NOT NULL default '',\n            `iso_code_3` char(3) NOT NULL default '',\n            `address_format_id` smallint(5) unsigned NOT NULL,\n            PRIMARY KEY  (`id`),\n            KEY `LOCATION_COUNTRY_ISO2` (`iso_code_2`),\n            KEY `LOCATION_COUNTRY_ISO3` (`iso_code_3`),\n            KEY `LOCATION_COUNTRY_FORMAT` USING BTREE (`address_format_id`),\n            CONSTRAINT `FK_LOCATION_COUNTRY_FORMAT` FOREIGN KEY (`address_format_id`)\n                REFERENCES `{$installer->getTable('location_address_format')}` (`id`) ON UPDATE CASCADE\n        ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=243 ;\n\n        INSERT INTO `{$installer->getTable('location_country')}` (`id`, `name`, `iso_code_2`, `iso_code_3`, `address_format_id`) VALUES\n        (0, 'ALL WORLD COUNTRY', '*', '*', 1),\n        (1, 'Afghanistan', 'AF', 'AFG', 1),\n        (2, 'Albania', 'AL', 'ALB', 1),\n        (3, 'Algeria', 'DZ', 'DZA', 1),\n        (4, 'American Samoa', 'AS', 'ASM', 1),\n        (5, 'Andorra', 'AD', 'AND', 1),\n        (6, 'Angola', 'AO', 'AGO', 1),\n        (7, 'Anguilla', 'AI', 'AIA', 1),\n        (8, 'Antarctica', 'AQ', 'ATA', 1),\n        (9, 'Antigua and Barbuda', 'AG', 'ATG', 1),\n        (10, 'Argentina', 'AR', 'ARG', 1),\n        (11, 'Armenia', 'AM', 'ARM', 1),\n        (12, 'Aruba', 'AW', 'ABW', 1),\n        (13, 'Australia', 'AU', 'AUS', 1),\n        (14, 'Austria', 'AT', 'AUT', 1),\n        (15, 'Azerbaijan', 'AZ', 'AZE', 1),\n        (16, 'Bahamas', 'BS', 'BHS', 1),\n        (17, 'Bahrain', 'BH', 'BHR', 1),\n        (18, 'Bangladesh', 'BD', 'BGD', 1),\n        (19, 'Barbados', 'BB', 'BRB', 1),\n        (20, 'Belarus', 'BY', 'BLR', 1),\n        (21, 'Belgium', 'BE', 'BEL', 1),\n        (22, 'Belize', 'BZ', 'BLZ', 1),\n        (23, 'Benin', 'BJ', 'BEN', 1),\n        (24, 'Bermuda', 'BM', 'BMU', 1),\n        (25, 'Bhutan', 'BT', 'BTN', 1),\n        (26, 'Bolivia', 'BO', 'BOL', 1),\n        (27, 'Bosnia and Herzegowina', 'BA', 'BIH', 1),\n        (28, 'Botswana', 'BW', 'BWA', 1),\n        (29, 'Bouvet Island', 'BV', 'BVT', 1),\n        (30, 'Brazil', 'BR', 'BRA', 1),\n        (31, 'British Indian Ocean Territory', 'IO', 'IOT', 1),\n        (32, 'Brunei Darussalam', 'BN', 'BRN', 1),\n        (33, 'Bulgaria', 'BG', 'BGR', 1),\n        (34, 'Burkina Faso', 'BF', 'BFA', 1),\n        (35, 'Burundi', 'BI', 'BDI', 1),\n        (36, 'Cambodia', 'KH', 'KHM', 1),\n        (37, 'Cameroon', 'CM', 'CMR', 1),\n        (38, 'Canada', 'CA', 'CAN', 1),\n        (39, 'Cape Verde', 'CV', 'CPV', 1),\n        (40, 'Cayman Islands', 'KY', 'CYM', 1),\n        (41, 'Central African Republic', 'CF', 'CAF', 1),\n        (42, 'Chad', 'TD', 'TCD', 1),\n        (43, 'Chile', 'CL', 'CHL', 1),\n        (44, 'China', 'CN', 'CHN', 1),\n        (45, 'Christmas Island', 'CX', 'CXR', 1),\n        (46, 'Cocos (Keeling) Islands', 'CC', 'CCK', 1),\n        (47, 'Colombia', 'CO', 'COL', 1),\n        (48, 'Comoros', 'KM', 'COM', 1),\n        (49, 'Congo', 'CG', 'COG', 1),\n        (50, 'Cook Islands', 'CK', 'C*K', 1),\n        (51, 'Costa Rica', 'CR', 'CRI', 1),\n        (52, 'Cote D''Ivoire', 'CI', 'CIV', 1),\n        (53, 'Croatia', 'HR', 'HRV', 1),\n        (54, 'Cuba', 'CU', 'CUB', 1),\n        (55, 'Cyprus', 'CY', 'CYP', 1),\n        (56, 'Czech Republic', 'CZ', 'CZE', 1),\n        (57, 'Denmark', 'DK', 'DNK', 1),\n        (58, 'Djibouti', 'DJ', 'DJI', 1),\n        (59, 'Dominica', 'DM', 'DMA', 1),\n        (60, 'Dominican Republic', 'DO', 'DOM', 1),\n        (61, 'East Timor', 'TP', 'TMP', 1),\n        (62, 'Ecuador', 'EC', 'ECU', 1),\n        (63, 'Egypt', 'EG', 'EGY', 1),\n        (64, 'El Salvador', 'SV', 'SLV', 1),\n        (65, 'Equatorial Guinea', 'GQ', 'GNQ', 1),\n        (66, 'Eritrea', 'ER', 'ERI', 1),\n        (67, 'Estonia', 'EE', 'EST', 1),\n        (68, 'Ethiopia', 'ET', 'ETH', 1),\n        (69, 'Falkland Islands (Malvinas)', 'FK', 'FLK', 1),\n        (70, 'Faroe Islands', 'FO', 'FRO', 1),\n        (71, 'Fiji', 'FJ', 'FJI', 1),\n        (72, 'Finland', 'FI', 'FIN', 1),\n        (73, 'France', 'FR', 'FRA', 1),\n        (74, 'France, Metropolitan', 'FX', 'FXX', 1),\n        (75, 'French Guiana', 'GF', 'GUF', 1),\n        (76, 'French Polynesia', 'PF', 'PYF', 1),\n        (77, 'French Southern Territories', 'TF', 'ATF', 1),\n        (78, 'Gabon', 'GA', 'GAB', 1),\n        (79, 'Gambia', 'GM', 'GMB', 1),\n        (80, 'Georgia', 'GE', 'GEO', 1),\n        (81, 'Germany', 'DE', 'DEU', 1),\n        (82, 'Ghana', 'GH', 'GHA', 1),\n        (83, 'Gibraltar', 'GI', 'GIB', 1),\n        (84, 'Greece', 'GR', 'GRC', 1),\n        (85, 'Greenland', 'GL', 'GRL', 1),\n        (86, 'Grenada', 'GD', 'GRD', 1),\n        (87, 'Guadeloupe', 'GP', 'GLP', 1),\n        (88, 'Guam', 'GU', 'GUM', 1),\n        (89, 'Guatemala', 'GT', 'GTM', 1),\n        (90, 'Guinea', 'GN', 'GIN', 1),\n        (91, 'Guinea-bissau', 'GW', 'GNB', 1),\n        (92, 'Guyana', 'GY', 'GUY', 1),\n        (93, 'Haiti', 'HT', 'HTI', 1),\n        (94, 'Heard and Mc Donald Islands', 'HM', 'HMD', 1),\n        (95, 'Honduras', 'HN', 'HND', 1),\n        (96, 'Hong Kong', 'HK', 'HKG', 1),\n        (97, 'Hungary', 'HU', 'HUN', 1),\n        (98, 'Iceland', 'IS', 'ISL', 1),\n        (99, 'India', 'IN', 'IND', 1),\n        (100, 'Indonesia', 'ID', 'IDN', 1),\n        (101, 'Iran (Islamic Republic of)', 'IR', 'IRN', 1),\n        (102, 'Iraq', 'IQ', 'IRQ', 1),\n        (103, 'Ireland', 'IE', 'IRL', 1),\n        (104, 'Israel', 'IL', 'ISR', 1),\n        (105, 'Italy', 'IT', 'ITA', 1),\n        (106, 'Jamaica', 'JM', 'JAM', 1),\n        (107, 'Japan', 'JP', 'JPN', 1),\n        (108, 'Jordan', 'JO', 'JOR', 1),\n        (109, 'Kazakhstan', 'KZ', 'KAZ', 1),\n        (110, 'Kenya', 'KE', 'KEN', 1),\n        (111, 'Kiribati', 'KI', 'KIR', 1),\n        (112, 'Korea, Democratic People''s Republic of', 'KP', 'PRK', 1),\n        (113, 'Korea, Republic of', 'KR', 'KOR', 1),\n        (114, 'Kuwait', 'KW', 'KWT', 1),\n        (115, 'Kyrgyzstan', 'KG', 'KGZ', 1),\n        (116, 'Lao People''s Democratic Republic', 'LA', 'LAO', 1),\n        (117, 'Latvia', 'LV', 'LVA', 1),\n        (118, 'Lebanon', 'LB', 'LBN', 1),\n        (119, 'Lesotho', 'LS', 'LSO', 1),\n        (120, 'Liberia', 'LR', 'LBR', 1),\n        (121, 'Libyan Arab Jamahiriya', 'LY', 'LBY', 1),\n        (122, 'Liechtenstein', 'LI', 'LIE', 1),\n        (123, 'Lithuania', 'LT', 'LTU', 1),\n        (124, 'Luxembourg', 'LU', 'LUX', 1),\n        (125, 'Macau', 'MO', 'MAC', 1),\n        (126, 'Macedonia, The Former Yugoslav Republic of', 'MK', 'MKD', 1),\n        (127, 'Madagascar', 'MG', 'MDG', 1),\n        (128, 'Malawi', 'MW', 'MWI', 1),\n        (129, 'Malaysia', 'MY', 'MYS', 1),\n        (130, 'Maldives', 'MV', 'MDV', 1),\n        (131, 'Mali', 'ML', 'MLI', 1),\n        (132, 'Malta', 'MT', 'MLT', 1),\n        (133, 'Marshall Islands', 'MH', 'MHL', 1),\n        (134, 'Martinique', 'MQ', 'MTQ', 1),\n        (135, 'Mauritania', 'MR', 'MRT', 1),\n        (136, 'Mauritius', 'MU', 'MUS', 1),\n        (137, 'Mayotte', 'YT', 'MYT', 1),\n        (138, 'Mexico', 'MX', 'MEX', 1),\n        (139, 'Micronesia, Federated States of', 'FM', 'FSM', 1),\n        (140, 'Moldova, Republic of', 'MD', 'MDA', 1),\n        (141, 'Monaco', 'MC', 'MCO', 1),\n        (142, 'Mongolia', 'MN', 'MNG', 1),\n        (143, 'Montserrat', 'MS', 'MSR', 1),\n        (144, 'Morocco', 'MA', 'MAR', 1),\n        (145, 'Mozambique', 'MZ', 'MOZ', 1),\n        (146, 'Myanmar', 'MM', 'MMR', 1),\n        (147, 'Namibia', 'NA', 'NAM', 1),\n        (148, 'Nauru', 'NR', 'NRU', 1),\n        (149, 'Nepal', 'NP', 'NPL', 1),\n        (150, 'Netherlands', 'NL', 'NLD', 1),\n        (151, 'Netherlands Antilles', 'AN', 'ANT', 1),\n        (152, 'New Caledonia', 'NC', 'NCL', 1),\n        (153, 'New Zealand', 'NZ', 'NZL', 1),\n        (154, 'Nicaragua', 'NI', 'NIC', 1),\n        (155, 'Niger', 'NE', 'NER', 1),\n        (156, 'Nigeria', 'NG', 'NGA', 1),\n        (157, 'Niue', 'NU', 'NIU', 1),\n        (158, 'Norfolk Island', 'NF', 'NFK', 1),\n        (159, 'Northern Mariana Islands', 'MP', 'MNP', 1),\n        (160, 'Norway', 'NO', 'NOR', 1),\n        (161, 'Oman', 'OM', 'OMN', 1),\n        (162, 'Pakistan', 'PK', 'PAK', 1),\n        (163, 'Palau', 'PW', 'PLW', 1),\n        (164, 'Panama', 'PA', 'PAN', 1),\n        (165, 'Papua New Guinea', 'PG', 'PNG', 1),\n        (166, 'Paraguay', 'PY', 'PRY', 1),\n        (167, 'Peru', 'PE', 'PER', 1),\n        (168, 'Philippines', 'PH', 'PHL', 1),\n        (169, 'Pitcairn', 'PN', 'PCN', 1),\n        (170, 'Poland', 'PL', 'POL', 1),\n        (171, 'Portugal', 'PT', 'PRT', 1),\n        (172, 'Puerto Rico', 'PR', 'PRI', 1),\n        (173, 'Qatar', 'QA', 'QAT', 1),\n        (174, 'Reunion', 'RE', 'REU', 1),\n        (175, 'Romania', 'RO', 'ROM', 1),\n        (176, 'Russian Federation', 'RU', 'RUS', 1),\n        (177, 'Rwanda', 'RW', 'RWA', 1),\n        (178, 'Saint Kitts and Nevis', 'KN', 'KNA', 1),\n        (179, 'Saint Lucia', 'LC', 'LCA', 1),\n        (180, 'Saint Vincent and the Grenadines', 'VC', 'VCT', 1),\n        (181, 'Samoa', 'WS', 'WSM', 1),\n        (182, 'San Marino', 'SM', 'SMR', 1),\n        (183, 'Sao Tome and Principe', 'ST', 'STP', 1),\n        (184, 'Saudi Arabia', 'SA', 'SAU', 1),\n        (185, 'Senegal', 'SN', 'SEN', 1),\n        (186, 'Seychelles', 'SC', 'SYC', 1),\n        (187, 'Sierra Leone', 'SL', 'SLE', 1),\n        (188, 'Singapore', 'SG', 'SGP', 1),\n        (189, 'Slovakia (Slovak Republic)', 'SK', 'SVK', 1),\n        (190, 'Slovenia', 'SI', 'SVN', 1),\n        (191, 'Solomon Islands', 'SB', 'SLB', 1),\n        (192, 'Somalia', 'SO', 'SOM', 1),\n        (193, 'South Africa', 'ZA', 'ZAF', 1),\n        (194, 'South Georgia and the South Sandwich Islands', 'GS', 'SGS', 1),\n        (195, 'Spain', 'ES', 'ESP', 1),\n        (196, 'Sri Lanka', 'LK', 'LKA', 1),\n        (197, 'St. Helena', 'SH', 'SHN', 1),\n        (198, 'St. Pierre and Miquelon', 'PM', 'SPM', 1),\n        (199, 'Sudan', 'SD', 'SDN', 1),\n        (200, 'Suriname', 'SR', 'SUR', 1),\n        (201, 'Svalbard and Jan Mayen Islands', 'SJ', 'SJM', 1),\n        (202, 'Swaziland', 'SZ', 'SWZ', 1),\n        (203, 'Sweden', 'SE', 'SWE', 1),\n        (204, 'Switzerland', 'CH', 'CHE', 1),\n        (205, 'Syrian Arab Republic', 'SY', 'SYR', 1),\n        (206, 'Taiwan', 'TW', 'TWN', 1),\n        (207, 'Tajikistan', 'TJ', 'TJK', 1),\n        (208, 'Tanzania, United Republic of', 'TZ', 'TZA', 1),\n        (209, 'Thailand', 'TH', 'THA', 1),\n        (210, 'Togo', 'TG', 'TGO', 1),\n        (211, 'Tokelau', 'TK', 'TKL', 1),\n        (212, 'Tonga', 'TO', 'TON', 1),\n        (213, 'Trinidad and Tobago', 'TT', 'TTO', 1),\n        (214, 'Tunisia', 'TN', 'TUN', 1),\n        (215, 'Turkey', 'TR', 'TUR', 1),\n        (216, 'Turkmenistan', 'TM', 'TKM', 1),\n        (217, 'Turks and Caicos Islands', 'TC', 'TCA', 1),\n        (218, 'Tuvalu', 'TV', 'TUV', 1),\n        (219, 'Uganda', 'UG', 'UGA', 1),\n        (220, 'Ukraine', 'UA', 'UKR', 1),\n        (221, 'United Arab Emirates', 'AE', 'ARE', 1),\n        (222, 'United Kingdom', 'GB', 'GBR', 1),\n        (223, 'United States', 'US', 'USA', 1),\n        (224, 'United States Minor Outlying Islands', 'UM', 'UMI', 1),\n        (225, 'Uruguay', 'UY', 'URY', 1),\n        (226, 'Uzbekistan', 'UZ', 'UZB', 1),\n        (227, 'Vanuatu', 'VU', 'VUT', 1),\n        (228, 'Vatican City State (Holy See)', 'VA', 'VAT', 1),\n        (229, 'Venezuela', 'VE', 'VEN', 1),\n        (230, 'Viet Nam', 'VN', 'VNM', 1),\n        (231, 'Virgin Islands (British)', 'VG', 'VGB', 1),\n        (232, 'Virgin Islands (U.S.)', 'VI', 'VIR', 1),\n        (233, 'Wallis and Futuna Islands', 'WF', 'WLF', 1),\n        (234, 'Western Sahara', 'EH', 'ESH', 1),\n        (235, 'Yemen', 'YE', 'YEM', 1),\n        (236, 'Yugoslavia', 'YU', 'YUG', 1),\n        (237, 'Zaire', 'ZR', 'ZAR', 1),\n        (238, 'Zambia', 'ZM', 'ZMB', 1),\n        (239, 'Zimbabwe', 'ZW', 'ZWE', 1),\n        (240, 'Aaland Islands', 'AX', 'ALA', 1);\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('location_geozone')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('location_geozone')}` (\n            `id` mediumint(8) unsigned NOT NULL auto_increment,\n            `name` varchar(128) NOT NULL,\n            `description` text,\n            `priority` mediumint(8) NOT NULL,\n            `created_on` datetime NOT NULL,\n            `modified_on` datetime default NULL,\n            PRIMARY KEY  (`id`),\n            UNIQUE KEY `priority` (`priority`)\n        ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;\n\n        INSERT INTO `{$installer->getTable('location_geozone')}` (`id`, `name`, `description`, `priority`) VALUES (1, 'ALL', 'ALL WORLD', 1),(2, 'USA', 'United State of America', 5);\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('location_geozone_zone')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('location_geozone_zone')}` (\n            `id` int(10) unsigned NOT NULL auto_increment,\n            `geozone_id` mediumint(8) unsigned NOT NULL,\n            `zone_id` mediumint(8) unsigned default NULL,\n            `created_on` datetime NOT NULL,\n            `modified_on` datetime default NULL,\n            `country_id` mediumint(8) unsigned NOT NULL,\n            PRIMARY KEY  (`id`),\n            KEY `FK_LOCATION_GEOZONE_ZONE_ZONE` (`zone_id`),\n            KEY `FK_LOCATION_GEOZONE_ZONE_COUNTRY` (`country_id`),\n            KEY `FK_LOCATION_GEOZONE_ZONE_GEOZONE` (`geozone_id`),\n            CONSTRAINT `FK_LOCATION_GEOZONE_ZONE_COUNTRY` FOREIGN KEY (`country_id`) REFERENCES `{$installer->getTable('location_country')}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,\n            CONSTRAINT `FK_LOCATION_GEOZONE_ZONE_GEOZONE` FOREIGN KEY (`geozone_id`) REFERENCES `{$installer->getTable('location_geozone')}` (`id`) ON DELETE CASCADE,\n            CONSTRAINT `FK_LOCATION_GEOZONE_ZONE_ZONE` FOREIGN KEY (`zone_id`) REFERENCES `{$installer->getTable('location_zone')}` (`id`) ON DELETE CASCADE\n        ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;\n\n        INSERT INTO `{$installer->getTable('location_geozone_zone')}` (`geozone_id`, `zone_id`, `country_id`) VALUES (1, 0, 0),(2, 0, 223);\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('location_zone')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('location_zone')}` (\n            `id` mediumint(8) unsigned NOT NULL auto_increment,\n            `code` varchar(32) NOT NULL,\n            `name` varchar(128) NOT NULL,\n            `country_id` mediumint(8) unsigned NOT NULL default '0',\n            PRIMARY KEY  (`id`),\n            KEY `FK_LOCATION_ZONE_COUNTRY` (`country_id`),\n            CONSTRAINT `FK_LOCATION_ZONE_COUNTRY` FOREIGN KEY (`country_id`) REFERENCES `{$installer->getTable('location_country')}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n        ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=201 ;\n\n        INSERT INTO `{$installer->getTable('location_zone')}` (`id`, `code`, `name`, `country_id`) VALUES\n        (0, '*', 'ALL ZONES', 0),\n        (1, 'AL', 'Alabama', 223),\n        (2, 'AK', 'Alaska', 223),\n        (3, 'AS', 'American Samoa', 223),\n        (4, 'AZ', 'Arizona', 223),\n        (5, 'AR', 'Arkansas', 223),\n        (6, 'AF', 'Armed Forces Africa', 223),\n        (7, 'AA', 'Armed Forces Americas', 223),\n        (8, 'AC', 'Armed Forces Canada', 223),\n        (9, 'AE', 'Armed Forces Europe', 223),\n        (10, 'AM', 'Armed Forces Middle East', 223),\n        (11, 'AP', 'Armed Forces Pacific', 223),\n        (12, 'CA', 'California', 223),\n        (13, 'CO', 'Colorado', 223),\n        (14, 'CT', 'Connecticut', 223),\n        (15, 'DE', 'Delaware', 223),\n        (16, 'DC', 'District of Columbia', 223),\n        (17, 'FM', 'Federated States Of Micronesia', 223),\n        (18, 'FL', 'Florida', 223),\n        (19, 'GA', 'Georgia', 223),\n        (20, 'GU', 'Guam', 223),\n        (21, 'HI', 'Hawaii', 223),\n        (22, 'ID', 'Idaho', 223),\n        (23, 'IL', 'Illinois', 223),\n        (24, 'IN', 'Indiana', 223),\n        (25, 'IA', 'Iowa', 223),\n        (26, 'KS', 'Kansas', 223),\n        (27, 'KY', 'Kentucky', 223),\n        (28, 'LA', 'Louisiana', 223),\n        (29, 'ME', 'Maine', 223),\n        (30, 'MH', 'Marshall Islands', 223),\n        (31, 'MD', 'Maryland', 223),\n        (32, 'MA', 'Massachusetts', 223),\n        (33, 'MI', 'Michigan', 223),\n        (34, 'MN', 'Minnesota', 223),\n        (35, 'MS', 'Mississippi', 223),\n        (36, 'MO', 'Missouri', 223),\n        (37, 'MT', 'Montana', 223),\n        (38, 'NE', 'Nebraska', 223),\n        (39, 'NV', 'Nevada', 223),\n        (40, 'NH', 'New Hampshire', 223),\n        (41, 'NJ', 'New Jersey', 223),\n        (42, 'NM', 'New Mexico', 223),\n        (43, 'NY', 'New York', 223),\n        (44, 'NC', 'North Carolina', 223),\n        (45, 'ND', 'North Dakota', 223),\n        (46, 'MP', 'Northern Mariana Islands', 223),\n        (47, 'OH', 'Ohio', 223),\n        (48, 'OK', 'Oklahoma', 223),\n        (49, 'OR', 'Oregon', 223),\n        (50, 'PW', 'Palau', 163),\n        (51, 'PA', 'Pennsylvania', 223),\n        (52, 'PR', 'Puerto Rico', 223),\n        (53, 'RI', 'Rhode Island', 223),\n        (54, 'SC', 'South Carolina', 223),\n        (55, 'SD', 'South Dakota', 223),\n        (56, 'TN', 'Tennessee', 223),\n        (57, 'TX', 'Texas', 223),\n        (58, 'UT', 'Utah', 223),\n        (59, 'VT', 'Vermont', 223),\n        (60, 'VI', 'Virgin Islands', 223),\n        (61, 'VA', 'Virginia', 223),\n        (62, 'WA', 'Washington', 223),\n        (63, 'WV', 'West Virginia', 223),\n        (64, 'WI', 'Wisconsin', 223),\n        (65, 'WY', 'Wyoming', 223),\n        (66, 'AB', 'Alberta', 38),\n        (67, 'BC', 'British Columbia', 38),\n        (68, 'MB', 'Manitoba', 38),\n        (69, 'NF', 'Newfoundland', 38),\n        (70, 'NB', 'New Brunswick', 38),\n        (71, 'NS', 'Nova Scotia', 38),\n        (72, 'NT', 'Northwest Territories', 38),\n        (73, 'NU', 'Nunavut', 38),\n        (74, 'ON', 'Ontario', 38),\n        (75, 'PE', 'Prince Edward Island', 38),\n        (76, 'QC', 'Quebec', 38),\n        (77, 'SK', 'Saskatchewan', 38),\n        (78, 'YT', 'Yukon Territory', 38),\n        (79, 'NDS', 'Niedersachsen', 81),\n        (80, 'BAW', 'Baden-Wrttemberg', 81),\n        (81, 'BAY', 'Bayern', 81),\n        (82, 'BER', 'Berlin', 81),\n        (83, 'BRG', 'Brandenburg', 81),\n        (84, 'BRE', 'Bremen', 81),\n        (85, 'HAM', 'Hamburg', 81),\n        (86, 'HES', 'Hessen', 81),\n        (87, 'MEC', 'Mecklenburg-Vorpommern', 81),\n        (88, 'NRW', 'Nordrhein-Westfalen', 81),\n        (89, 'RHE', 'Rheinland-Pfalz', 81),\n        (90, 'SAR', 'Saarland', 81),\n        (91, 'SAS', 'Sachsen', 81),\n        (92, 'SAC', 'Sachsen-Anhalt', 81),\n        (93, 'SCN', 'Schleswig-Holstein', 81),\n        (94, 'THE', 'Thringen', 81),\n        (95, 'WI', 'Wien', 14),\n        (96, 'NO', 'Niedersterreich', 14),\n        (97, 'OO', 'Obersterreich', 14),\n        (98, 'SB', 'Salzburg', 14),\n        (99, 'KN', 'Kärtnen', 14),\n        (100, 'ST', 'Steiermark', 14),\n        (101, 'TI', 'Tirol', 14),\n        (102, 'BL', 'Burgenland', 14),\n        (103, 'VB', 'Voralberg', 14),\n        (104, 'AG', 'Aargau', 204),\n        (105, 'AI', 'Appenzell Innerrhoden', 204),\n        (106, 'AR', 'Appenzell Ausserrhoden', 204),\n        (107, 'BE', 'Bern', 204),\n        (108, 'BL', 'Basel-Landschaft', 204),\n        (109, 'BS', 'Basel-Stadt', 204),\n        (110, 'FR', 'Freiburg', 204),\n        (111, 'GE', 'Genf', 204),\n        (112, 'GL', 'Glarus', 204),\n        (113, 'JU', 'Graubnden', 204),\n        (114, 'JU', 'Jura', 204),\n        (115, 'LU', 'Luzern', 204),\n        (116, 'NE', 'Neuenburg', 204),\n        (117, 'NW', 'Nidwalden', 204),\n        (118, 'OW', 'Obwalden', 204),\n        (119, 'SG', 'St. Gallen', 204),\n        (120, 'SH', 'Schaffhausen', 204),\n        (121, 'SO', 'Solothurn', 204),\n        (122, 'SZ', 'Schwyz', 204),\n        (123, 'TG', 'Thurgau', 204),\n        (124, 'TI', 'Tessin', 204),\n        (125, 'UR', 'Uri', 204),\n        (126, 'VD', 'Waadt', 204),\n        (127, 'VS', 'Wallis', 204),\n        (128, 'ZG', 'Zug', 204),\n        (129, 'ZH', 'Zrich', 204),\n        (130, 'A Corua', 'A Corua', 195),\n        (131, 'Alava', 'Alava', 195),\n        (132, 'Albacete', 'Albacete', 195),\n        (133, 'Alicante', 'Alicante', 195),\n        (134, 'Almeria', 'Almeria', 195),\n        (135, 'Asturias', 'Asturias', 195),\n        (136, 'Avila', 'Avila', 195),\n        (137, 'Badajoz', 'Badajoz', 195),\n        (138, 'Baleares', 'Baleares', 195),\n        (139, 'Barcelona', 'Barcelona', 195),\n        (140, 'Burgos', 'Burgos', 195),\n        (141, 'Caceres', 'Caceres', 195),\n        (142, 'Cadiz', 'Cadiz', 195),\n        (143, 'Cantabria', 'Cantabria', 195),\n        (144, 'Castellon', 'Castellon', 195),\n        (145, 'Ceuta', 'Ceuta', 195),\n        (146, 'Ciudad Real', 'Ciudad Real', 195),\n        (147, 'Cordoba', 'Cordoba', 195),\n        (148, 'Cuenca', 'Cuenca', 195),\n        (149, 'Girona', 'Girona', 195),\n        (150, 'Granada', 'Granada', 195),\n        (151, 'Guadalajara', 'Guadalajara', 195),\n        (152, 'Guipuzcoa', 'Guipuzcoa', 195),\n        (153, 'Huelva', 'Huelva', 195),\n        (154, 'Huesca', 'Huesca', 195),\n        (155, 'Jaen', 'Jaen', 195),\n        (156, 'La Rioja', 'La Rioja', 195),\n        (157, 'Las Palmas', 'Las Palmas', 195),\n        (158, 'Leon', 'Leon', 195),\n        (159, 'Lleida', 'Lleida', 195),\n        (160, 'Lugo', 'Lugo', 195),\n        (161, 'Madrid', 'Madrid', 195),\n        (162, 'Malaga', 'Malaga', 195),\n        (163, 'Melilla', 'Melilla', 195),\n        (164, 'Murcia', 'Murcia', 195),\n        (165, 'Navarra', 'Navarra', 195),\n        (166, 'Ourense', 'Ourense', 195),\n        (167, 'Palencia', 'Palencia', 195),\n        (168, 'Pontevedra', 'Pontevedra', 195),\n        (169, 'Salamanca', 'Salamanca', 195),\n        (170, 'Santa Cruz de Tenerife', 'Santa Cruz de Tenerife', 195),\n        (171, 'Segovia', 'Segovia', 195),\n        (172, 'Sevilla', 'Sevilla', 195),\n        (173, 'Soria', 'Soria', 195),\n        (174, 'Tarragona', 'Tarragona', 195),\n        (175, 'Teruel', 'Teruel', 195),\n        (176, 'Toledo', 'Toledo', 195),\n        (177, 'Valencia', 'Valencia', 195),\n        (178, 'Valladolid', 'Valladolid', 195),\n        (179, 'Vizcaya', 'Vizcaya', 195),\n        (180, 'Zamora', 'Zamora', 195),\n        (181, 'Zaragoza', 'Zaragoza', 195),\n        (182, 'ACT', 'Australian Capital Territory', 13),\n        (183, 'NSW', 'New South Wales', 13),\n        (184, 'NT', 'Northern Territory', 13),\n        (185, 'QLD', 'Queensland', 13),\n        (186, 'SA', 'South Australia', 13),\n        (187, 'TAS', 'Tasmania', 13),\n        (188, 'VIC', 'Victoria', 13),\n        (189, 'WA', 'Western Australia', 13);\n\n        ");
     $optionId = Axis::model('location/address_format')->insert(array('name' => 'ISO/IEC 19773', 'address_format' => '{{firstname}} {{lastname}}EOL{{if company}}{{company}}EOL{{/if}}{{if street_address}}{{street_address}}EOL{{/if}}{{if suburb}}{{suburb}}EOL{{/if}}{{if city}}{{city}}{{/if}} {{if zone.name}}{{zone.name}} {{/if}}{{if postcode}}{{postcode}}{{/if}}{{if country}}EOL{{country.name}}EOL{{/if}}{{if phone}}T: {{phone}}EOL{{/if}}{{if fax}}F: {{fax}}EOL{{/if}}', 'address_summary' => '{{firstname}} {{lastname}}'));
     $this->getConfigBuilder()->section('locale', 'Locale')->setTranslation('Axis_Locale')->section('main', 'General')->option('addressFormat', 'Default Address Format', $optionId)->setType('select')->setDescription('Default address format')->setModel('location/option_address_format')->section('/');
 }
Example #21
0
 /**
  *
  * @static
  * @param int $id
  * @return mixed string|void
  */
 public static function getName($id)
 {
     if (!$id) {
         return '';
     }
     return Axis::single('location/zone')->getNameById($id);
 }
Example #22
0
 private function _initSeoParams($keywords)
 {
     if (!sizeof($keywords)) {
         return array();
     }
     $rowset = Axis::single('catalog/hurl')->select()->where('key_word IN (?)', $keywords)->where('site_id = ?', Axis::getSiteId())->fetchAssoc();
     foreach ($rowset as $row) {
         switch ($row['key_type']) {
             case 'c':
                 $this->_params['cat']['value'] = $row['key_id'];
                 if (empty($this->_params['cat']['seo'])) {
                     $this->_params['cat']['seo'] = $row['key_word'];
                 } else {
                     $this->_params['cat']['seo'] .= '/' . $row['key_word'];
                 }
                 break;
             case 'p':
                 $this->_params['product']['value'] = $row['key_id'];
                 $this->_params['product']['seo'] = $row['key_word'];
                 $this->getRequest()->setParam('product', $row['key_id']);
                 break;
             case 'm':
                 $mDescription = Axis::single('catalog/product_manufacturer_description')->select(array('title', 'description'))->where('manufacturer_id = ?', $row['key_id'])->where('language_id = ?', Axis_Locale::getLanguageId())->fetchRow();
                 $this->_params['manufacturer'] = array('value' => $row['key_id'], 'seo' => $row['key_word'], 'title' => $mDescription->title, 'description' => $mDescription->description);
                 break;
             default:
                 break;
         }
     }
 }
Example #23
0
 protected function _beforeRender()
 {
     $modelQuestion = Axis::single('poll/question');
     if ($this->hasQuestionId()) {
         $this->_questionId = $this->getQuestionId();
         $this->setQuestionId(null);
     } else {
         $this->_questionId = $modelQuestion->getOneNotVotedQuestionIdByCookie();
     }
     if (!$this->_questionId) {
         return false;
     }
     $question = $modelQuestion->getQuestionWithAnswers($this->_questionId, Axis_Locale::getLanguageId());
     if (!$question) {
         return false;
     }
     $results = array();
     $totalVoteCount = 0;
     $this->_showResult = (bool) $this->getShowResult();
     $this->setShowResult(null);
     if ($this->_showResult) {
         $questionRow = Axis::single('poll/question')->find($this->_questionId)->current();
         $results = $questionRow->getResults();
         $totalVoteCount = $questionRow->getTotalVoteCount();
     }
     $this->setFromArray(array('question' => $question, 'answers' => $question['answers'], 'results' => $results, 'status' => $this->_showResult, 'total_count' => $totalVoteCount));
     return true;
 }
Example #24
0
 public function getCacheKey()
 {
     if (null === $this->_cacheKey) {
         $this->_cacheKey = md5('admin_navigation' . Axis::session()->roleId . Axis_Locale::getLocale()->toString());
     }
     return $this->_cacheKey;
 }
Example #25
0
 public function init()
 {
     $product = $this->getAttrib('productId');
     $this->removeAttrib('productId');
     $this->addElement('hidden', 'product', array('value' => $product));
     // ratings
     $ratings = array();
     if (!Axis::single('community/review_mark')->isCustomerVoted(Axis::getCustomerId(), $product)) {
         $marks = array('0.5' => 0.5, '1' => 1, '1.5' => 1.5, 2 => 2, '2.5' => 2.5, '3' => 3, '3.5' => 3.5, '4' => 4, '4.5' => 4.5, '5' => 5);
         //@todo make configurable
         foreach (Axis::single('community/review_rating')->getList() as $rating) {
             $this->addElement('select', 'rating_' . $rating['id'], array('required' => true, 'id' => $rating['name'], 'label' => $rating['title'], 'class' => 'required review-rating'));
             $this->getElement('rating_' . $rating['id'])->addMultiOptions($marks)->addDecorator('Label', array('tag' => '', 'class' => 'rating-title', 'placement' => 'prepend', 'separator' => ''))->setDisableTranslator(true);
             $ratings[] = 'rating_' . $rating['id'];
         }
     }
     $this->addElement('text', 'author', array('required' => true, 'label' => 'Nickname', 'value' => Axis::single('community/common')->getNickname(), 'class' => 'input-text required', 'description' => 'Your nickname. All users will be able to see it', 'validators' => array(new Axis_Community_Validate_Nickname())));
     $this->addElement('text', 'title', array('required' => true, 'label' => 'One-line summary', 'class' => 'input-text required', 'description' => 'Summarize your review in one line. up to 55 characters', 'minlength' => '10', 'maxlength' => '55', 'validators' => array(new Zend_Validate_StringLength(10, 55, 'utf-8'))));
     $this->addElement('textarea', 'pros', array('required' => true, 'label' => Axis::translate('community')->__('Pros'), 'class' => 'input-text required', 'description' => 'Tell us what you like about this product. up to 250 characters', 'rows' => '2', 'cols' => '50', 'minlength' => '10', 'maxlength' => '250', 'validators' => array(new Zend_Validate_StringLength(10, 250, 'utf-8'))));
     $this->addElement('textarea', 'cons', array('required' => true, 'label' => 'Cons', 'class' => 'input-text required', 'description' => "Tell us what you don't like about this product. up to 250 characters", 'rows' => '2', 'cols' => '50', 'minlength' => '10', 'maxlength' => '250', 'validators' => array(new Zend_Validate_StringLength(10, 250, 'utf-8'))));
     $this->addElement('textarea', 'summary', array('label' => 'Summary', 'class' => 'input-text', 'description' => "Explain to us in detail why you like or dislike the product, focusing your comments on the product's features and functionality, and your experience using the product. This field is optional.", 'rows' => '3', 'cols' => '50', 'minlength' => '10', 'validators' => array(new Zend_Validate_StringLength(10, null, 'utf-8'))));
     $this->addDisplayGroup($this->getElements(), 'review');
     if (Axis::single('community/review')->canAdd()) {
         $this->addElement('button', 'submit', array('type' => 'submit', 'class' => 'button', 'label' => 'Add Review'));
         $this->addActionBar(array('submit'));
     }
 }
Example #26
0
 /**
  * Retrieve singleton instance of Axis_HumanUri_Adapter
  *
  * @static
  * @return Axis_HumanUri_Adapter_Abstact
  */
 public static function getInstance()
 {
     if (null === self::$_instance) {
         self::$_instance = Axis_HumanUri::factory(Axis::config()->front->humanUrlAdapter);
     }
     return self::$_instance;
 }
Example #27
0
 public function registerAction()
 {
     if (Axis::getCustomerId()) {
         $this->_redirect('account');
     }
     $this->setTitle(Axis::translate('account')->__('Create an Account'));
     $form = Axis::single('account/form_signup');
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         if ($form->isValid($data)) {
             $model = Axis::single('account/customer');
             $data['site_id'] = Axis::getSiteId();
             $data['is_active'] = 1;
             list($row, $password) = $model->create($data);
             $row->setDetails($data);
             Axis::dispatch('account_customer_register_success', array('customer' => $row, 'password' => $password));
             $model->login($data['email'], $password);
             return $this->_redirect('account');
         } else {
             $form->populate($data);
         }
     }
     $this->view->formSignup = $form;
     $this->render();
 }
Example #28
0
 /**
  *
  * @param array $value
  * @param Zend_View_Interface $view
  * @return string
  */
 public static function getHtml($value, Zend_View_Interface $view = null)
 {
     $value = json_decode($value, true);
     foreach (self::_getOptions() as $options) {
         switch ($options['type']) {
             case 'bool':
                 $html .= $view->formRadio('confValue[' . $options['name'] . ']', $value[$options['id']], null, array('1' => Axis::translate()->__(' Yes'), '0' => Axis::translate()->__(' No')));
                 break;
             case 'select':
                 $html .= $view->formSelect('confValue[' . $options['name'] . ']', $value[$options['id']], null, $options['config_options']);
                 break;
             case 'multiple':
                 $html .= '<br />';
                 foreach ($options['config_options'] as $key => $dataItem) {
                     $html .= $view->formCheckbox('confValue[' . $options['name'] . '][' . $key . ']', isset($value[$options['name']][$key]) && $value[$options['name']][$key] ? 1 : null, null, array(1, 0)) . " {$dataItem} <br /> ";
                 }
                 break;
             case 'text':
                 $html .= $view->formTextarea('confValue[' . $options['name'] . ']', $value[$options['id']], array('rows' => 8, 'cols' => 45));
                 break;
             default:
                 $html .= $view->formText('confValue[' . $options['name'] . ']', $value[$options['id']], array('size' => '50'));
         }
     }
     return $html;
 }
Example #29
0
 public function collect(Axis_Checkout_Model_Total $total)
 {
     $checkout = Axis::single('checkout/checkout');
     if (null === $checkout->shipping()) {
         return false;
     }
     if (!($taxClassId = $checkout->shipping()->config()->taxClass)) {
         if (!($taxClassId = Axis::config()->tax->shipping->taxClass)) {
             return false;
         }
     }
     if (!($taxBasis = $checkout->shipping()->config()->taxBasis)) {
         if (!($taxBasis = Axis::config()->tax->shipping->taxBasis)) {
             return false;
         }
     }
     $address = $checkout->getStorage()->{$taxBasis};
     if (!$address || !$address->hasCountry()) {
         return false;
     }
     $countryId = $address->country->id;
     $zoneId = $address->hasZone() && $address->zone->hasId() ? $address->zone->id : null;
     $geozoneIds = Axis::single('location/geozone')->getIds($countryId, $zoneId);
     if (!count($geozoneIds)) {
         return false;
     }
     $customerGroupId = Axis::single('account/customer')->getGroupId();
     if (!$customerGroupId) {
         return false;
     }
     $type = $checkout->shipping()->getType($checkout->getShippingRequest(), $checkout->getShippingMethodCode());
     $tax = Axis::single('tax/rate')->calculateByPrice($type['price'], $taxClassId, $geozoneIds, $customerGroupId);
     $total->addCollect(array('code' => $this->getCode(), 'title' => $this->getTitle(), 'total' => $tax, 'sortOrder' => $this->_config->sortOrder));
 }
Example #30
0
 /**
  *
  * @param Axis_Address $address
  * @param string $EOL
  * @return string
  */
 public function address(Axis_Address $address, $EOL = '<br/>')
 {
     //        $template = '{{firstname}} {{lastname}}EOL' .
     //        '{{if company}}{{company}}EOL{{/if}}' .
     //        '{{street_address}}EOL' .
     //        '{{if suburb}}{{suburb}}EOL{{/if}}'.
     //        '{{city}} {{if zone.name}}{{zone.name}} {{/if}}{{postcode}}EOL' .
     //        '{{country.name}}EOL' .
     //        'T: {{phone}}EOL' .
     //        '{{if fax}}F: {{fax}}EOL{{/if}}'
     //        ;
     $address = $address->toArray();
     $addressFormatId = !empty($address['address_format_id']) ? $address['address_format_id'] : Axis::config('locale/main/addressFormat');
     if (empty($this->_addressFormats[$addressFormatId])) {
         throw new Axis_Exception(Axis::translate('location')->__('Not correct address format id'));
     }
     $template = $this->_addressFormats[$addressFormatId]['address_format'];
     if (isset($address['zone']['id']) && 0 == $address['zone']['id']) {
         unset($address['zone']);
     }
     $matches = array();
     preg_match_all('/{{if (.+)(?:\\.(.+))?}}(.+){{\\/if}}/U', $template, $matches);
     foreach ($matches[0] as $key => $condition) {
         $replaced = empty($matches[2][$key]) ? empty($address[$matches[1][$key]]) ? '' : $matches[3][$key] : (empty($address[$matches[1][$key]][$matches[2][$key]]) ? '' : $matches[3][$key]);
         $template = str_replace($condition, $replaced, $template);
     }
     preg_match_all('/{{(.+)(?:\\.(.+))?}}/U', $template, $matches);
     foreach ($matches[0] as $key => $condition) {
         $replaced = empty($matches[2][$key]) ? $address[$matches[1][$key]] : $address[$matches[1][$key]][$matches[2][$key]];
         $template = str_replace($condition, $this->view->escape($replaced), $template);
     }
     return str_replace('EOL', $EOL, $template);
 }