示例#1
0
 public function up()
 {
     $installer = Axis::single('install/installer');
     $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_Collect_Language::collect();
     $mRatingTitle = Axis::model('community/review_rating_title');
     foreach (Axis::model('community/review_rating')->fetchAll() as $rating) {
         foreach ($languages as $langId => $langName) {
             $mRatingTitle->createRow(array('rating_id' => $rating->id, 'language_id' => $langId, 'title' => $titles[$rating->id - 1]))->save();
         }
     }
     Axis::single('core/config_field')->add('community', 'Community', null, null, array('translation_module' => 'Axis_Community'))->add('community/review/enabled', 'Community/Reviews/Enabled', 1, 'bool')->add('community/review/rating_enabled', 'Enable ratings', 1, 'bool', 'Enable rating system in reviews')->add('community/review/rating_title', 'Show rating title', 1, 'bool', 'Show rating titles')->add('community/review/merge_average', 'Merge average ratings', 1, 'bool', 'Show average rating as one')->add('community/review/customer_status', 'Default customer review status', 'pending', 'select', 'Default review status written by registered customer', array('config_options' => 'pending,approved,disapproved'))->add('community/review/guest_status', 'Default guest review status', 'pending', 'select', 'Default review status written by guest', array('config_options' => 'pending,approved,disapproved'))->add('community/review/guest_permission', 'Allow guest to write a reviews', 1, 'bool')->add('community/review/perPage', 'Reviews showed per page', '10,25,50,all')->add('community/review/perPageDefault', 'Default reviews count per page', '10');
     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');*/
 }
 public function listAction()
 {
     $select = Axis::model('catalog/product_manufacturer')->select('id')->calcFoundRows()->distinct()->addUrl()->joinDescription()->addFilters($this->_getParam('filter', array()))->limit($this->_getParam('limit', 25), $this->_getParam('start', 0))->order($this->_getParam('sort', 'cpm.id') . ' ' . $this->_getParam('dir', 'DESC'));
     if (!($ids = $select->fetchCol())) {
         return $this->_helper->json->setData(array())->setCount(0)->sendSuccess();
     }
     $count = $select->foundRows();
     $select = Axis::model('catalog/product_manufacturer')->select('*')->addUrl()->addDescription(false)->where('cpm.id IN (?)', $ids)->order($this->_getParam('sort', 'cpm.id') . ' ' . $this->_getParam('dir', 'DESC'));
     $data = array();
     $languageIds = array_keys(Axis_Collect_Language::collect());
     foreach ($select->fetchAll() as $manufacturer) {
         if (!isset($data[$manufacturer['id']])) {
             $data[$manufacturer['id']] = $manufacturer;
             $data[$manufacturer['id']]['description'] = array();
             unset($data[$manufacturer['id']]['title']);
             unset($data[$manufacturer['id']]['language_id']);
             unset($data[$manufacturer['id']]['manufacturer_id']);
         }
         if ($languageId = $manufacturer['language_id']) {
             $data[$manufacturer['id']]['description']['lang_' . $languageId] = array('title' => $manufacturer['title'], 'description' => $manufacturer['description']);
         }
     }
     foreach ($languageIds as $languageId) {
         foreach ($data as $manufacturerId => &$values) {
             if (isset($values['description']['lang_' . $languageId])) {
                 continue;
             }
             $values['description']['lang_' . $languageId] = array('title' => '', 'description' => '');
         }
     }
     return $this->_helper->json->setData(array_values($data))->setCount($count)->sendSuccess();
 }
示例#3
0
 /**
  *
  * @param array $dataset
  * @return Axis_Catalog_Model_Product_Manufacturer_Row 
  */
 public function setDescriptions(array $dataset)
 {
     $model = Axis::model('catalog/product_manufacturer_description');
     foreach (array_keys(Axis_Collect_Language::collect()) as $languageId) {
         if (!isset($dataset[$languageId])) {
             continue;
         }
         $model->getRow($this->id, $languageId)->setFromArray($dataset[$languageId])->save();
     }
     return $this;
 }
 public function loadAction()
 {
     $id = $this->_getParam('id');
     $row = Axis::single('cms/category')->find($id)->current();
     $data = $row->toArray();
     $content = Axis::model('cms/category_content')->select(array('language_id', '*'))->where('ccc.cms_category_id = ?', $row->id)->fetchAssoc();
     foreach (Axis_Collect_Language::collect() as $languageId => $lName) {
         $data['content']['lang' . '_' . $languageId] = isset($content[$languageId]) ? $content[$languageId] : array();
     }
     return $this->_helper->json->setData($data)->sendSuccess();
 }
示例#5
0
 public function up()
 {
     $installer = Axis::single('install/installer');
     $installer->run("\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('catalog_category')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('catalog_category')}` (\n          `id` mediumint(8) unsigned NOT NULL auto_increment,\n          `site_id` smallint(5) unsigned NOT NULL,\n          `lft` smallint(5) unsigned NOT NULL,\n          `rgt` smallint(5) unsigned NOT NULL,\n          `lvl` tinyint(3) unsigned NOT NULL,\n          `created_on` datetime NOT NULL,\n          `modified_on` datetime default NULL,\n          `status` enum('enabled','disabled') default 'enabled',\n          `image_base` varchar(255) NOT NULL DEFAULT '',\n          `image_listing` VARCHAR(255) NOT NULL DEFAULT '',\n          PRIMARY KEY  (`id`),\n          KEY `i_site_id` (`site_id`),\n          KEY `i_lft` (`lft`),\n          KEY `i_rgt` (`rgt`),\n          KEY `i_lvl` (`lvl`)\n        ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;\n\n        INSERT INTO `{$installer->getTable('catalog_category')}` (`id`, `site_id`, `lft`, `rgt`, `lvl`, `created_on`, `modified_on`, `status`, `image_base`, `image_listing`) VALUES\n        (1, 1, 1, 2, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'enabled', '', '');\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('catalog_category_description')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('catalog_category_description')}` (\n          `category_id` mediumint(8) unsigned NOT NULL,\n          `language_id` smallint(5) unsigned NOT NULL,\n          `name` varchar(128) NOT NULL DEFAULT '',\n          `description` text NOT NULL DEFAULT '',\n          `meta_title` varchar(128) NOT NULL DEFAULT '',\n          `meta_description` text NOT NULL DEFAULT '',\n          `meta_keyword` varchar(255) NOT NULL DEFAULT '',\n          `image_base_title` VARCHAR(128) NOT NULL DEFAULT '',\n          `image_listing_title` VARCHAR(128) NOT NULL DEFAULT '',\n          PRIMARY KEY  (`category_id`,`language_id`),\n          KEY `i_language_id` (`language_id`),\n          CONSTRAINT `FK_CATALOG_CATEGORY_DESCRIPTION_CATEGORY_ID` FOREIGN KEY (`category_id`) REFERENCES `{$installer->getTable('catalog_category')}` (`id`) ON DELETE CASCADE,\n          CONSTRAINT `FK_CATALOG_CATEGORY_DESCRIPTION_LANGUAGE_ID` FOREIGN KEY (`language_id`) REFERENCES `{$installer->getTable('locale_language')}` (`id`) ON DELETE CASCADE\n        ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('catalog_hurl')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('catalog_hurl')}` (\n          `key_word` varchar(128) NOT NULL,\n          `site_id` smallint(5) unsigned NOT NULL,\n          `key_type` enum('c','m','p') NOT NULL,\n          `key_id` mediumint(8) unsigned NOT NULL,\n          PRIMARY KEY  USING BTREE (`key_word`,`site_id`),\n          KEY `i_elastic_url_site_id` (`site_id`),\n          KEY `i_elastic_url_key_id` (`key_id`)\n        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('catalog_product')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('catalog_product')}` (\n          `id` int(10) unsigned NOT NULL auto_increment,\n          `manufacturer_id` smallint(5) unsigned default NULL,\n          `quantity` decimal(15,4) unsigned NOT NULL default '0.0000',\n          `sku` varchar(255) default NULL,\n          `image_base` INTEGER UNSIGNED DEFAULT NULL,\n          `image_listing` INTEGER UNSIGNED DEFAULT NULL,\n          `image_thumbnail` INTEGER UNSIGNED DEFAULT NULL,\n          `cost` DECIMAL(15,4) UNSIGNED NOT NULL DEFAULT '0.0000',\n          `price` decimal(15,4) UNSIGNED NOT NULL default '0.0000',\n          `date_available` date default NULL,\n          `weight` decimal(10,3) default '0.000',\n          `is_active` tinyint(1) unsigned NOT NULL default '0',\n          `ordered` mediumint(8) unsigned NOT NULL default '0',\n          `created_on` datetime NOT NULL,\n          `modified_on` datetime default NULL,\n          `tax_class_id` mediumint(8) unsigned default NULL,\n          `viewed` mediumint(8) unsigned NOT NULL default '0',\n          `new_from` DATETIME DEFAULT NULL,\n          `new_to` DATETIME DEFAULT NULL,\n          `featured_from` DATETIME DEFAULT NULL,\n          `featured_to` DATETIME DEFAULT NULL,\n          PRIMARY KEY  (`id`),\n          UNIQUE KEY `product_sku` (`sku`),\n          KEY `i_manufacture_id` USING BTREE (`manufacturer_id`),\n          CONSTRAINT `FK_CATALOG_PRODUCT_MANUFACTURER` FOREIGN KEY (`manufacturer_id`) REFERENCES `{$installer->getTable('catalog_product_manufacturer')}` (`id`) ON DELETE SET NULL,\n          CONSTRAINT `FK_CATALOG_PRODUCT_TAX_CLASS` FOREIGN KEY (`tax_class_id`) REFERENCES `{$installer->getTable('tax_class')}` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,\n          CONSTRAINT `FK_CATALOG_PRODUCT_IMAGE_BASE_IMAGE` FOREIGN KEY `FK_CATALOG_PRODUCT_IMAGE_BASE_IMAGE` (`image_base`)\n            REFERENCES `{$installer->getTable('catalog_product_image')}` (`id`)\n            ON DELETE SET NULL\n            ON UPDATE CASCADE,\n          CONSTRAINT `FK_CATALOG_PRODUCT_IMAGE_LISTING_IMAGE` FOREIGN KEY `FK_CATALOG_PRODUCT_IMAGE_LISTING_IMAGE` (`image_listing`)\n            REFERENCES `{$installer->getTable('catalog_product_image')}` (`id`)\n            ON DELETE SET NULL\n            ON UPDATE CASCADE,\n          CONSTRAINT `FK_CATALOG_PRODUCT_IMAGE_THUMBNAIL_IMAGE` FOREIGN KEY `FK_CATALOG_PRODUCT_IMAGE_THUMBNAIL_IMAGE` (`image_thumbnail`)\n            REFERENCES `{$installer->getTable('catalog_product_image')}` (`id`)\n            ON DELETE SET NULL\n            ON UPDATE CASCADE\n        ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('catalog_product_attribute')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('catalog_product_attribute')}` (\n          `id` int(10) unsigned NOT NULL auto_increment,\n          `product_id` int(10) unsigned NOT NULL,\n          `variation_id` int(10) unsigned default '0',\n          `option_id` mediumint(8) unsigned NOT NULL,\n          `option_value_id` int(10) unsigned default NULL,\n          `price` decimal(15,4) default NULL,\n          `price_type` enum('to','by','percent') default NULL,\n          `weight` decimal(10,2) default NULL,\n          `weight_type` enum('to','by','percent') default NULL,\n          `modifier` tinyint(1) unsigned NOT NULL default '0',\n          PRIMARY KEY  (`id`),\n          KEY `FK_product_attribute2_pi` (`product_id`),\n          KEY `FK_product_attribute2_pvi` (`variation_id`),\n          KEY `FK_product_attribute2_poi` (`option_id`),\n          KEY `FK_product_attribute2_povi` (`option_value_id`),\n          CONSTRAINT `FK_PRODUCT_ATTRIBUTE_OPTION_ID` FOREIGN KEY (`option_id`) REFERENCES `{$installer->getTable('catalog_product_option')}` (`id`) ON DELETE CASCADE,\n          CONSTRAINT `FK_PRODUCT_ATTRIBUTE_PRODUCT_ID` FOREIGN KEY (`product_id`) REFERENCES `{$installer->getTable('catalog_product')}` (`id`) ON DELETE CASCADE,\n          CONSTRAINT `FK_PRODUCT_ATTRIBUTE_VALUE_ID` FOREIGN KEY (`option_value_id`) REFERENCES `{$installer->getTable('catalog_product_option_value')}` (`id`) ON DELETE CASCADE,\n          CONSTRAINT `FK_PRODUCT_ATTRIBUTE_VARIATION_ID` FOREIGN KEY (`variation_id`) REFERENCES `{$installer->getTable('catalog_product_variation')}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n        ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('catalog_product_attribute_value')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('catalog_product_attribute_value')}` (\n          `product_attribute_id` int(10) unsigned NOT NULL,\n          `language_id` smallint(5) unsigned NOT NULL default '0',\n          `attribute_value` text,\n          PRIMARY KEY  (`product_attribute_id`,`language_id`),\n          KEY `FK_PRODUCT_ATTRIBUTE_ID` (`product_attribute_id`),\n          CONSTRAINT `FK_PRODUCT_ATTRIBUTE_ID` FOREIGN KEY (`product_attribute_id`) REFERENCES `{$installer->getTable('catalog_product_attribute')}` (`id`) ON DELETE CASCADE\n        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('catalog_product_category')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('catalog_product_category')}` (\n          `category_id` mediumint(8) unsigned NOT NULL,\n          `product_id` int(10) unsigned NOT NULL,\n          PRIMARY KEY  (`category_id`,`product_id`),\n          KEY `FK_PRODUCT_ID` (`product_id`),\n          CONSTRAINT `FK_PRODUCT_CATEGORY_ID` FOREIGN KEY (`category_id`) REFERENCES `{$installer->getTable('catalog_category')}` (`id`) ON DELETE CASCADE,\n          CONSTRAINT `FK_PRODUCT_ID` FOREIGN KEY (`product_id`) REFERENCES `{$installer->getTable('catalog_product')}` (`id`) ON DELETE CASCADE\n        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('catalog_product_description')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('catalog_product_description')}` (\n          `product_id` int(10) unsigned NOT NULL,\n          `language_id` smallint(5) unsigned NOT NULL,\n          `name` varchar(255) NOT NULL DEFAULT '',\n          `description` text NOT NULL DEFAULT '',\n          `viewed` mediumint(8) unsigned NOT NULL default '0',\n          `image_seo_name` varchar(128) NOT NULL DEFAULT '',\n          `meta_title` varchar(128) NOT NULL DEFAULT '',\n          `meta_description` text NOT NULL DEFAULT '',\n          `meta_keyword` text NOT NULL DEFAULT '',\n          `short_description` text NOT NULL DEFAULT '',\n          PRIMARY KEY  (`product_id`,`language_id`),\n          KEY `FK_PRODUCT_DESCRIPTION_LANGUAGE_ID` (`language_id`),\n          CONSTRAINT `FK_PRODUCT_DESCRIPTION_PRODUCT_ID` FOREIGN KEY (`product_id`) REFERENCES `{$installer->getTable('catalog_product')}` (`id`) ON DELETE CASCADE,\n          CONSTRAINT `FK_PRODUCT_DESCRIPTION_LANGUAGE_ID` FOREIGN KEY (`language_id`) REFERENCES `{$installer->getTable('locale_language')}` (`id`) ON DELETE CASCADE\n        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('catalog_product_image')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('catalog_product_image')}` (\n          `id` int(10) unsigned NOT NULL auto_increment,\n          `product_id` int(10) unsigned NOT NULL,\n          `path` varchar(255) NOT NULL DEFAULT '',\n          `sort_order` TINYINT UNSIGNED NOT NULL DEFAULT 1,\n          PRIMARY KEY  (`id`),\n          KEY `FK_CATALOG_PRODUCT_IMAGE_PRODUCT_ID_PRODUCT` (`product_id`),\n          CONSTRAINT `FK_CATALOG_PRODUCT_IMAGE_PRODUCT_ID_PRODUCT` FOREIGN KEY (`product_id`)\n            REFERENCES `{$installer->getTable('catalog_product')}` (`id`)\n            ON DELETE CASCADE\n            ON UPDATE CASCADE\n        ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('catalog_product_image_title')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('catalog_product_image_title')}` (\n          `image_id` INTEGER UNSIGNED NOT NULL,\n          `language_id` SMALLINT(5) UNSIGNED NOT NULL,\n          `title` VARCHAR(128) NOT NULL,\n          PRIMARY KEY (`image_id`, `language_id`),\n          CONSTRAINT `FK_CATALOG_PRODUCT_IMAGE_TITLE_IMAGE` FOREIGN KEY `FK_CATALOG_PRODUCT_IMAGE_TITLE_IMAGE` (`image_id`)\n            REFERENCES `{$installer->getTable('catalog_product_image')}` (`id`)\n            ON DELETE CASCADE\n            ON UPDATE CASCADE,\n          CONSTRAINT `FK_CATALOG_PRODUCT_IMAGE_TITLE_LANGUAGE` FOREIGN KEY `FK_CATALOG_PRODUCT_IMAGE_TITLE_LANGUAGE` (`language_id`)\n            REFERENCES `{$installer->getTable('locale_language')}` (`id`)\n            ON DELETE CASCADE\n            ON UPDATE CASCADE\n        ) ENGINE = InnoDB DEFAULT CHARSET=utf8;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('catalog_product_manufacturer')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('catalog_product_manufacturer')}` (\n          `id` smallint(5) unsigned NOT NULL auto_increment,\n          `name` varchar(128) NOT NULL,\n          `image` varchar(255) default NULL,\n          PRIMARY KEY  (`id`)\n        ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('catalog_product_manufacturer_title')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('catalog_product_manufacturer_title')}` (\n          `manufacturer_id` smallint(5) unsigned NOT NULL,\n          `language_id` smallint(5) unsigned NOT NULL,\n          `title` varchar(255) NOT NULL,\n          PRIMARY KEY  USING BTREE (`manufacturer_id`,`language_id`),\n          KEY `FK_PRODUCT_MANUFACTURER_TITLE_LANGUAGE_ID` (`language_id`),\n          CONSTRAINT `FK_PRODUCT_MANUFACTURER_TITLE_MANUFACTURER_ID` FOREIGN KEY (`manufacturer_id`) REFERENCES `{$installer->getTable('catalog_product_manufacturer')}` (`id`) ON DELETE CASCADE,\n          CONSTRAINT `FK_PRODUCT_MANUFACTURER_TITLE_LANGUAGE_ID` FOREIGN KEY (`language_id`) REFERENCES `{$installer->getTable('locale_language')}` (`id`) ON DELETE CASCADE\n        ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('catalog_product_option')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('catalog_product_option')}` (\n          `id` MEDIUMINT(8) UNSIGNED NOT NULL AUTO_INCREMENT,\n          `code` VARCHAR(32) NOT NULL,\n          `input_type` TINYINT(3) UNSIGNED NOT NULL default '0',\n          `sort_order` TINYINT(3) UNSIGNED NOT NULL default '10',\n          `searchable` TINYINT(1) UNSIGNED NOT NULL default '0',\n          `comparable` TINYINT(1) UNSIGNED NOT NULL default '1',\n          `languagable` TINYINT(1) UNSIGNED NOT NULL default '0',\n          `filterable` TINYINT(1) UNSIGNED NOT NULL default '1',\n          `visible` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1',\n          `valueset_id` SMALLINT(5) UNSIGNED DEFAULT NULL,\n          PRIMARY KEY  (`id`),\n          UNIQUE KEY `product_option_code` (`code`),\n          KEY `product_option_sort_order` USING BTREE (`sort_order`),\n          CONSTRAINT `FK_CATALOG_PRODUCT_OPTION_VALUESET` FOREIGN KEY `FK_CATALOG_PRODUCT_OPTION_VALUESET` (`valueset_id`)\n            REFERENCES `{$installer->getTable('catalog_product_option_valueset')}` (`id`)\n            ON DELETE SET NULL\n            ON UPDATE CASCADE\n        ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('catalog_product_option_text')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('catalog_product_option_text')}` (\n          `option_id` mediumint(8) unsigned NOT NULL,\n          `language_id` smallint(5) unsigned NOT NULL,\n          `name` varchar(128) NOT NULL,\n          `description` varchar(255) NOT NULL DEFAULT '',\n          PRIMARY KEY  (`option_id`,`language_id`),\n          CONSTRAINT `FK_PRODUCT_OPTION_ID` FOREIGN KEY (`option_id`)\n            REFERENCES `{$installer->getTable('catalog_product_option')}` (`id`)\n            ON DELETE CASCADE\n            ON UPDATE CASCADE,\n          CONSTRAINT `FK_PRODUCT_OPTION_LANGUAGE` FOREIGN KEY (`language_id`)\n            REFERENCES `{$installer->getTable('locale_language')}` (`id`)\n            ON DELETE CASCADE\n            ON UPDATE CASCADE\n        ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('catalog_product_option_value')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('catalog_product_option_value')}` (\n          `id` int(10) unsigned NOT NULL auto_increment,\n          `sort_order` tinyint(3) unsigned NOT NULL default '0',\n          `valueset_id` smallint(5) unsigned NOT NULL,\n          PRIMARY KEY  USING BTREE (`id`),\n          KEY `FK_CATALOG_PRODUCT_OPTION_VALUE_VALUESET` (`valueset_id`),\n          CONSTRAINT `FK_CATALOG_PRODUCT_OPTION_VALUE_VALUESET` FOREIGN KEY (`valueset_id`)\n           REFERENCES `{$installer->getTable('catalog_product_option_valueset')}` (`id`)\n           ON DELETE CASCADE\n        ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('catalog_product_option_value_text')}`;\n        CREATE TABLE  `{$installer->getTable('catalog_product_option_value_text')}` (\n          `option_value_id` int(10) unsigned NOT NULL,\n          `language_id` smallint(5) unsigned NOT NULL,\n          `name` varchar(128) default NULL,\n          PRIMARY KEY  USING BTREE (`option_value_id`,`language_id`),\n          CONSTRAINT `FK_PRODUCT_OPTION_VALUE_ID` FOREIGN KEY (`option_value_id`)\n            REFERENCES `{$installer->getTable('catalog_product_option_value')}` (`id`)\n              ON DELETE CASCADE,\n          CONSTRAINT `FK_PRODUCT_OPTION_VALUE_LANGUAGE` FOREIGN KEY (`language_id`)\n            REFERENCES `{$installer->getTable('locale_language')}` (`id`)\n              ON DELETE CASCADE\n        ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('catalog_product_option_valueset')}`;\n        CREATE TABLE  `{$installer->getTable('catalog_product_option_valueset')}` (\n          `id` smallint(5) unsigned NOT NULL auto_increment,\n          `name` varchar(128) NOT NULL,\n          PRIMARY KEY  (`id`)\n        ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('catalog_product_stock')}`;\n        CREATE TABLE  `{$installer->getTable('catalog_product_stock')}` (\n          `product_id` int(10) unsigned NOT NULL,\n          `in_stock` int(1) NOT NULL default '1',\n          `manage` int(1) NOT NULL default '1',\n          `min_qty` int(8) NOT NULL default '0',\n          `min_qty_allowed` int(8) NOT NULL default '1',\n          `max_qty_allowed` int(8) NOT NULL default '0',\n          `decimal` int(1) NOT NULL default '0',\n          `notify_qty` int(8) NOT NULL default '0',\n          `backorder` int(8) NOT NULL default '0',\n          PRIMARY KEY  (`product_id`),\n          CONSTRAINT `FK_product_stock_id` FOREIGN KEY (`product_id`) REFERENCES `{$installer->getTable('catalog_product')}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('catalog_product_variation')}`;\n        CREATE TABLE  `{$installer->getTable('catalog_product_variation')}` (\n          `id` int(10) unsigned NOT NULL auto_increment,\n          `product_id` int(10) unsigned default NULL,\n          `sku` varchar(255) NOT NULL,\n          `quantity` decimal(15,4) unsigned NOT NULL default '0.0000',\n          `cost` DECIMAL(15,4) UNSIGNED NOT NULL DEFAULT '0.0000',\n          `price` decimal(15,4) NOT NULL default '0.00',\n          `price_type` enum('to','by','percent') NOT NULL default 'by',\n          `weight` decimal(10,2) NOT NULL default '0.00',\n          `weight_type` enum('to','by','percent') NOT NULL default 'by',\n          PRIMARY KEY  (`id`),\n          KEY `FK_PRODUCT_VARIATION_PRODUCT_ID` (`product_id`),\n          CONSTRAINT `FK_PRODUCT_VARIATION_PRODUCT_ID` FOREIGN KEY (`product_id`) REFERENCES `{$installer->getTable('catalog_product')}` (`id`) ON DELETE CASCADE\n        ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED;\n\n        INSERT INTO `{$installer->getTable('catalog_product_variation')}` (`id`, `product_id`, `price`, `sku`, `quantity`, `price_type`, `weight`, `weight_type`) VALUES (0, NULL, 0.0000, '', 0.0000, 'by', 0.00, 'by');\n\n        ");
     $languages = Axis_Collect_Language::collect();
     $mCategoryDescription = Axis::model('catalog/category_description');
     foreach ($languages as $langId => $langName) {
         $mCategoryDescription->createRow(array('category_id' => 1, 'language_id' => $langId, 'name' => 'Main Store', 'description' => 'Root Category'))->save();
     }
     Axis::single('core/config_field')->add('catalog', 'Catalog', null, null, array('translation_module' => 'Axis_Catalog'))->add('catalog/main/route', 'Catalog/General/Catalog route', 'store', 'string', 'Catalog url (example.com/<b>route</b>/product)')->add('catalog/listing/type', 'Catalog/Product Listing/Type', 'grid', 'select', 'Default listing type', array('config_options' => 'grid,list'))->add('catalog/listing/perPage', 'Show per page', '6,9,18,32')->add('catalog/listing/perPageDefault', 'Default product count per page', 9)->add('catalog/listing/sortBy', 'Sort By', 'Name,Price')->add('catalog/product/hurldelimiter', 'Catalog/Product View/Hurl world delimiter', '-')->add('catalog/product/seodelimiter', 'Hurl world delimiter', '_')->add('catalog/product/seodesclength', 'SEO Description Length (45 -150 chars)', 100)->add('catalog/lightzoom/zoomStageWidth', 'Catalog/Lightzoom/Zoomer width', 250)->add('catalog/lightzoom/zoomStageHeight', 'Zoomer height', 250)->add('catalog/lightzoom/zoomStagePosition', 'Zoomer position', 'right', 'select', '', array('config_options' => 'left,right'))->add('catalog/lightzoom/zoomStageOffsetX', 'Zoomer offset-x', 10)->add('catalog/lightzoom/zoomStageOffsetY', 'Zoomer offset-y', 0)->add('catalog/lightzoom/zoomLensOpacity', 'Lens opacity', 0.7)->add('catalog/lightzoom/zoomCursor', 'Lens cursor', 'crosshair', 'select', '', array('config_options' => 'none,default,crosshair,pointer'))->add('catalog/lightzoom/zoomOnTrigger', 'Zoom on trigger', 'mouseenter', 'select', 'Select none, if you wish to disable this event', array('config_options' => 'none,click,mouseenter'))->add('catalog/lightzoom/zoomOffTrigger', 'Zoom off trigger', 'mouseleave', 'select', 'Select none, if you wish to disable this event', array('config_options' => 'none,click,mouseleave'))->add('catalog/lightzoom/lightboxTrigger', 'Lightbox trigger', 'click', 'select', 'Select none, if you wish to disable this event', array('config_options' => 'none,click,dblclick'))->add('catalog/lightzoom/lightboxResizeSpeed', 'Lightbox resize speed', 800, 'string', 'Animation speed, ms')->add('catalog/lightzoom/lightboxFadeSpeed', 'Lightbox fade speed', 300, 'string', 'Animation speed, ms')->add('catalog/lightzoom/lightboxMaskOpacity', 'Mask opacity', 0.8)->add('catalog/lightzoom/switchImageTrigger', 'Switch image trigger', 'click', 'select', 'Select none, if you wish to disable this event', array('config_options' => 'none,click,mouseenter,dblclick'))->add('image', 'Images', null, null, array('translation_module' => 'Axis_Catalog'))->add('image/main/cachePath', 'Images/General/Cache path', '/media/cache', 'string', 'Image cache path, relative to AXIS_ROOT')->add('image/product/cache', 'Images/Product Images/Cache', 1, 'bool', 'Enable image cache')->add('image/product/widthLarge', 'Large width', 0)->add('image/product/heightLarge', 'Large height', 0)->add('image/product/widthMedium', 'Product Info width', 250)->add('image/product/heightMedium', 'Product Info height', 250)->add('image/product/widthSmall', 'Small width', 150)->add('image/product/heightSmall', 'Small height', 150)->add('image/product/widthThumbnail', 'Thumbnail image width', 40)->add('image/product/heightThumbnail', 'Thumbnail image height', 40)->add('image/watermark/enabled', 'Images/Watermark/Enabled', 0, 'bool')->add('image/watermark/image', 'Image path', 'catalog/watermark.png', 'string', 'Path relative to the skin images folder: catalog/watermark.png')->add('image/watermark/position', 'Watermark Position', 'bottom_right', 'select', array('config_options' => 'stretch,top_left,top_center,top_right,middle_left,middle_center,middle_right,bottom_left,bottom_center,bottom_right'))->add('image/watermark/opacity', 'Opacity', 50, 'string', 'Values [0 - 100]')->add('image/watermark/repeat', 'Repeat', 0, 'bool');
     Axis::single('core/page')->add('catalog/*/*')->add('catalog/index/*')->add('catalog/index/product')->add('catalog/index/view')->add('catalog/product-compare/*')->add('catalog/product-compare/index');
 }
示例#6
0
 public function up()
 {
     $installer = Axis::single('install/installer');
     $installer->run("\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('sales_order')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('sales_order')}` (\n            `id` int(10) unsigned NOT NULL auto_increment,\n            `number` varchar(32) NOT NULL,\n            `customer_id` int(10) unsigned default '0',\n            `customer_email` varchar(96) default NULL,\n            `delivery_firstname` varchar(128) NOT NULL,\n            `delivery_lastname` varchar(128) NOT NULL,\n            `delivery_phone` VARCHAR(64) NOT NULL,\n            `delivery_fax` VARCHAR(64) DEFAULT NULL,\n            `delivery_company` varchar(128) default NULL,\n            `delivery_street_address` varchar(128) default NULL,\n            `delivery_suburb` varchar(128) default NULL,\n            `delivery_city` varchar(64) default NULL,\n            `delivery_postcode` varchar(20) default NULL,\n            `delivery_state` varchar(64) default NULL,\n            `delivery_country` varchar(64) default NULL,\n            `delivery_address_format_id` int(5) default '0',\n            `billing_firstname` varchar(128) NOT NULL,\n            `billing_lastname` varchar(128) NOT NULL,\n            `billing_phone` VARCHAR(64) NOT NULL,\n            `billing_fax` VARCHAR(64) DEFAULT NULL,\n            `billing_company` varchar(128) default NULL,\n            `billing_street_address` varchar(64) default NULL,\n            `billing_suburb` varchar(128) default NULL,\n            `billing_city` varchar(64) default NULL,\n            `billing_postcode` varchar(20) default NULL,\n            `billing_state` varchar(64) default NULL,\n            `billing_country` varchar(64) default NULL,\n            `billing_address_format_id` int(5) default '0',\n            `payment_method` varchar(128) NOT NULL default '',\n            `payment_method_code` varchar(32) default NULL,\n            `shipping_method` varchar(128) default NULL,\n            `shipping_method_code` varchar(32) default NULL,\n            `coupon_code` varchar(32) default NULL,\n            `date_modified_on` datetime default NULL,\n            `date_purchased_on` datetime NOT NULL,\n            `date_finished_on` datetime default NULL,\n            `order_status_id` mediumint(8) unsigned default NULL,\n            `currency` char(3) NOT NULL,\n            `currency_rate` decimal(17,10) UNSIGNED NOT NULL DEFAULT '1.0000',\n            `order_total` decimal(14,2) NOT NULL,\n            `txn_id` int(11) NOT NULL default '0',\n            `ip_address` varchar(96) default NULL,\n            `site_id` smallint(5) unsigned NOT NULL,\n            PRIMARY KEY  (`id`),\n            KEY `INDEX_SALES_ORDER` USING BTREE(`order_status_id`,`id`,`customer_id`),\n            KEY `INDEX_SALES_ORDER_DATE` USING BTREE (`date_purchased_on`)\n        ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('sales_order_creditcard')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('sales_order_creditcard')}` (\n          `order_id` int(10) unsigned NOT NULL,\n          `cc_type` varchar(64) NOT NULL,\n          `cc_owner` varchar(64) DEFAULT NULL,\n          `cc_number` varchar(64) NOT NULL,\n          `cc_expires_year` varchar(20) NOT NULL,\n          `cc_expires_month` varchar(20) NOT NULL,\n          `cc_issue_year` varchar(20) DEFAULT NULL,\n          `cc_issue_month` varchar(20) DEFAULT NULL,\n          `cc_cvv` varchar(20) DEFAULT NULL,\n          PRIMARY KEY  USING BTREE (`order_id`),\n          CONSTRAINT `FK_SALES_ORDER_CREDITCARD_ORDER` FOREIGN KEY (`order_id`) REFERENCES `{$installer->getTable('sales_order')}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('sales_order_product')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('sales_order_product')}` (\n            `id` int(11) NOT NULL auto_increment,\n            `order_id` int(10) unsigned NOT NULL,\n            `product_id` int(10) unsigned DEFAULT NULL,\n            `variation_id` int(11) DEFAULT NULL,\n            `sku` varchar(128) NOT NULL,\n            `name` varchar(128) NOT NULL,\n            `price` decimal(15,4) NOT NULL,\n            `final_price` decimal(15,4) NOT NULL,\n            `final_weight` decimal(10,4) NOT NULL DEFAULT '0.0000',\n            `tax` decimal(7,4) NOT NULL DEFAULT '0.0000',\n            `quantity` decimal(15,4) NOT NULL,\n            `backorder` int(1) NOT NULL DEFAULT '0',\n            PRIMARY KEY  USING BTREE (`id`),\n            KEY `INDEX_SALES_ORDER_PRODUCT` (`order_id`),\n            CONSTRAINT `FK_SALES_ORDER_PRODUCT` FOREIGN KEY (`order_id`) REFERENCES `{$installer->getTable('sales_order')}` (`id`) ON DELETE CASCADE\n        ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=1 ;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('sales_order_product_attribute')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('sales_order_product_attribute')}` (\n            `id` int(11) NOT NULL auto_increment,\n            `order_product_id` int(11) NOT NULL,\n            `product_option` varchar(128) NOT NULL,\n            `product_option_value` varchar(128) NOT NULL,\n            PRIMARY KEY  USING BTREE (`id`),\n            KEY `FK_SALES_ORDER_PRODUCT_ATTRIBUTE` (`order_product_id`),\n            CONSTRAINT `FK_SALES_ORDER_PRODUCT_ATTRIBUTE` FOREIGN KEY (`order_product_id`) REFERENCES `{$installer->getTable('sales_order_product')}` (`id`) ON DELETE CASCADE\n        ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('sales_order_status')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('sales_order_status')}` (\n            `id` smallint(5) NOT NULL auto_increment,\n            `name` char(32) NOT NULL,\n            `system` tinyint(1) NOT NULL,\n            PRIMARY KEY  (`id`)\n        ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=10;\n\n        INSERT INTO `{$installer->getTable('sales_order_status')}` (`id`, `name`, `system`) VALUES\n        (0, 'new', 1),\n        (1, 'pending', 1),\n        (2, 'processing', 1),\n        (3, 'ship', 1),\n        (4, 'delivered', 1),\n        (5, 'complete', 1),\n        (6, 'hold', 1),\n        (7, 'cancel', 1),\n        (8, 'refund', 1),\n        (9, 'failed', 1);\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('sales_order_status_relation')}`;\n        CREATE TABLE  `{$installer->getTable('sales_order_status_relation')}` (\n          `from_status` smallint(5) NOT NULL,\n          `to_status` smallint(5) NOT NULL,\n          PRIMARY KEY  (`from_status`,`to_status`),\n          KEY `INDEX_SALES_ORDER_STATUS_RELATION_FROM` (`from_status`),\n          KEY `INDEX_SALES_ORDER_STATUS_RELATION_TO` (`to_status`),\n          CONSTRAINT `FK_SALES_ORDER_STATUS_RELATION_TO` FOREIGN KEY (`to_status`) REFERENCES `{$installer->getTable('sales_order_status')}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,\n          CONSTRAINT `FK_SALES_ORDER_STATUS_RELATION_FROM` FOREIGN KEY (`from_status`) REFERENCES `{$installer->getTable('sales_order_status')}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\n        INSERT INTO `{$installer->getTable('sales_order_status_relation')}` (`from_status`, `to_status`) VALUES\n        (0, 1), (0, 9), (1, 2),\n        (1, 6), (1, 7), (1, 9),\n        (2, 3), (2, 6), (2, 7),\n        (2, 8), (2, 9), (3, 4),\n        (3, 8), (3, 9), (4, 5),\n        (4, 8), (6, 1), (6, 2),\n        (6, 7)\n        ;\n\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('sales_order_status_history')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('sales_order_status_history')}` (\n            `id` int(10) unsigned NOT NULL auto_increment,\n            `order_id` int(10) unsigned NOT NULL,\n            `order_status_id` smallint(5) unsigned NOT NULL,\n            `created_on` datetime NOT NULL,\n            `notified` tinyint(1) unsigned NOT NULL,\n            `comments` text,\n            PRIMARY KEY  (`id`),\n            KEY `INDEX_SALES_ORDER_STATUS_HISTORY` (`order_id`,`order_status_id`),\n            CONSTRAINT `FK_SALES_ORDER_STATUS_HISTORY_ORDER` FOREIGN KEY (`order_id`) REFERENCES `{$installer->getTable('sales_order')}` (`id`) ON DELETE CASCADE\n        ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('sales_order_total')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('sales_order_total')}` (\n            `id` int(10) unsigned NOT NULL auto_increment,\n            `order_id` int(10) unsigned NOT NULL,\n            `code` VARCHAR(32)  NOT NULL,\n            `title` varchar(128) NOT NULL,\n            `value` decimal(15,4) NOT NULL,\n            PRIMARY KEY  (`id`),\n            KEY `INDEX_SALES_ORDER_TOTAL` (`order_id`),\n            CONSTRAINT `FK_SALES_ORDER_TOTAL_ORDER` FOREIGN KEY (`order_id`) REFERENCES `{$installer->getTable('sales_order')}` (`id`) ON DELETE CASCADE\n        ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('sales_order_status_text')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('sales_order_status_text')}` (\n            `status_id` smallint(5) NOT NULL,\n            `language_id` smallint(5) unsigned NOT NULL,\n            `status_name` varchar(128) NOT NULL,\n            PRIMARY KEY  (`status_id`,`language_id`),\n            KEY `INDEX_SALES_ORDER_STATUS_TEXT_LANGUAGE` (`language_id`),\n            CONSTRAINT `FK_SALES_ORDER_STATUS_TEXT_STATUS` FOREIGN KEY (`status_id`) REFERENCES `{$installer->getTable('sales_order_status')}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,\n            CONSTRAINT `FK_SALES_ORDER_STATUS_TEXT_LANGUAGE` FOREIGN KEY (`language_id`) REFERENCES `{$installer->getTable('locale_language')}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n        ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;\n\n        ");
     $statusText = array('New', 'Pending payment', 'Proccesing', 'Shipping', 'Delivered', 'Completed', 'Holded', 'Canceled', 'Refund', 'Failed');
     $mStatusText = Axis::model('sales/order_status_text');
     $languages = Axis_Collect_Language::collect();
     foreach (Axis::model('sales/order_status')->fetchAll() as $status) {
         foreach ($languages as $langId => $langName) {
             $mStatusText->createRow(array('status_id' => $status->id, 'language_id' => $langId, 'status_name' => $statusText[$status->id]))->save();
         }
     }
     Axis::single('core/config_field')->add('sales', 'Sales', null, null, array('translation_module' => 'Axis_Sales'))->add('sales/order/defaultStatusId', 'Sales/Order/Default Order Status', 1, 'select', 'Default Order Status', array('config_options' => '{"1":"pending", "2":"processing"}'))->add('sales/order/order_number_pattern_prefix', 'Prefix for Custom Order Number', '')->add('sales/order/order_number_pattern', 'Pattern for Custom Order Number', '100000000', 'Please notice: Changing code pattern for existing orders in database can cause problems.')->add('sales/order/email', 'Order notifications reciever', 'email1', 'select', 'All notifications about new orders will be sended to this email', array('model' => 'MailBoxes'));
 }
示例#7
0
 public function saveAction()
 {
     $_row = $this->_getAllParams();
     $row = Axis::model('cms/block')->save($_row);
     //save cms block content
     $languageIds = array_keys(Axis_Collect_Language::collect());
     $modelContent = Axis::model('cms/block_content');
     foreach ($languageIds as $languageId) {
         if (!isset($_row['content'][$languageId])) {
             continue;
         }
         $modelContent->getRow($row->id, $languageId)->setFromArray($_row['content'][$languageId])->save();
     }
     Axis::message()->addSuccess(Axis::translate('core')->__('Data was saved successfully'));
     return $this->_helper->json->setData(array('id' => $row->id))->sendSuccess();
 }
 public function loadAction()
 {
     $rowset = Axis::model('catalog/product_option')->select(array('cpot.language_id', '*'))->joinLeft('catalog_product_option_text', 'cpot.option_id = cpo.id', '*')->where('cpo.id = ?', $this->_getParam('id', 0))->fetchAssoc();
     if (!$rowset) {
         Axis::message()->addError(Axis::translate('catalog')->__('Option %s not found', $this->_getParam('id', 0)));
         return $this->_helper->json->sendFailure();
     }
     $data = current($rowset);
     foreach (array_keys(Axis_Collect_Language::collect()) as $languageId) {
         if (!isset($rowset[$languageId]['name'])) {
             $rowset[$languageId]['name'] = '';
             $rowset[$languageId]['description'] = '';
         }
         $data['text']['lang_' . $languageId] = array('name' => $rowset[$languageId]['name'], 'description' => $rowset[$languageId]['description']);
     }
     $this->_helper->json->setData($data)->sendSuccess();
 }
 public function loadAction()
 {
     $rowset = Axis::model('account/customer_fieldGroup')->select(array('acfl.language_id', '*'))->joinLeft('account_customer_fieldgroup_label', 'acfl.customer_field_group_id = acf.id', '*')->where('acf.id = ?', $this->_getParam('id', 0))->fetchAssoc();
     if (!$rowset) {
         Axis::message()->addError(Axis::translate('account')->__('Group %s not found', $this->_getParam('id', 0)));
         return $this->_helper->json->sendFailure();
     }
     $data['group'] = current($rowset);
     unset($data['group']['customer_field_group_id']);
     unset($data['group']['group_label']);
     unset($data['group']['language_id']);
     foreach (array_keys(Axis_Collect_Language::collect()) as $languageId) {
         $label = isset($rowset[$languageId]['group_label']) ? $rowset[$languageId]['group_label'] : '';
         $data['label']['lang_' . $languageId] = $label;
     }
     $this->_helper->json->setData($data)->sendSuccess();
 }
 public function batchSaveAction()
 {
     $dataset = Zend_Json::decode($this->_getParam('data'));
     $model = Axis::model('account/customer_valueSet_value');
     $modelLabel = Axis::model('account/customer_valueSet_value_label');
     $languageIds = array_keys(Axis_Collect_Language::collect());
     foreach ($dataset as $data) {
         $row = $model->getRow($data);
         $row->save();
         foreach ($languageIds as $languageId) {
             $rowLabel = $modelLabel->getRow($row->id, $languageId);
             $rowLabel->label = $data['label' . $languageId];
             $rowLabel->save();
         }
     }
     Axis::message()->addSuccess(Axis::translate('core')->__('Data was saved successfully'));
     return $this->_helper->json->sendSuccess();
 }
 public function batchSaveAction()
 {
     $_rowset = Zend_Json::decode($this->_getParam('data'));
     $model = Axis::model('catalog/product_option_value');
     $modelLabel = Axis::single('catalog/product_option_value_text');
     $languageIds = array_keys(Axis_Collect_Language::collect());
     foreach ($_rowset as $_row) {
         $row = $model->getRow($_row);
         $row->save();
         foreach ($languageIds as $languageId) {
             $rowLabel = $modelLabel->getRow($row->id, $languageId);
             $rowLabel->name = $_row['name_' . $languageId];
             $rowLabel->save();
         }
     }
     Axis::message()->addSuccess(Axis::translate('core')->__('Data was saved successfully'));
     return $this->_helper->json->sendSuccess();
 }
示例#12
0
 public function saveAction()
 {
     $_row = $this->_getAllParams();
     $model = Axis::model('poll/question');
     $modelLabel = Axis::model('poll/question_description');
     $modelSite = Axis::model('poll/question_site');
     $modelAnswer = Axis::single('poll/answer');
     $languageIds = array_keys(Axis_Collect_Language::collect());
     $row = $model->save($_row);
     //save description
     foreach ($languageIds as $languageId) {
         $rowDescription = $modelLabel->getRow($row->id, $languageId);
         $rowDescription->question = $_row['description'][$languageId];
         $rowDescription->save();
     }
     //save site relation
     $modelSite->delete($this->db->quoteInto('question_id = ?', $row->id));
     $sites = array_filter(explode(',', $_row['sites']));
     foreach ($sites as $siteId) {
         $modelSite->createRow(array('question_id' => $row->id, 'site_id' => (int) $siteId))->save();
     }
     //save answers
     $answers = $this->_getParam('answer', array());
     if (2 > count($answers)) {
         Axis::message()->addNotice(Axis::translate('poll')->__('Define at least two answers.'));
     }
     $modelAnswer->delete($this->db->quoteInto('question_id = ?', $row->id));
     foreach ($answers as $answerId => $_dataset) {
         foreach ($_dataset as $languageId => $answer) {
             $_row = array('language_id' => $languageId, 'question_id' => $row->id, 'answer' => $answer);
             if (0 < $answerId) {
                 $_row['id'] = $answerId;
             }
             $rowAnswer = $modelAnswer->createRow($_row);
             $rowAnswer->save();
             $answerId = $rowAnswer->id;
         }
     }
     return $this->_helper->json->sendSuccess();
 }
示例#13
0
 public function up()
 {
     $installer = Axis::single('install/installer');
     $installer->run("\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('cms_block')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('cms_block')}` (\n          `id` int(10) unsigned NOT NULL auto_increment,\n          `content` text,\n          `is_active` tinyint(1) default NULL,\n          `name` varchar(128) default NULL,\n          PRIMARY KEY  (`id`)\n        ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('cms_category')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('cms_category')}` (\n          `id` int(10) unsigned NOT NULL auto_increment,\n          `is_active` tinyint(3) unsigned default '1',\n          `parent_id` int(10) unsigned default NULL,\n          `site_id` smallint(5) unsigned default NULL,\n          `name` varchar(128) NOT NULL,\n          PRIMARY KEY  USING BTREE (`id`),\n          KEY `FK_CMS_CATEGORY_CMS_CATEGORY` (`parent_id`),\n          KEY `FK_CMS_CATEGORY_SITE_ID` (`site_id`),\n          CONSTRAINT `FK_CMS_CATEGORY_SITE_ID` FOREIGN KEY (`site_id`) REFERENCES `{$installer->getTable('core_site')}` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION,\n          CONSTRAINT `FK_CMS_CATEGORY_CMS_CATEGORY` FOREIGN KEY (`parent_id`) REFERENCES `{$installer->getTable('cms_category')}` (`id`) ON DELETE CASCADE\n        ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('cms_category_content')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('cms_category_content')}` (\n          `cms_category_id` int(10) unsigned NOT NULL,\n          `language_id` smallint(5) unsigned NOT NULL,\n          `title` varchar(45) default NULL,\n          `description` text,\n          `link` varchar(128) default NULL,\n          `meta_keyword` text,\n          `meta_description` text,\n          `meta_title` varchar(128) default NULL,\n          PRIMARY KEY  USING BTREE (`language_id`,`cms_category_id`),\n          KEY `FK_CMS_CATEGORY_TITLE_CMS_CATEGORY` (`cms_category_id`),\n          CONSTRAINT `FK_CMS_CATEGORY_CONTENT_LANGUAGE` FOREIGN KEY (`language_id`) REFERENCES `{$installer->getTable('locale_language')}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,\n          CONSTRAINT `FK_CMS_CATEGORY_TITLE_CMS_CATEGORY` FOREIGN KEY (`cms_category_id`) REFERENCES `{$installer->getTable('cms_category')}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('cms_page')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('cms_page')}` (\n          `id` int(10) unsigned NOT NULL auto_increment,\n          `is_active` tinyint(4) default NULL,\n          `layout` varchar(45) default NULL,\n          `comment` tinyint(4) default NULL,\n          `access` tinyint(4) default NULL,\n          `name` varchar(128) default NULL,\n          `show_in_box` tinyint(1) unsigned NOT NULL default '0',\n          PRIMARY KEY  (`id`)\n        ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('cms_page_content')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('cms_page_content')}` (\n          `cms_page_id` int(10) unsigned NOT NULL,\n          `language_id` smallint(5) unsigned NOT NULL,\n          `link` varchar(128) default NULL,\n          `title` varchar(128) default NULL,\n          `content` text,\n          `meta_keyword` text,\n          `meta_description` text,\n          `meta_title` varchar(128) default NULL,\n          PRIMARY KEY  USING BTREE (`language_id`,`cms_page_id`),\n          KEY `FK_CMS_PAGE_CONTENT_CMS_PAGE` (`cms_page_id`),\n          CONSTRAINT `FK_CMS_PAGE_CONTENT_LANGUAGE` FOREIGN KEY (`language_id`) REFERENCES `{$installer->getTable('locale_language')}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,\n          CONSTRAINT `FK_CMS_PAGE_CONTENT_CMS_PAGE` FOREIGN KEY (`cms_page_id`) REFERENCES `{$installer->getTable('cms_page')}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('cms_page_category')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('cms_page_category')}` (\n          `cms_category_id` int(10) unsigned NOT NULL,\n          `cms_page_id` int(10) unsigned NOT NULL,\n          PRIMARY KEY  (`cms_category_id`,`cms_page_id`),\n          KEY `FK_CMS_PAGE_TO_CATEGORY_CMS_CATEGORY` (`cms_category_id`),\n          KEY `FK_CMS_PAGE_TO_CATEGORY_CMS_PAGE` (`cms_page_id`),\n          CONSTRAINT `FK_CMS_PAGE_TO_CATEGORY_CMS_CATEGORY` FOREIGN KEY (`cms_category_id`) REFERENCES `{$installer->getTable('cms_category')}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,\n          CONSTRAINT `FK_CMS_PAGE_TO_CATEGORY_CMS_PAGE` FOREIGN KEY (`cms_page_id`) REFERENCES `{$installer->getTable('cms_page')}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\n        -- DROP TABLE IF EXISTS `{$installer->getTable('cms_page_comment')}`;\n        CREATE TABLE IF NOT EXISTS `{$installer->getTable('cms_page_comment')}` (\n          `id` int(10) unsigned NOT NULL auto_increment,\n          `cms_page_id` int(10) unsigned NOT NULL,\n          `author` varchar(128) default NULL,\n          `created_on` datetime default NULL,\n          `modified_on` datetime default NULL,\n          `content` text,\n          `status` tinyint(3) unsigned default NULL,\n          `email` varchar(128) default NULL,\n          PRIMARY KEY  USING BTREE (`id`),\n          KEY `FK_CMS_PAGE_COMMENT_CMS_PAGE` (`cms_page_id`),\n          CONSTRAINT `FK_CMS_PAGE_COMMENT_CMS_PAGE` FOREIGN KEY (`cms_page_id`) REFERENCES `{$installer->getTable('cms_page')}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n        ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;\n\n        ");
     //blocks
     $mBlock = Axis::model('cms/block');
     $mBlock->insert(array('content' => '<p class="legality">&copy; 2008-2011 <a href="http://axiscommerce.com">Axis</a> Demo Store. All rights reserved.</p>', 'is_active' => 1, 'name' => 'copyright'));
     // pages
     $mPage = Axis::model('cms/page');
     $privacyPageId = $mPage->insert(array('is_active' => 1, 'layout' => 'default_2columns-left', 'comment' => 1, 'name' => 'privacy-policy', 'show_in_box' => 1));
     $shippingPageId = $mPage->insert(array('is_active' => 1, 'layout' => 'default_1column', 'comment' => 1, 'name' => 'shipping-and-returns', 'show_in_box' => 1));
     $termsPageId = $mPage->insert(array('is_active' => 1, 'layout' => 'default_2columns-right', 'comment' => 1, 'name' => 'terms-of-use', 'show_in_box' => 1));
     $historyPageId = $mPage->insert(array('is_active' => 1, 'layout' => 'default_2columns-left', 'comment' => 0, 'name' => 'company_history', 'show_in_box' => 0));
     $careersPageId = $mPage->insert(array('is_active' => 1, 'layout' => 'default_2columns-left', 'comment' => 0, 'name' => 'careers', 'show_in_box' => 0));
     // categories
     $mCategory = Axis::model('cms/category');
     $generalCatId = $mCategory->insert(array('is_active' => 1, 'parent_id' => new Zend_Db_Expr('NULL'), 'site_id' => Axis::getSiteId(), 'name' => 'General'));
     $aboutCatId = $mCategory->insert(array('is_active' => 1, 'parent_id' => new Zend_Db_Expr('NULL'), 'site_id' => Axis::getSiteId(), 'name' => 'about-us'));
     // page to category relations
     $mPageCategory = Axis::model('cms/page_category');
     $mPageCategory->insert(array('cms_category_id' => $generalCatId, 'cms_page_id' => $privacyPageId));
     $mPageCategory->insert(array('cms_category_id' => $generalCatId, 'cms_page_id' => $shippingPageId));
     $mPageCategory->insert(array('cms_category_id' => $generalCatId, 'cms_page_id' => $termsPageId));
     $mPageCategory->insert(array('cms_category_id' => $generalCatId, 'cms_page_id' => $historyPageId));
     $mPageCategory->insert(array('cms_category_id' => $aboutCatId, 'cms_page_id' => $careersPageId));
     // content
     $mCategoryContent = Axis::model('cms/category_content');
     $mPageContent = Axis::model('cms/page_content');
     foreach (Axis_Collect_Language::collect() as $langId => $langName) {
         $mPageContent->insert(array('cms_page_id' => $privacyPageId, 'language_id' => $langId, 'link' => 'privacy', 'title' => 'Privacy policy', 'content' => "<div class=\"col2-set\">\n    <div class=\"col-1\">asd, consectetuer adipiscing elit. Sed dolor urna, dapibus ac, convallis eget, ornare a, nisl. Quisque vestibulum congue est. Vivamus ante. Nullam neque tellus, aliquet sed, placerat eget, sagittis hendrerit, leo. Fusce varius pulvinar pede. Fusce at lectus. Nunc ac purus. Aenean rhoncus lacinia nisl. Sed eros sapien, pretium ut, condimentum at, lobortis porta, leo. Aenean ut nibh non metus porttitor sodales. Suspendisse nisl. Phasellus condimentum egestas magna.\nFusce porta porttitor enim. Aenean tempor est nec massa. Phasellus in sapien. Vestibulum urna odio, imperdiet eu, faucibus eu, pretium a, arcu. Morbi mi urna, commodo in, eleifend id, interdum sed, lorem. Pellentesque ullamcorper purus in sapien. Integer faucibus quam a leo. Vivamus posuere porta ipsum. In purus. Proin commodo. Cras eget mi in lacus dignissim volutpat. Fusce orci. Donec eget erat. Mauris sapien libero, sodales non, consequat ut, varius id, lorem.\nMorbi adipiscing. Aenean eu mi. Praesent erat lectus, fringilla non, condimentum ut, semper vitae, lectus. Ut vulputate. Vivamus purus velit, semper nec, dignissim vel, faucibus nec, felis. Cras posuere. Curabitur dignissim convallis lorem. Aenean bibendum auctor justo. Nulla nec diam vel justo rutrum tempor. Suspendisse nec tortor a eros laoreet rutrum. In sapien.\n</div>\n<div class=\"col-2\">\nCras sem sem, condimentum sed, bibendum ac, molestie eget, felis. Integer diam pede, pulvinar quis, eleifend vel, pretium at, nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Quisque id lectus vitae augue imperdiet sodales. Donec dapibus nisl nec arcu. Ut felis turpis, accumsan ac, sagittis a, aliquet vitae, leo. Nullam venenatis, leo quis consectetuer ullamcorper, nisl justo bibendum lorem, sit amet pulvinar quam lorem nec sem. Nunc eleifend, quam sed viverra sollicitudin, dui arcu aliquet nibh, nec tincidunt sem quam non ante. Maecenas et lectus. In tincidunt nisl et velit. Nam venenatis, augue eget congue gravida, mi neque facilisis nunc, sed porta augue erat ac felis\nProin tellus risus, pulvinar ac, pretium eu, faucibus eu, ipsum. Fusce mauris nisl, elementum id, auctor sit amet, porta ac, nibh. Mauris vulputate egestas ipsum.\n\nNunc eget nisi. Phasellus id elit nec elit sollicitudin imperdiet. Cras a justo. Praesent orci. Vivamus sagittis libero ut nulla. Integer dapibus lectus quis lorem. Maecenas consectetuer urna vitae lectus volutpat malesuada. Duis risus. Sed vulputate nulla ac nibh. Pellentesque tincidunt pharetra turpis. Cras libero velit, tristique ut, vehicula a, tempor in, nibh. Praesent ac magna at risus lobortis dictum. Curabitur ultrices neque vehicula neque.</div>\n</div>", 'meta_description' => 'description of privacy policy page', 'meta_keyword' => 'privacy', 'meta_title' => 'Privacy policy'));
         $mPageContent->insert(array('cms_page_id' => $shippingPageId, 'language_id' => $langId, 'link' => 'shipping', 'title' => 'Shipping and returns', 'content' => "Praesent vestibulum iaculis eros. Donec porta odio in tortor. Proin nulla nunc, ornare eu, rhoncus non, laoreet quis, sem. Praesent dictum, sapien a fermentum adipiscing, erat mauris dignissim nisi, <span style=\"background-color: rgb(153, 204, 0);\">nec placerat lorem quam id est.<br/><br/><span style=\"background-color: rgb(192, 192, 192);\">Nullam ut libero. Fusce libero magna, iaculis ac, tempus nec, posuere id, felis. Nulla suscipit augue in sapien. Nullam congue convallis dolor. Cras gravida felis vel nulla. Etiam pulvinar sem in nisi ornare mattis. Proin tempus.</span></span><span style=\"background-color: rgb(192, 192, 192);\"> </span><br/><br/>Phasellus tincidunt mattis nunc. Fusce lorem. Sed consequat. Nulla ac purus. Donec vel nibh. Aliquam in sapien. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In eget quam.", 'meta_description' => '', 'meta_keyword' => '', 'meta_title' => 'Shipping and Returns'));
         $mPageContent->insert(array('cms_page_id' => $termsPageId, 'language_id' => $langId, 'link' => 'terms-of-use', 'title' => 'Terms of use', 'content' => "{{static_intro}}<br/>\n<p>\nIt is a long established fact that a reader will be distracted by the\nreadable content of a page when looking at its layout. The point of\nusing  is that it has a more-or-less normal distribution of\nletters, as opposed to using \"Content here, content here\", making it\nlook like readable English.</p>&nbsp;{{static_google_banner}}\n<br/>\n<p>\nMany desktop publishing packages and web\npage editors now use Lorem Ipsum as their default model text, and a\nsearch for \"lorem ipsum\" will uncover many web sites still in their\ninfancy. Various versions have evolved over the years, sometimes by\naccident, sometimes on purpose (injected humour and the like).\n</p>\n{{static_name_new}}", 'meta_description' => '', 'meta_keyword' => '', 'meta_title' => 'Terms of Use'));
         $mPageContent->insert(array('cms_page_id' => $historyPageId, 'language_id' => $langId, 'link' => 'company-history', 'title' => 'Company history', 'content' => "<div class=\"col3-set\">\n    <div class=\"col-1\">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed dolor urna, dapibus ac, convallis eget, ornare a, nisl. Quisque vestibulum congue est. Vivamus ante. Nullam neque tellus, aliquet sed, placerat eget, sagittis hendrerit, leo. Fusce varius pulvinar pede. Fusce at lectus. Nunc ac purus. Aenean rhoncus lacinia nisl. Sed eros sapien, pretium ut, condimentum at, lobortis porta, leo. Aenean ut nibh non metus porttitor sodales. Suspendisse nisl. Phasellus condimentum egestas magna.\nFusce porta porttitor enim. Aenean tempor est nec massa. Phasellus in sapien. Vestibulum urna odio, imperdiet eu, faucibus eu, pretium a, arcu. Morbi mi urna, commodo in, eleifend id, interdum sed, lorem. Pellentesque ullamcorper purus in sapien. Integer faucibus quam a leo. Vivamus posuere porta ipsum. In purus. Proin commodo. Cras eget mi in lacus dignissim volutpat. Fusce orci. Donec eget erat. Mauris sapien libero, sodales non, consequat ut, varius id, lorem.\n</div>\n  <div class=\"col-2\">\nMorbi adipiscing. Aenean eu mi. Praesent erat lectus, fringilla non, condimentum ut, semper vitae, lectus. Ut vulputate. Vivamus purus velit, semper nec, dignissim vel, faucibus nec, felis. Cras posuere. Curabitur dignissim convallis lorem. Aenean bibendum auctor justo. Nulla nec diam vel justo rutrum tempor. Suspendisse nec tortor a eros laoreet rutrum. In sapien.\nCras sem sem, condimentum sed, bibendum ac, molestie eget, felis. Integer diam pede, pulvinar quis, eleifend vel, pretium at, nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Quisque id lectus vitae augue imperdiet sodales. Donec dapibus nisl nec arcu. Ut felis turpis, accumsan ac, sagittis a, aliquet vitae, leo. Nullam venenatis, leo quis consectetuer ullamcorper, nisl justo bibendum lorem, sit amet pulvinar quam lorem nec sem. Nunc eleifend, quam sed viverra sollicitudin, dui arcu aliquet nibh, nec tincidunt sem quam non ante. Maecenas et lectus. In tincidunt nisl et velit. Nam venenatis, augue eget congue gravida, mi neque facilisis nunc, sed porta augue erat ac felis. </div>\n<div class=\"col-3\">Proin tellus risus, pulvinar ac, pretium eu, faucibus eu, ipsum. Fusce mauris nisl, elementum id, auctor sit amet, porta ac, nibh. Mauris vulputate egestas ipsum.\n\nNunc eget nisi. Phasellus id elit nec elit sollicitudin imperdiet. Cras a justo. Praesent orci. Vivamus sagittis libero ut nulla. Integer dapibus lectus quis lorem. Maecenas consectetuer urna vitae lectus volutpat malesuada. Duis risus. Sed vulputate nulla ac nibh. Pellentesque tincidunt pharetra turpis. Cras libero velit, tristique ut, vehicula a, tempor in, nibh. Praesent ac magna at risus lobortis dictum. Curabitur ultrices neque vehicula neque.</div>\n</div>", 'meta_description' => '', 'meta_keyword' => 'Company, about, history', 'meta_title' => 'Company history'));
         $mPageContent->insert(array('cms_page_id' => $careersPageId, 'language_id' => $langId, 'link' => 'careers', 'title' => 'Careers at our store', 'content' => "<div class=\"col2-set\" style=\"margin-bottom: 7px;\">\n <div class=\"col-1\">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed dolor urna, dapibus ac, convallis eget, ornare a, nisl. Quisque vestibulum congue est. Vivamus ante. Nullam neque tellus, aliquet sed, placerat eget, sagittis hendrerit, leo. Fusce varius pulvinar pede. Fusce at lectus. Nunc ac purus. Aenean rhoncus lacinia nisl. Sed eros sapien, pretium ut, condimentum at, lobortis porta, leo. Aenean ut nibh non metus porttitor sodales. Suspendisse nisl. Phasellus condimentum egestas magna. </div>\n <div class=\"col-2\">Fusce porta porttitor enim. Aenean tempor est nec massa. Phasellus in sapien. Vestibulum urna odio, imperdiet eu, faucibus eu, pretium a, arcu. Morbi mi urna, commodo in, eleifend id, interdum sed, lorem. Pellentesque ullamcorper purus in sapien. Integer faucibus quam a leo. Vivamus posuere porta ipsum. In purus. Proin commodo. Cras eget mi in lacus dignissim volutpat. Fusce orci. Donec eget erat. Mauris sapien libero, sodales non, consequat ut, varius id, lorem. </div>\n</div>\n<div>\nCras sem sem, condimentum sed, bibendum ac, molestie eget, felis. Integer diam pede, pulvinar quis, eleifend vel, pretium at, nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Quisque id lectus vitae augue imperdiet sodales. Donec dapibus nisl nec arcu. Ut felis turpis, accumsan ac, sagittis a, aliquet vitae, leo. Nullam venenatis, leo quis consectetuer ullamcorper, nisl justo bibendum lorem, sit amet pulvinar quam lorem nec sem. Nunc eleifend, quam sed viverra sollicitudin, dui arcu aliquet nibh, nec tincidunt sem quam non ante. Maecenas et lectus. In tincidunt nisl et velit. Nam venenatis, augue eget congue gravida, mi neque facilisis nunc, sed porta augue erat ac felis. Proin tellus risus, pulvinar ac, pretium eu, faucibus eu, ipsum. Fusce mauris nisl, elementum id, auctor sit amet, porta ac, nibh. Mauris vulputate egestas ipsum.\n\nNunc eget nisi. Phasellus id elit nec elit sollicitudin imperdiet. Cras a justo. Praesent orci. Vivamus sagittis libero ut nulla. Integer dapibus lectus quis lorem. Maecenas consectetuer urna vitae lectus volutpat malesuada. Duis risus. Sed vulputate nulla ac nibh. Pellentesque tincidunt pharetra turpis. Cras libero velit, tristique ut, vehicula a, tempor in, nibh. Praesent ac magna at risus lobortis dictum. Curabitur ultrices neque vehicula neque. \n</div>", 'meta_description' => '', 'meta_keyword' => '', 'meta_title' => 'Careers at our store'));
         $mCategoryContent->insert(array('cms_category_id' => $generalCatId, 'language_id' => $langId, 'link' => 'general'));
         $mCategoryContent->insert(array('cms_category_id' => $aboutCatId, 'language_id' => $langId, 'link' => 'about-us'));
     }
     Axis::single('core/page')->add('cms/*/*');
 }
示例#14
0
 public function batchSaveAction()
 {
     $count = 0;
     $_rowset = Zend_Json::decode($this->_getParam('data'));
     $model = Axis::model('community/review_rating');
     $modelTitle = Axis::single('community/review_rating_title');
     $languageIds = array_keys(Axis_Collect_Language::collect());
     foreach ($_rowset as $_row) {
         $row = $model->save($_row);
         //save title
         foreach ($languageIds as $languageId) {
             $rowTitle = $modelTitle->getRow($row->id, $languageId);
             $rowTitle->title = empty($_row['title_' . $languageId]) ? $row->name : $_row['title_' . $languageId];
             $rowTitle->save();
         }
         $count++;
     }
     if ($count) {
         Axis::message()->addSuccess(Axis::translate('community')->__("%d rating(s) was saved successfully", $count));
     }
     return $this->_helper->json->sendSuccess();
 }
示例#15
0
 /**
  *
  * @param string $xmlFilePath
  * @return bool
  */
 public function importTemplateFromXmlFile($xmlFilePath)
 {
     function _getConcatPage(array $page)
     {
         return $page['module'] . '/' . $page['controller'] . '/' . $page['action'];
     }
     $template = $this->_parseXml($xmlFilePath);
     $template['id'] = $this->getIdByName($template['name']);
     $templateRow = $this->getRow($template);
     $templateRow->save();
     $template['id'] = $templateRow->id;
     $modelPage = Axis::model('core/page');
     $select = $modelPage->select(array('id', 'page' => "CONCAT(module_name, '/', controller_name, '/', action_name)"))->order(array('module_name', 'controller_name', 'action_name'));
     $existPages = $select->fetchPairs();
     $pages = array();
     $boxes = $template['box'];
     $layouts = $template['layout'];
     $cmsBlocks = $template['cms_block'];
     // import new pages
     foreach ($boxes as $box) {
         foreach ($box['page'] as $page) {
             $pages[] = _getConcatPage($page);
         }
     }
     foreach ($layouts as $_row) {
         $pages[] = _getConcatPage($_row['page']);
     }
     $pages = array_diff(array_unique($pages), $existPages);
     foreach ($pages as $page) {
         $modelPage->add($page);
     }
     $existPages = array_flip($select->fetchPairs());
     //import boxes
     $modelTemplateBox = Axis::model('core/template_box');
     $modelTemplateBoxPage = Axis::model('core/template_box_page');
     foreach ($boxes as $box) {
         $boxId = $modelTemplateBox->insert(array('template_id' => $template['id'], 'block' => $box['block'], 'class' => $box['class'], 'sort_order' => $box['sort_order'], 'config' => empty($box['config']) ? '{}' : $box['config'], 'box_status' => $box['status']));
         $pages = $box['page'];
         foreach ($pages as $page) {
             $modelTemplateBoxPage->insert(array('box_id' => $boxId, 'page_id' => $existPages[_getConcatPage($page)], 'box_show' => $page['show'], 'block' => $page['block'], 'template' => $page['template'], 'tab_container' => $page['tab_container'], 'sort_order' => empty($page['sort_order']) ? new Zend_Db_Expr('NULL') : $page['sort_order']));
         }
     }
     //import layouts
     $modelTemplatePage = Axis::model('core/template_page');
     foreach ($layouts as $_row) {
         $layout = is_null($_row['layout']) ? '' : $_row['layout'];
         $page = _getConcatPage($_row['page']);
         $parentPage = null;
         if (isset($_row['parent_page'])) {
             $parentPage = _getConcatPage($_row['parent_page']);
         }
         $modelTemplatePage->add($layout, $page, $template['id'], $parentPage, $_row['priority']);
     }
     //import cms blocks
     $modelBlock = Axis::model('cms/block');
     $languageIds = array_keys(Axis_Collect_Language::collect());
     $modelContent = Axis::model('cms/block_content');
     foreach ($cmsBlocks as $cmsBlock) {
         $cmsBlockId = $modelBlock->getIdByName($cmsBlock['name']);
         if ($cmsBlockId) {
             Axis::message()->addNotice(Axis::translate('core')->__('Cms block %s already exist', $cmsBlock['name']));
             continue;
         }
         $row = $modelBlock->save($cmsBlock);
         //save cms block content
         $content = array();
         foreach ($cmsBlock['content'] as $rowContent) {
             $content[$rowContent['language_id']] = $rowContent;
         }
         foreach ($languageIds as $languageId) {
             if (!isset($content[$languageId])) {
                 continue;
             }
             $modelContent->getRow($row->id, $languageId)->setFromArray($content[$languageId])->save();
         }
     }
     return true;
 }
示例#16
0
 /**
  *
  * @param Axis_Db_Table_Row $site
  * @return Axis_Db_Table_Row 
  */
 public function addNewRootCategory(Axis_Db_Table_Row $site)
 {
     $modelDescription = Axis::model('catalog/category_description');
     $languageIds = array_keys(Axis_Collect_Language::collect());
     $timestamp = Axis_Date::now()->toSQLString();
     $row = $this->createRow(array('site_id' => $site->id, 'lft' => 1, 'rgt' => 2, 'lvl' => 0, 'created_on' => $timestamp, 'modified_on' => $timestamp, 'status' => 'enabled'));
     $row->save();
     foreach ($languageIds as $languageId) {
         $modelDescription->createRow(array('category_id' => $row->id, 'language_id' => $languageId, 'name' => $site->name, 'description' => 'Root Category'))->save();
     }
     return $row;
 }
示例#17
0
 public function loadAction()
 {
     if ($this->_hasParam('id')) {
         $productId = (int) $this->_getParam('id');
     } else {
         Axis::message()->addError(Axis::translate('catalog')->__('Invalid parameter recieved. ProductId is required'));
         return $this->_helper->json->sendFailure();
     }
     $data = array();
     /**
      * @var Axis_Catalog_Model_Product_Row
      */
     $product = Axis::single('catalog/product')->find($productId)->current();
     if (!$product) {
         Axis::message()->addError(Axis::translate('catalog')->__('Product %s not found', $productId));
         return $this->_helper->json->sendFailure();
     }
     $data['product'] = $product->toArray();
     /* get hurl */
     $data['key_word'] = Axis::single('catalog/hurl')->getProductUrl($product->id);
     /* get description */
     $descriptions = Axis::single('catalog/product_description')->select(array('language_id', '*'))->where('product_id = ? ', $product->id)->fetchAssoc();
     foreach (Axis_Collect_Language::collect() as $languageId => $values) {
         $data['description']['lang_' . $languageId] = array();
         if (!isset($descriptions[$languageId])) {
             continue;
         }
         $data['description']['lang_' . $languageId] = $descriptions[$languageId];
     }
     /* get categories with marker 'belongs_to' */
     $categories = Axis::single('catalog/category')->getNestedTreeData();
     $data['belongs_to'] = array_keys($product->getCategories());
     foreach ($categories as &$category) {
         if (in_array($category['id'], $data['belongs_to'])) {
             $category['belongs_to'] = 1;
         } else {
             $category['belongs_to'] = 0;
         }
     }
     $data['categories'] = $categories;
     /* get special  price */
     $data['special'] = Axis::single('discount/discount')->getSpecialPrice($product->id);
     /* get variations */
     $data['variations'] = array();
     foreach ($product->findDependentRowset('Axis_Catalog_Model_Product_Variation') as $variation) {
         $data['variations'][$variation->id] = $variation->toArray();
     }
     /* get attributes */
     $optionIds = array();
     $optionValueIds = array();
     $attributes = array();
     foreach ($product->findDependentRowset('Axis_Catalog_Model_Product_Attribute', 'Product') as $attr) {
         /* collect ids for future load labels */
         if ($attr->option_value_id) {
             $optionValueIds[$attr->option_value_id] = $attr->option_value_id;
         }
         /* else {
                continue;
            }*/
         $optionIds[$attr->option_id] = $attr->option_id;
         $attributes[$attr->id] = $attr->toArray();
         $option = $attr->findParentRow('Axis_Catalog_Model_Product_Option', 'Option');
         $attributes[$attr->id]['sort_order'] = $option->sort_order;
         $attributes[$attr->id]['input_type'] = $option->input_type;
         $attributes[$attr->id]['languagable'] = $option->languagable;
         if ($option->isInputable() && !$attr->isModifier()) {
             $values = array();
             $isLanguagable = true;
             foreach ($attr->findDependentRowset('Axis_Catalog_Model_Product_Attribute_Value') as $value) {
                 $values['value_' . intval($value->language_id)] = $value->attribute_value;
                 if (!$value->language_id) {
                     $isLanguagable = false;
                 }
             }
             $attributes[$attr->id]['value_name'] = $isLanguagable ? Zend_Json::encode($values) : current($values);
         }
     }
     $languageId = Axis_Locale::getLanguageId();
     /* collect & fill labels */
     // options
     if (sizeof($optionIds)) {
         $optionText = Axis::single('catalog/product_option_text')->select()->where('option_id IN(?)', $optionIds)->where('language_id = ?', $languageId)->fetchAssoc();
     }
     // values
     if (sizeof($optionValueIds)) {
         $optionValueText = Axis::single('catalog/product_option_value_text')->select()->where('option_value_id IN(?)', $optionValueIds)->where('language_id = ?', $languageId)->fetchAssoc();
     }
     uasort($attributes, array($this, '_sortAttributes'));
     foreach ($attributes as &$refAttr) {
         $refAttr['option_name'] = isset($optionText[$refAttr['option_id']]['name']) ? $optionText[$refAttr['option_id']]['name'] : '';
         if ($refAttr['option_value_id']) {
             $refAttr['value_name'] = isset($optionValueText[$refAttr['option_value_id']]['name']) ? $optionValueText[$refAttr['option_value_id']]['name'] : '';
         }
     }
     $data['modifiers'] = array();
     $data['properties'] = array();
     foreach ($attributes as $attr) {
         if ((bool) $attr['variation_id']) {
             $data['variations'][$attr['variation_id']]['attributes'][] = $attr;
         } else {
             if ((bool) $attr['modifier']) {
                 $data['modifiers'][] = $attr;
             } else {
                 $data['properties'][] = $attr;
             }
         }
     }
     $data['variations'] = array_values($data['variations']);
     // images
     $data['images'] = array();
     foreach (Axis::single('catalog/product_image')->getListBackend($product->id) as $image) {
         if (!isset($data['images'][$image['id']])) {
             $data['images'][$image['id']] = $image;
         }
         $data['images'][$image['id']]['title_' . $image['language_id']] = $image['title'];
     }
     foreach (array('is_base' => $product['image_base'], 'is_listing' => $product['image_listing'], 'is_thumbnail' => $product['image_thumbnail']) as $imageType => $imageId) {
         if (isset($data['images'][$imageId])) {
             $data['images'][$imageId][$imageType] = 1;
         }
     }
     $data['images'] = array_values($data['images']);
     // get stock
     $stock = Axis::single('catalog/product_stock')->find($productId)->current();
     if ($stock) {
         $data['stock'] = $stock->toArray();
     }
     return $this->_helper->json->setData($data)->sendSuccess();
 }
示例#18
0
 /**
  * @param mixed $name array(name => Label)
  * @param mixed $group array(name => Label)
  * @param array $fieldInfo account_customer_field row
  * @param array $groupInfo account_customer_fieldgroup row
  * @return Axis_Account_Model_Customer_Field Provides fluent interface
  */
 public function add($field, $group, $fieldInfo = array(), $groupInfo = array())
 {
     if (!is_array($field)) {
         $field = array($field => $field);
     }
     if (!is_array($group)) {
         $group = array($group => $group);
     }
     $languageIds = array_keys(Axis_Collect_Language::collect());
     $modelFieldGroup = Axis::single('account/customer_FieldGroup');
     /* create field group */
     if (!($groupId = $modelFieldGroup->getIdByName(key($group)))) {
         $defaultGroupInfo = array('name' => key($group), 'sort_order' => 5, 'is_active' => 1);
         $groupId = $modelFieldGroup->insert(array_merge($defaultGroupInfo, $groupInfo));
         $groupLabel = current($group);
         $modelFieldGroupLabel = Axis::single('account/customer_FieldGroup_Label');
         foreach ($languageIds as $languageId) {
             $modelFieldGroupLabel->insert(array('customer_field_group_id' => $groupId, 'language_id' => $languageId, 'group_label' => $groupLabel));
         }
     }
     /* create field */
     if (!($fieldId = $this->getIdByName(key($field)))) {
         $defaultFieldInfo = array('name' => key($field), 'customer_field_group_id' => $groupId, 'field_type' => 'text', 'required' => 0, 'sort_order' => 5, 'is_active' => 1, 'customer_valueset_id' => new Zend_Db_Expr('NULL'), 'validator' => new Zend_Db_Expr('NULL'), 'axis_validator' => new Zend_Db_Expr('NULL'));
         $fieldId = $this->insert(array_merge($defaultFieldInfo, $fieldInfo));
         $fieldLabel = current($field);
         foreach ($languageIds as $languageId) {
             Axis::single('account/customer_field_label')->insert(array('customer_field_id' => $fieldId, 'language_id' => $languageId, 'field_label' => $fieldLabel));
         }
     }
     return $this;
 }
 public function indexAction()
 {
     $this->view->pageTitle = Axis::translate('catalog')->__('Value Sets');
     $this->view->languages = Axis_Collect_Language::collect();
     $this->render();
 }
示例#20
0
 public function indexAction()
 {
     $this->view->pageTitle = Axis::translate('admin')->__("Import");
     $this->view->languages = Axis_Collect_Language::collect();
     $this->render();
 }
 public function batchSaveAction()
 {
     $_rowset = Zend_Json::decode($this->_getParam('data'));
     if (!sizeof($_rowset)) {
         return;
     }
     $model = Axis::model('sales/order_status');
     $modelLabel = Axis::model('sales/order_status_text');
     $languageIds = array_keys(Axis_Collect_Language::collect());
     foreach ($_rowset as $_row) {
         $row = $model->getRow($_row);
         $row->save();
         foreach ($languageIds as $languageId) {
             $rowLabel = $modelLabel->getRow($row->id, $languageId);
             $rowLabel->status_name = $_row['status_name_' . $languageId];
             $rowLabel->save();
         }
     }
     Axis::message()->addSuccess(Axis::translate('sales')->__('Status was saved successfully'));
     return $this->_helper->json->sendSuccess();
 }
示例#22
0
 /**
  * Return option object(Row) for the gived optionName
  * It can create option if it does not exist.
  *
  * @return Axis_Catalog_Model_Product_Option_Row
  */
 private function _getCreateOption($optionName, $createNotExists = false)
 {
     // optionName: "option_name,input_type<,valueset_name>"
     $optionName = explode(',', $optionName);
     if (!isset($this->_optionsCache[$optionName[0]])) {
         $mOption = Axis::single('catalog/product_option');
         $option = $mOption->select()->where('code = ?', $optionName[0])->fetchRow();
         if (!$option && $createNotExists && isset($optionName[1])) {
             // create option
             $option = $mOption->createRow();
             $types = Axis_Catalog_Model_Product_Option::getTypes();
             $option->input_type = array_search($optionName[1], $types);
             $option->code = $optionName[0];
             if (!$option->isInputable() && isset($optionName[2])) {
                 $valueset = Axis::single('catalog/product_option_valueSet')->getCreate($optionName[2]);
                 $option->valueset_id = $valueset->id;
             }
             $option->save();
             // caching language_ids
             if (!Zend_Registry::isRegistered('language_ids')) {
                 Zend_Registry::set('language_ids', array_keys(Axis_Collect_Language::collect()));
             }
             // insert the same text for all languages
             foreach (Zend_Registry::get('language_ids') as $langId) {
                 Axis::single('catalog/product_option_text')->insert(array('option_id' => $option->id, 'language_id' => $langId, 'name' => $option->code, 'description' => ''));
             }
         }
         $this->_optionsCache[$optionName[0]] = $option;
     }
     return $this->_optionsCache[$optionName[0]];
 }
示例#23
0
 /**
  * Update properties
  *
  * @param array $data
  * @return Axis_Catalog_Model_Product_Row
  */
 public function setProperty($data)
 {
     $mAttribute = Axis::single('catalog/product_attribute');
     $mAttributeValue = Axis::single('catalog/product_attribute_value');
     $languages = Axis_Collect_Language::collect();
     foreach ($data as $property) {
         if (!isset($property['id']) || !($row = $mAttribute->find($property['id'])->current())) {
             unset($property['id']);
             $row = $mAttribute->createRow();
             $row->product_id = $this->id;
         }
         if ($property['remove']) {
             $row->delete();
         } else {
             $isInputable = !(bool) $property['option_value_id'];
             $property['option_value_id'] = $property['option_value_id'] ? $property['option_value_id'] : new Zend_Db_Expr('NULL');
             $row->setFromArray($property);
             $row->save();
             if ($isInputable) {
                 if ($property['languagable']) {
                     $property['values'] = Zend_Json::decode($property['value_name']);
                     foreach ($languages as $languageId => $language) {
                         if (!isset($property['values']['value_' . $languageId])) {
                             continue;
                         }
                         if (!($values_row = $mAttributeValue->find($row->id, $languageId)->current())) {
                             $values_row = $mAttributeValue->createRow();
                             $values_row->product_attribute_id = $row->id;
                             $values_row->language_id = $languageId;
                         }
                         $values_row->attribute_value = $property['values']['value_' . $languageId];
                         $values_row->save();
                     }
                 } else {
                     if (!($values_row = $mAttributeValue->find($row->id, 0)->current())) {
                         $values_row = $mAttributeValue->createRow();
                         $values_row->product_attribute_id = $row->id;
                         $values_row->language_id = 0;
                     }
                     $values_row->attribute_value = $property['value_name'];
                     $values_row->save();
                 }
             }
         }
     }
     return $this;
 }
示例#24
0
 /**
  *
  * @param string $name
  * @param int|string $from
  * @param array|int|string $to
  * @param array of string $translates ( 1 => 'pending', 2 => 'jxsredfyyz')
  * @return mixed false|$this Provides fluent interface
  */
 public function add($name, $from = array(), $to = array(), $translates = array())
 {
     if ($this->getIdByName($name)) {
         Axis::message()->addError(Axis::translate('sales')->__('Order status "%s" already exist', $name));
         return false;
     }
     $row = $this->createRow(array('name' => $name, 'system' => 0));
     $row->save();
     //add relation
     $modelRealation = Axis::model('sales/order_status_relation');
     if (is_string($from)) {
         $from = array($this->getIdByName($from));
     }
     $modelRealation->add($from, $row->id);
     if (is_string(to)) {
         $to = array($this->getIdByName($to));
     }
     if (!is_array($to)) {
         $to = array($to);
     }
     foreach ($to as $_to) {
         $modelRealation->add($row->id, $_to);
     }
     //add labels
     $modelLabel = Axis::model('sales/order_status_text');
     $languageIds = array_keys(Axis_Collect_Language::collect());
     foreach ($languageIds as $languageId) {
         if (!isset($translates[$languageId])) {
             continue;
         }
         $modelLabel->createRow(array('status_id' => $row->id, 'language_id' => $languageId, 'status_name' => $translates[$languageId]))->save();
     }
     Axis::message()->addSuccess(Axis::translate('sales')->__("New order status create : %s", $name));
     return $this;
 }
示例#25
0
 /**
  * Save product category
  */
 public function saveAction()
 {
     $success = true;
     $modelCategory = Axis::model('catalog/category');
     /* @var $modelCategory Axis_Catalog_Model_Category */
     $parentId = $this->_getParam('parent_id', 0);
     $categoryId = $this->_getParam('id', 0);
     $catKeyWord = strtolower($this->_getParam('key_word'));
     $siteId = $this->_getParam('site_id');
     /* if human url already exist */
     $modelHurl = Axis::model('catalog/hurl');
     if (!empty($catKeyWord) && $modelHurl->hasDuplicate($catKeyWord, $siteId, $categoryId)) {
         Axis::message()->addError(Axis::translate('catalog')->__('Duplicate entry (url)'));
         return $this->_helper->json->sendFailure();
     }
     $image = $this->_getParam('image');
     // unlink images if requested
     foreach ($image as $imageType => $values) {
         if (isset($image[$imageType]['delete']) && !empty($image[$imageType]['src'])) {
             @unlink(Axis::config()->system->path . '/media/category' . $image[$imageType]['src']);
             $image[$imageType]['src'] = '';
         }
     }
     // save category
     $data = array('status' => $this->_getParam('status', 'enabled'), 'image_base' => $image['base']['src'], 'image_listing' => $image['listing']['src']);
     if ($categoryId) {
         $data['modified_on'] = Axis_Date::now()->toSQLString();
         $modelCategory->update($data, array($this->db->quoteInto('id = ?', $categoryId)));
         $event = 'catalog_category_update_success';
     } else {
         $data['created_on'] = Axis_Date::now()->toSQLString();
         $categoryId = $modelCategory->insertItem($data, $parentId);
         $event = 'catalog_category_add_success';
     }
     Axis::dispatch($event, array('category_id' => $categoryId, 'data' => $data));
     if (!$categoryId) {
         Axis::message()->addError('Unable to save category');
         return $this->_helper->json->sendFailure();
     }
     /* Save category description */
     $categoryName = $this->_getParam('name');
     $categoryDescription = $this->_getParam('description');
     $metaTitle = $this->_getParam('meta_title');
     $metaDescription = $this->_getParam('meta_description');
     $metaKeyword = $this->_getParam('meta_keyword');
     $mCategoryDescription = Axis::model('catalog/category_description');
     foreach (array_keys(Axis_Collect_Language::collect()) as $languageId) {
         if (!isset($categoryName[$languageId])) {
             continue;
         }
         $row = $mCategoryDescription->save(array('category_id' => $categoryId, 'language_id' => $languageId, 'name' => $categoryName[$languageId], 'description' => $categoryDescription[$languageId], 'meta_title' => $metaTitle[$languageId], 'meta_description' => $metaDescription[$languageId], 'meta_keyword' => $metaKeyword[$languageId], 'image_base_title' => $image['base']['title'][$languageId], 'image_listing_title' => $image['listing']['title'][$languageId]));
         if (!$row) {
             return $this->_helper->json->sendFailure();
         }
     }
     /* Save Human Url */
     $modelHurl->delete(array($this->db->quoteInto('key_id = ?', $categoryId), $this->db->quoteInto('key_type = ?', 'c')));
     if (!empty($catKeyWord)) {
         $hurlSuccess = $modelHurl->save(array('key_word' => $catKeyWord, 'key_type' => 'c', 'site_id' => $siteId, 'key_id' => $categoryId));
         if (!$hurlSuccess) {
             return $this->_helper->json->sendFailure();
         }
     }
     Axis::message()->addSuccess(Axis::translate('catalog')->__('Category successfully saved'));
     return $this->_helper->json->setData(array('category_id' => $categoryId))->sendSuccess();
 }