示例#1
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();
 }
示例#2
0
 public function up()
 {
     /**
      * we didn't have the foreign keys between account_customer_address and default addresses,
      * so before applying the upgrade, have to cleanup possible issues
      */
     $customerRowset = Axis::model('account/customer')->select()->where('default_billing_address_id IS NOT NULL')->orWhere('default_shipping_address_id IS NOT NULL')->fetchRowset();
     $addressIds = Axis::model('account/customer_address')->select(array('id', 'customer_id'))->fetchPairs();
     foreach ($customerRowset as $customerRow) {
         $save = false;
         if (!isset($addressIds[$customerRow->default_billing_address_id])) {
             $customerRow->default_billing_address_id = new Zend_Db_Expr('NULL');
             $save = true;
         }
         if (!isset($addressIds[$customerRow->default_shipping_address_id])) {
             $customerRow->default_shipping_address_id = new Zend_Db_Expr('NULL');
             $save = true;
         }
         if ($save) {
             $customerRow->save();
         }
     }
     // add foreign keys
     $installer = Axis::single('install/installer');
     $installer->run("\n\n        ALTER TABLE `{$installer->getTable('account_customer')}`\n            ADD CONSTRAINT `FK_ACCOUNT_CUSTOMER_SHIPPING_ADDRESS` FOREIGN KEY `FK_ACCOUNT_CUSTOMER_SHIPPING_ADDRESS` (`default_shipping_address_id`)\n                REFERENCES `{$installer->getTable('account_customer_address')}` (`id`)\n                ON DELETE CASCADE\n                ON UPDATE CASCADE,\n            ADD CONSTRAINT `FK_ACCOUNT_CUSTOMER_BILLING_ADDRESS` FOREIGN KEY `FK_ACCOUNT_CUSTOMER_BILLING_ADDRESS` (`default_billing_address_id`)\n                REFERENCES `{$installer->getTable('account_customer_address')}` (`id`)\n                ON DELETE CASCADE\n                ON UPDATE CASCADE;\n\n        ");
 }
 public function removeAction()
 {
     $id = $this->_getParam('id');
     Axis::model('admin/acl_role')->delete($this->db->quoteInto('id = ?', $id));
     Axis::message()->addSuccess(Axis::translate('admin')->__('Role was deleted successfully'));
     return $this->_helper->json->sendSuccess();
 }
 /**
  * Customer add new tag on product
  * @return void
  */
 public function addAction()
 {
     $tags = array_filter(explode(',', $this->_getParam('tags')));
     $productId = $this->_getParam('productId');
     $modelCustomer = Axis::model('tag/customer');
     $modelProduct = Axis::model('tag/product');
     $defaultStatus = $modelCustomer->getDefaultStatus();
     $customerId = Axis::getCustomerId();
     $siteId = Axis::getSiteId();
     $_row = array('customer_id' => $customerId, 'site_id' => $siteId, 'status' => $modelCustomer->getDefaultStatus());
     foreach ($tags as $tag) {
         $row = $modelCustomer->select()->where('name = ?', $tag)->where('customer_id = ?', $customerId)->where('site_id = ?', $siteId)->fetchRow();
         if (!$row) {
             $_row['name'] = $tag;
             $row = $modelCustomer->createRow($_row);
             $row->save();
             Axis::message()->addSuccess(Axis::translate('tag')->__("Tag '%s' was successfully added to product", $tag));
         } else {
             Axis::message()->addNotice(Axis::translate('tag')->__("Your tag '%s' is already added to this product", $tag));
         }
         // add to product relation
         $isExist = (bool) $modelProduct->select('id')->where('customer_tag_id = ?', $row->id)->where('product_id = ?', $productId)->fetchOne();
         if (!$isExist) {
             $modelProduct->createRow(array('customer_tag_id' => $row->id, 'product_id' => $productId))->save();
         }
         Axis::dispatch('tag_product_add_success', array('tag' => $tag, 'product_id' => $productId));
     }
     $this->_redirect($this->getRequest()->getServer('HTTP_REFERER'));
 }
示例#5
0
 protected function _isEnabled()
 {
     if (null === $this->_enabled) {
         $this->_enabled = parent::_isEnabled() && Axis::model('PaymentPaypal/Express')->isEnabled();
     }
     return $this->_enabled;
 }
示例#6
0
 public function getAllowedTypes($request)
 {
     switch ($this->_config->type) {
         case Axis_ShippingTable_Model_Option_Standard_Service::PER_WEIGHT:
             $value = $request['weight'];
             break;
         case Axis_ShippingTable_Model_Option_Standard_Service::PER_ITEM:
             $value = $request['qty'];
             break;
         case Axis_ShippingTable_Model_Option_Standard_Service::PER_PRICE:
         default:
             $value = $request['price'];
             break;
     }
     $select = Axis::model('shippingTable/rate')->select();
     $select->where('value <= ? ', $value)->where('site_id = ? OR site_id = 0', Axis::getSiteId())->where('country_id = ? OR country_id = 0', $request['country']['id'])->where('zip = ? OR zip = "*"', $request['postcode'])->order('site_id DESC')->order('country_id ASC')->order('zone_id ASC')->order('zip ASC')->order('value DESC')->limit(1);
     if (isset($request['zone']['id'])) {
         $select->where('zone_id = ? OR zone_id = 0', $request['zone']['id']);
     } else {
         $select->where('zone_id = 0');
     }
     $row = $select->fetchRow();
     if ($row) {
         $handling = is_numeric($this->_config->handling) ? $this->_config->handling : 0;
         $this->_types = array(array('id' => $this->_code, 'title' => $this->getTitle(), 'price' => $row['price'] + $handling));
     }
     return $this->_types;
 }
示例#7
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('/');
 }
示例#8
0
 /**
  * Update or delete manufacturer row
  * Checks is recieved url has duplicate before save.
  * If it has - throws an exception
  *
  * @param array $data
  * <pre>
  * Array(
  * 	id, name, key_word,
  *  description => array(
  *  	langId => array()
  *  )
  * )
  * </pre>
  * @return int Manufacturer id
  * @throws Axis_Exception
  */
 public function save(array $data)
 {
     $row = $this->getRow($data);
     //$row->setUrl();
     //before save
     $url = trim($data['key_word']);
     if (empty($url)) {
         $url = $data['name'];
     }
     //        $url = preg_replace('/[^a-zA-Z0-9]/', '-', $url);
     if (Axis::single('catalog/hurl')->hasDuplicate($url, array_keys(Axis::model('core/option_site')->toArray()), (int) $row->id)) {
         throw new Axis_Exception(Axis::translate('core')->__('Column %s should be unique', 'url'));
     }
     $row->image = empty($row->image) ? '' : '/' . trim($row->image, '/');
     //end before save
     $row->save();
     //after save
     //add relation site
     $model = Axis::model('catalog/hurl');
     foreach (Axis::model('core/option_site') as $siteId => $siteName) {
         $model->save(array('site_id' => $siteId, 'key_id' => $row->id, 'key_type' => 'm', 'key_word' => $url));
     }
     //end after save
     return $row;
 }
示例#9
0
 /**
  *
  * @param int $languageId
  * @return array 
  */
 public function getValuesArrayByLanguage($languageId)
 {
     if (!$this->valueset_id) {
         return array();
     }
     return Axis::model('catalog/product_option_value')->select('*')->join('catalog_product_option_value_text', 'cpov.id = cpovt.option_value_id', 'name')->where('cpov.valueset_id = ?', $this->valueset_id)->where('cpovt.language_id = ?', $languageId)->fetchAll();
 }
示例#10
0
 public function registerAction()
 {
     $this->setTitle(Axis::translate('account')->__('Forgot password'));
     $username = $this->_getParam('username', null);
     if (empty($username)) {
         $this->render();
         return;
     }
     $customerId = Axis::single('account/customer')->getIdByEmail($username);
     if ($customerId && ($customer = Axis::single('account/customer')->find($customerId)->current()) && Axis::getSiteId() === $customer->site_id) {
         $modelForgotPassword = Axis::model('account/customer_forgotPassword');
         $hash = $modelForgotPassword->generatePassword();
         $link = $this->view->href('account/forgot', true) . '?hash=' . $hash;
         try {
             $mail = new Axis_Mail();
             $configResult = $mail->setConfig(array('event' => 'forgot_password', 'subject' => Axis::translate('account')->__('Forgotten Password'), 'data' => array('link' => $link, 'firstname' => $customer->firstname, 'lastname' => $customer->lastname), 'to' => $username));
             if ($configResult) {
                 $mail->send();
                 $modelForgotPassword->save(array('hash' => $hash, 'customer_id' => $customerId));
                 Axis::message()->addSuccess(Axis::translate('core')->__('Message was sended to you. Check your mailbox'));
             }
         } catch (Zend_Mail_Exception $e) {
             Axis::message()->addError(Axis::translate('core')->__('Mail sending was failed.'));
         }
     } else {
         Axis::message()->addError(Axis::translate('account')->__("'%s' was not found in database", $username));
     }
     $this->render();
 }
示例#11
0
 public function batchSaveAction()
 {
     $dataset = Zend_Json::decode($this->_getParam('data'));
     if (!sizeof($dataset)) {
         Axis::message()->addError(Axis::translate('core')->__('No data to save'));
         return $this->_helper->json->sendFailure();
     }
     $model = Axis::model('admin/user');
     foreach ($dataset as $data) {
         if (!empty($data['password'])) {
             $data['password'] = md5($data['password']);
         } else {
             unset($data['password']);
         }
         $row = $model->getRow($data);
         $row->is_active = false;
         $row->is_active = !empty($data['is_active']);
         $row->modified = Axis_Date::now()->toSQLString();
         if (empty($row->created)) {
             $row->created = $row->modified;
         }
         $row->save();
     }
     Axis::message()->addSuccess(Axis::translate('admin')->__('User was saved successfully'));
     return $this->_helper->json->sendSuccess();
 }
示例#12
0
 public function viewPageAction()
 {
     $link = $this->_getParam('page');
     $pageId = Axis::single('cms/page')->getPageIdByLink($link);
     $rowPage = Axis::single('cms/page')->find($pageId)->current();
     if (!$rowPage || !$rowPage->is_active) {
         return $this->_forward('not-found', 'Error', 'Axis_Core');
     }
     $rowContent = $rowPage->getContent();
     $categories = Axis::single('cms/category')->cache()->getParentCategory($pageId, true);
     foreach ($categories as $_category) {
         $label = empty($_category['title']) ? $_category['link'] : $_category['title'];
         $this->_helper->breadcrumbs(array('label' => $label, 'params' => array('cat' => $_category['link']), 'route' => 'cms_category'));
     }
     $page = array('id' => $rowPage->id, 'content' => $rowContent->content, 'is_commented' => $rowPage->comment);
     if ($rowPage->comment) {
         // get all comments
         $comments = $rowPage->cache()->getComments();
         foreach ($comments as $comment) {
             $page['comment'][] = $comment;
         }
         // create comment form
         $this->view->formComment = Axis::model('cms/form_comment', array('pageId' => $rowPage->id));
     }
     $this->view->page = $page;
     $this->setTitle($rowContent->title);
     $metaTitle = empty($rowContent->meta_title) ? $rowContent->title : $rowContent->meta_title;
     $this->view->meta()->setTitle($metaTitle, 'cms_page', $pageId)->setDescription($rowContent->meta_description)->setKeywords($rowContent->meta_keyword);
     $this->_helper->layout->setLayout($rowPage->layout);
     $this->render();
 }
示例#13
0
 public function up()
 {
     $installer = $this->getInstaller();
     $installer->run("\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('community_media')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('community_media')}` (\n          `id` int(10) unsigned NOT NULL auto_increment,\n          `path` varchar(255) NOT NULL,\n          `product_id` int(10) unsigned default NULL,\n          `customer_id` int(10) unsigned default NULL,\n          `status` enum('pending','approved','disapproved') NOT NULL,\n          `size` double NOT NULL,\n          `date_uploaded` datetime NOT NULL,\n          `author` varchar(128) NOT NULL,\n          `title` varchar(128) NOT NULL,\n          `description` varchar(255) NOT NULL,\n          `media_type` enum('video','image') NOT NULL,\n          `width` smallint(5) unsigned NOT NULL default '0',\n          `height` smallint(5) unsigned NOT NULL default '0',\n          PRIMARY KEY  (`id`),\n          KEY `FK_community_media_product` (`product_id`),\n          KEY `FK_community_media_customer` (`customer_id`),\n          CONSTRAINT `FK_community_media_customer` FOREIGN KEY (`customer_id`) REFERENCES `{$installer->getTable('account_customer')}` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,\n          CONSTRAINT `FK_community_media_product` FOREIGN KEY (`product_id`) REFERENCES `{$installer->getTable('catalog_product')}` (`id`) ON DELETE SET NULL ON UPDATE CASCADE\n        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('community_review')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('community_review')}` (\n          `id` int(10) unsigned NOT NULL auto_increment,\n          `product_id` int(10) unsigned NOT NULL,\n          `customer_id` int(10) unsigned default NULL,\n          `status` enum('pending','approved','disapproved') NOT NULL,\n          `summary` text NOT NULL,\n          `author` varchar(128) NOT NULL,\n          `title` varchar(128) NOT NULL,\n          `date_created` datetime NOT NULL,\n          `pros` varchar(255) NOT NULL,\n          `cons` varchar(255) NOT NULL,\n          PRIMARY KEY  (`id`),\n          KEY `FK_community_review_customer` (`customer_id`),\n          CONSTRAINT `FK_community_review_customer` FOREIGN KEY (`customer_id`) REFERENCES `{$installer->getTable('account_customer')}` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,\n          CONSTRAINT `FK_community_review_product` FOREIGN KEY (`product_id`) REFERENCES `{$installer->getTable('catalog_product')}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n        ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('community_review_mark')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('community_review_mark')}` (\n          `review_id` int(10) unsigned NOT NULL default '0',\n          `rating_id` int(10) unsigned NOT NULL,\n          `mark` float default NULL,\n          PRIMARY KEY  (`review_id`,`rating_id`),\n          KEY `FK_community_review_mark_rating` (`rating_id`),\n          CONSTRAINT `FK_community_review_mark_review` FOREIGN KEY (`review_id`) REFERENCES `{$installer->getTable('community_review')}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,\n          CONSTRAINT `FK_community_review_mark_rating` FOREIGN KEY (`rating_id`) REFERENCES `{$installer->getTable('community_review_rating')}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n        ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('community_review_rating')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('community_review_rating')}` (\n          `id` int(10) unsigned NOT NULL auto_increment,\n          `name` varchar(64) NOT NULL,\n          `status` enum('enabled','disabled') NOT NULL,\n          PRIMARY KEY  (`id`)\n        ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;\n\n        INSERT INTO `{$installer->getTable('community_review_rating')}` (`id`, `status`, `name`) VALUES\n        (1, 'enabled', 'price'),\n        (2, 'enabled', 'quality'),\n        (3, 'enabled', 'value');\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('community_review_rating_title')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('community_review_rating_title')}` (\n          `rating_id` int(10) unsigned NOT NULL,\n          `language_id` smallint(5) unsigned NOT NULL,\n          `title` varchar(128) NOT NULL,\n          PRIMARY KEY  USING BTREE (`rating_id`,`language_id`),\n          KEY `FK_community_review_rating_title_language_id` (`language_id`),\n          CONSTRAINT `FK_community_review_rating_title_language_id` FOREIGN KEY (`language_id`) REFERENCES `{$installer->getTable('locale_language')}` (`id`) ON DELETE CASCADE,\n          CONSTRAINT `FK_community_review_rating_title_rating_id` FOREIGN KEY (`rating_id`) REFERENCES `{$installer->getTable('community_review_rating')}` (`id`) ON DELETE CASCADE\n        ) ENGINE=InnoDB  DEFAULT CHARSET=utf8;\n\n        ");
     $titles = array('Price', 'Quality', 'Value');
     $languages = Axis::model('locale/option_language');
     $mRatingTitle = Axis::model('community/review_rating_title');
     foreach (Axis::model('community/review_rating')->fetchAll() as $rating) {
         foreach ($languages as $languageId => $languageName) {
             $mRatingTitle->createRow(array('rating_id' => $rating->id, 'language_id' => $languageId, 'title' => $titles[$rating->id - 1]))->save();
         }
     }
     $this->getConfigBuilder()->section('community', 'Community')->setTranslation('Axis_Community')->section('review', 'Reviews')->option('enabled', 'Enabled', true)->setType('radio')->setModel('core/option_boolean')->option('rating_enabled', 'Enable ratings', true)->setType('radio')->setDescription('Enable rating system in reviews')->setModel('core/option_boolean')->option('rating_title', 'Show rating title', true)->setType('radio')->setDescription('Show rating titles')->setModel('core/option_boolean')->option('merge_average', 'Merge average ratings', true)->setType('radio')->setDescription('Show average rating as one')->setModel('core/option_boolean')->option('customer_status', 'Default customer review status')->setValue(Axis_Community_Model_Option_Review_Status::PENDING)->setType('select')->setDescription('Default review status written by registered customer')->setModel('community/option_review_status')->option('guest_status', 'Default guest review status')->setValue(Axis_Community_Model_Option_Review_Status::PENDING)->setType('select')->setDescription('Default review status written by guest')->setModel('community/option_review_status')->option('guest_permission', 'Allow guest to write a reviews', true)->setType('radio')->setModel('core/option_boolean')->option('perPage', 'Reviews showed per page', '10,25,50,all')->option('perPageDefault', 'Default reviews count per page', '10')->section('/review')->section('/');
     Axis::single('account/customer_field')->add(array('nickname' => 'Nickname'), array('community' => 'Community'), array('validator' => 'Alnum', 'axis_validator' => 'Axis_Community_Validate_Nickname'));
     Axis::single('core/page')->add('community/*/*')->add('community/review/*')->add('community/review/index')->add('community/review/detail')->add('community/review/product')->add('community/review/customer');
     /*->add('community/image/*')
       ->add('community/image/index')
       ->add('community/image/detail')
       ->add('community/image/product')
       ->add('community/image/customer')
       ->add('community/video/*')
       ->add('community/video/index')
       ->add('community/video/detail')
       ->add('community/video/product')
       ->add('community/video/customer');*/
 }
示例#14
0
 public function up()
 {
     $installer = $this->getInstaller();
     $installer->run("\n\n        ALTER TABLE `{$installer->getTable('core_template_box_page')}`\n            MODIFY COLUMN `sort_order` TINYINT(3) DEFAULT NULL;\n\n        ");
     $rowset = Axis::model('core/template_box')->fetchAll();
     foreach ($rowset as $row) {
         if (empty($row->config)) {
             $row->config = '{}';
             $row->save();
             continue;
         }
         try {
             if (is_array(Zend_Json::decode($row->config))) {
                 continue;
             }
         } catch (Exception $e) {
             // non-json content
         }
         $config = array();
         foreach (explode(',', $row->config) as $_param) {
             list($key, $value) = explode(':', $_param);
             if ('disable_wrapper' === $key) {
                 $value = (int) $value;
             }
             $config[$key] = $value;
         }
         $row->config = Zend_Json::encode($config);
         $row->save();
     }
 }
示例#15
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;
 }
示例#16
0
 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();
 }
示例#17
0
 public function registerAction()
 {
     $this->_helper->layout->disableLayout();
     $email = $this->_getParam('email', null);
     if (!$this->_request->isPost()) {
         $this->render();
         return;
     }
     if (empty($email)) {
         Axis::message()->addError(Axis::translate('admin')->__('Email address is required'));
         $this->render();
         return;
     }
     $model = Axis::model('admin/user');
     if ($model->hasEmail($email)) {
         $hash = $this->_generatePassword();
         $link = $this->view->href('forgot') . '?hash=' . $hash;
         try {
             $mail = new Axis_Mail();
             $configResult = $mail->setConfig(array('event' => 'forgot_password', 'subject' => Axis::translate('admin')->__('Forgot Your Backend Password'), 'data' => array('link' => $link, 'firstname' => $model->getFirstnameByEmail($email), 'lastname' => $model->getLastnameByEmail($email)), 'to' => $email));
             $mail->send();
             if ($configResult) {
                 Axis::single('admin/UserForgotPassword')->save(array('hash' => $hash, 'user_id' => $model->getIdByEmail($email)));
                 Axis::message()->addSuccess(Axis::translate('admin')->__('See your mailbox to proceed'));
             }
         } catch (Zend_Mail_Transport_Exception $e) {
             Axis::message()->addError(Axis::translate('core')->__('Mail sending was failed.'));
         }
     } else {
         Axis::message()->addError(Axis::translate('admin')->__('Email address was not found in our records'));
     }
     $this->render();
 }
 public function saveAction()
 {
     $_row = $this->_getAllParams();
     $row = Axis::model('catalog/product_option_ValueSet')->save($_row);
     Axis::message()->addSuccess(Axis::translate('catalog')->__('Data has been saved successfully'));
     return $this->_helper->json->setData($row->toArray())->sendSuccess();
 }
示例#19
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();
 }
示例#20
0
 public function init()
 {
     parent::init();
     $this->view->languages = Axis::model('locale/option_language')->toArray();
     $this->view->sites = Axis::model('core/option_site')->toArray();
     $this->view->locales = Axis::single('locale/language')->select()->fetchAssoc();
     $this->view->adminUrl = '/' . trim(Axis::config('core/backend/route'), '/ ');
 }
示例#21
0
 protected function _beforeRender()
 {
     $currencies = Axis::model('locale/option_currency')->toArray();
     if (count($currencies) <= 1) {
         return false;
     }
     $this->setFromArray(array('currencyCode' => Axis::single('locale/currency')->getCode(), 'currency' => $currencies));
 }
示例#22
0
 public function removeAction()
 {
     $data = Zend_Json::decode($this->_getParam('data'));
     Axis::model('core/site')->delete($this->db->quoteInto('id IN(?)', $data));
     Axis::dispatch('core_site_delete_success', array('site_ids' => $data));
     Axis::message()->addSuccess(Axis::translate('admin')->__('Site was deleted successfully'));
     return $this->_helper->json->sendSuccess();
 }
示例#23
0
 public function up()
 {
     $rowset = Axis::model('admin/acl_rule')->select()->where("resource_id LIKE 'admin/import%'")->fetchRowset();
     foreach ($rowset as $row) {
         $row->resource_id = str_replace('admin/import', 'admin/axis/import', $row->resource_id);
         $row->save();
     }
 }
示例#24
0
 protected function _beforeRender()
 {
     $orders = Axis::model('sales/order')->getOrdersByCustomer(Axis::getCustomerId());
     if (!count($orders)) {
         return false;
     }
     $this->orders = $orders;
 }
示例#25
0
 public function removeAction()
 {
     $data = Zend_Json::decode($this->_getParam('data'));
     if (!sizeof($data)) {
         return;
     }
     Axis::model('tag/customer')->delete($this->db->quoteInto('id IN(?)', $data));
     return $this->_helper->json->sendSuccess();
 }
示例#26
0
 public function up()
 {
     $rowset = Axis::model('cms/page')->fetchAll();
     foreach ($rowset as $row) {
         list($theme, $layout) = explode('_', $row->layout, 2);
         $row->layout = 'layout_' . $layout;
         $row->save();
     }
 }
示例#27
0
 public function listAction()
 {
     function _calculateShippingTax($price, Axis_Method_Shipping_Model_Abstract $shipping, array $params)
     {
         $customerGroupId = $params['customer_group_id'];
         if (!($taxClassId = $shipping->config()->taxClass)) {
             if (!($taxClassId = Axis::config()->tax->shipping->taxClass)) {
                 return 0;
             }
         }
         if (!($taxBasis = $shipping->config()->taxBasis)) {
             if (!($taxBasis = Axis::config()->tax->shipping->taxBasis)) {
                 return 0;
             }
         }
         if ('billing' === $taxBasis) {
             $countryId = $params['billing_country_id'];
             $zoneId = $params['billing_zone_id'];
         } else {
             $countryId = $params['delivery_country_id'];
             $zoneId = $params['delivery_zone_id'];
         }
         if (empty($zoneId)) {
             $zoneId = null;
         }
         $geozoneIds = Axis::single('location/geozone')->getIds($countryId, $zoneId);
         if (empty($geozoneIds)) {
             return 0;
         }
         return Axis::single('tax/rate')->calculateByPrice($price, $taxClassId, $geozoneIds, $customerGroupId);
     }
     $this->_helper->layout->disableLayout();
     $params = $this->_getAllParams();
     $countryId = (int) $this->_getParam('delivery_country_id', 0);
     $zoneId = (int) $this->_getParam('delivery_zone_id', 0);
     $quantity = (double) $this->_getParam('quantity', 0);
     $weight = (double) $this->_getParam('weight', 0);
     $subtotal = (double) $this->_getParam('subtotal', 0);
     $paymentMethodCode = $this->_getParam('payment_method_code', null);
     if (empty($paymentMethodCode)) {
         $paymentMethodCode = null;
     }
     $postcode = $this->_getParam('postcode', null);
     $request = array('boxes' => 1, 'qty' => $quantity, 'weight' => $weight, 'price' => $subtotal, 'payment_method_code' => $paymentMethodCode, 'postcode' => $postcode);
     $request['country'] = Axis::model('location/country')->find($countryId)->current()->toArray();
     $request['zone'] = Axis::model('location/zone')->find($zoneId)->current()->toArray();
     $allowedMethods = Axis_Shipping::getAllowedMethods($request);
     $data = array();
     foreach ($allowedMethods['methods'] as $methodCode => $types) {
         $shipping = Axis_Shipping::getMethod($methodCode);
         $title = $shipping->getTitle();
         foreach ($types as $type) {
             $data[] = array('code' => $type['id'], 'title' => $type['title'], 'name' => $title . ' ' . $type['title'] . ' ' . $type['price'], 'price' => $type['price'], 'tax' => _calculateShippingTax($type['price'], $shipping, $params));
         }
     }
     return $this->_helper->json->setData($data)->sendSuccess();
 }
示例#28
0
 public function init()
 {
     $this->addElement('hidden', 'id', array('validators' => array(new Axis_Account_Model_Form_Validate_AddressId())));
     $configOptions = Axis::config('account/address_form')->toArray();
     $this->_fieldConfig = array_merge($this->_fieldConfig, $configOptions);
     $countries = Axis::model('location/option_country')->toArray();
     if (isset($countries['0']) && 'ALL WORLD COUNTRY' === $countries['0']) {
         unset($countries['0']);
     }
     $allowedCountries = $configOptions['country_id_allow'];
     if (!in_array(0, $allowedCountries)) {
         // ALL WORLD COUNTRIES is not selected
         $countries = array_intersect_key($countries, array_flip($allowedCountries));
     }
     $countryIds = array_keys($countries);
     $defaultCountry = current($countryIds);
     $zones = Axis::model('location/option_zone')->toArray();
     $this->_zones = $zones;
     foreach ($this->_fields as $name => $values) {
         $status = $this->_fieldConfig[$name . '_status'];
         if ('disabled' == $status) {
             continue;
         }
         $fieldOptions = array('required' => 'required' === $status, 'label' => $values['label'], 'class' => $values['class'] . ('required' === $status ? ' required' : ''));
         if (isset($this->_fieldConfig[$name . '_sort_order'])) {
             $fieldOptions['order'] = $this->_fieldConfig[$name . '_sort_order'];
         }
         if ('country_id' == $name) {
             $fieldOptions['validators'] = array(new Zend_Validate_InArray(array_keys($countries)));
             $values['type'] = new Zend_Form_Element_Select($name, $fieldOptions);
             $values['type']->removeDecorator('HtmlTag')->addDecorator('HtmlTag', array('tag' => 'li', 'id' => "{$name}-row", 'class' => 'element-row'));
             $values['type']->options = $countries;
         } else {
             if ('zone_id' == $name) {
                 $values['type'] = new Zend_Form_Element_Select($name, $fieldOptions);
                 $values['type']->removeDecorator('HtmlTag')->addDecorator('HtmlTag', array('tag' => 'li', 'id' => "{$name}-row", 'class' => 'element-row'));
                 if (isset($zones[$defaultCountry]) && count($countries)) {
                     $values['type']->options = $zones[$defaultCountry];
                 }
                 // zone name field
                 $zoneNameOptions = $fieldOptions;
                 $zoneNameOptions['order']++;
                 $zoneNameOptions['class'] .= ' input-text';
                 $this->addElement('text', 'state', $zoneNameOptions);
             }
         }
         $this->addElement($values['type'], $name, $fieldOptions);
     }
     $this->addDisplayGroup($this->getElements(), 'address', array('legend' => 'Address'));
     $this->addElement('checkbox', 'default_billing', array('label' => 'Use as my default billing address', 'class' => 'input-checkbox'));
     $element = $this->getElement('default_billing');
     $this->addElement('checkbox', 'default_shipping', array('label' => 'Use as my default shipping address', 'class' => 'input-checkbox'));
     $element = $this->getElement('default_shipping');
     $this->addElement('button', 'submit', array('type' => 'submit', 'class' => 'button', 'label' => 'Save'));
     $this->addActionBar(array('submit'));
 }
示例#29
0
 public function batchSaveAction()
 {
     $_rowset = Zend_Json::decode($this->_getParam('data'));
     $model = Axis::model('cms/page_comment');
     foreach ($_rowset as $id => $_row) {
         $model->find($id)->current()->setFromArray($_row)->save();
     }
     Axis::message()->addSuccess(Axis::translate('core')->__('Data was saved successfully'));
     return $this->_helper->json->sendSuccess();
 }
示例#30
0
 public function batchSaveAction()
 {
     $_rowset = Zend_Json::decode($this->_getParam('data'));
     $model = Axis::model('cms/block');
     foreach ($_rowset as $_row) {
         $model->save($_row);
     }
     Axis::message()->addSuccess(Axis::translate('core')->__('Data was saved successfully'));
     return $this->_helper->json->sendSuccess();
 }