1: <?php
2: /**
3: * Magento
4: *
5: * NOTICE OF LICENSE
6: *
7: * This source file is subject to the Open Software License (OSL 3.0)
8: * that is bundled with this package in the file LICENSE.txt.
9: * It is also available through the world-wide-web at this URL:
10: * http://opensource.org/licenses/osl-3.0.php
11: * If you did not receive a copy of the license and are unable to
12: * obtain it through the world-wide-web, please send an email
13: * to license@magentocommerce.com so we can send you a copy immediately.
14: *
15: * DISCLAIMER
16: *
17: * Do not edit or add to this file if you wish to upgrade Magento to newer
18: * versions in the future. If you wish to customize Magento for your
19: * needs please refer to http://www.magentocommerce.com for more information.
20: *
21: * @category Mage
22: * @package Mage_Catalog
23: * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24: * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25: */
26:
27:
28: /**
29: * Catalog entity setup
30: *
31: * @category Mage
32: * @package Mage_Catalog
33: * @author Magento Core Team <core@magentocommerce.com>
34: */
35: class Mage_Catalog_Model_Resource_Setup extends Mage_Eav_Model_Entity_Setup
36: {
37: /**
38: * Prepare catalog attribute values to save
39: *
40: * @param array $attr
41: * @return array
42: */
43: protected function _prepareValues($attr)
44: {
45: $data = parent::_prepareValues($attr);
46: $data = array_merge($data, array(
47: 'frontend_input_renderer' => $this->_getValue($attr, 'input_renderer'),
48: 'is_global' => $this->_getValue(
49: $attr,
50: 'global',
51: Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL
52: ),
53: 'is_visible' => $this->_getValue($attr, 'visible', 1),
54: 'is_searchable' => $this->_getValue($attr, 'searchable', 0),
55: 'is_filterable' => $this->_getValue($attr, 'filterable', 0),
56: 'is_comparable' => $this->_getValue($attr, 'comparable', 0),
57: 'is_visible_on_front' => $this->_getValue($attr, 'visible_on_front', 0),
58: 'is_wysiwyg_enabled' => $this->_getValue($attr, 'wysiwyg_enabled', 0),
59: 'is_html_allowed_on_front' => $this->_getValue($attr, 'is_html_allowed_on_front', 0),
60: 'is_visible_in_advanced_search' => $this->_getValue($attr, 'visible_in_advanced_search', 0),
61: 'is_filterable_in_search' => $this->_getValue($attr, 'filterable_in_search', 0),
62: 'used_in_product_listing' => $this->_getValue($attr, 'used_in_product_listing', 0),
63: 'used_for_sort_by' => $this->_getValue($attr, 'used_for_sort_by', 0),
64: 'apply_to' => $this->_getValue($attr, 'apply_to'),
65: 'position' => $this->_getValue($attr, 'position', 0),
66: 'is_configurable' => $this->_getValue($attr, 'is_configurable', 1),
67: 'is_used_for_promo_rules' => $this->_getValue($attr, 'used_for_promo_rules', 0)
68: ));
69: return $data;
70: }
71:
72: /**
73: * Default entites and attributes
74: *
75: * @return array
76: */
77: public function getDefaultEntities()
78: {
79: return array(
80: 'catalog_category' => array(
81: 'entity_model' => 'catalog/category',
82: 'attribute_model' => 'catalog/resource_eav_attribute',
83: 'table' => 'catalog/category',
84: 'additional_attribute_table' => 'catalog/eav_attribute',
85: 'entity_attribute_collection' => 'catalog/category_attribute_collection',
86: 'default_group' => 'General Information',
87: 'attributes' => array(
88: 'name' => array(
89: 'type' => 'varchar',
90: 'label' => 'Name',
91: 'input' => 'text',
92: 'sort_order' => 1,
93: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
94: 'group' => 'General Information',
95: ),
96: 'is_active' => array(
97: 'type' => 'int',
98: 'label' => 'Is Active',
99: 'input' => 'select',
100: 'source' => 'eav/entity_attribute_source_boolean',
101: 'sort_order' => 2,
102: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
103: 'group' => 'General Information',
104: ),
105: 'url_key' => array(
106: 'type' => 'varchar',
107: 'label' => 'URL Key',
108: 'input' => 'text',
109: 'backend' => 'catalog/category_attribute_backend_urlkey',
110: 'required' => false,
111: 'sort_order' => 3,
112: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
113: 'group' => 'General Information',
114: ),
115: 'description' => array(
116: 'type' => 'text',
117: 'label' => 'Description',
118: 'input' => 'textarea',
119: 'required' => false,
120: 'sort_order' => 4,
121: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
122: 'wysiwyg_enabled' => true,
123: 'is_html_allowed_on_front' => true,
124: 'group' => 'General Information',
125: ),
126: 'image' => array(
127: 'type' => 'varchar',
128: 'label' => 'Image',
129: 'input' => 'image',
130: 'backend' => 'catalog/category_attribute_backend_image',
131: 'required' => false,
132: 'sort_order' => 5,
133: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
134: 'group' => 'General Information',
135: ),
136: 'meta_title' => array(
137: 'type' => 'varchar',
138: 'label' => 'Page Title',
139: 'input' => 'text',
140: 'required' => false,
141: 'sort_order' => 6,
142: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
143: 'group' => 'General Information',
144: ),
145: 'meta_keywords' => array(
146: 'type' => 'text',
147: 'label' => 'Meta Keywords',
148: 'input' => 'textarea',
149: 'required' => false,
150: 'sort_order' => 7,
151: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
152: 'group' => 'General Information',
153: ),
154: 'meta_description' => array(
155: 'type' => 'text',
156: 'label' => 'Meta Description',
157: 'input' => 'textarea',
158: 'required' => false,
159: 'sort_order' => 8,
160: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
161: 'group' => 'General Information',
162: ),
163: 'display_mode' => array(
164: 'type' => 'varchar',
165: 'label' => 'Display Mode',
166: 'input' => 'select',
167: 'source' => 'catalog/category_attribute_source_mode',
168: 'required' => false,
169: 'sort_order' => 10,
170: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
171: 'group' => 'Display Settings',
172: ),
173: 'landing_page' => array(
174: 'type' => 'int',
175: 'label' => 'CMS Block',
176: 'input' => 'select',
177: 'source' => 'catalog/category_attribute_source_page',
178: 'required' => false,
179: 'sort_order' => 20,
180: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
181: 'group' => 'Display Settings',
182: ),
183: 'is_anchor' => array(
184: 'type' => 'int',
185: 'label' => 'Is Anchor',
186: 'input' => 'select',
187: 'source' => 'eav/entity_attribute_source_boolean',
188: 'required' => false,
189: 'sort_order' => 30,
190: 'group' => 'Display Settings',
191: ),
192: 'path' => array(
193: 'type' => 'static',
194: 'label' => 'Path',
195: 'required' => false,
196: 'sort_order' => 12,
197: 'visible' => false,
198: 'group' => 'General Information',
199: ),
200: 'position' => array(
201: 'type' => 'static',
202: 'label' => 'Position',
203: 'required' => false,
204: 'sort_order' => 13,
205: 'visible' => false,
206: 'group' => 'General Information',
207: ),
208: 'all_children' => array(
209: 'type' => 'text',
210: 'required' => false,
211: 'sort_order' => 14,
212: 'visible' => false,
213: 'group' => 'General Information',
214: ),
215: 'path_in_store' => array(
216: 'type' => 'text',
217: 'required' => false,
218: 'sort_order' => 15,
219: 'visible' => false,
220: 'group' => 'General Information',
221: ),
222: 'children' => array(
223: 'type' => 'text',
224: 'required' => false,
225: 'sort_order' => 16,
226: 'visible' => false,
227: 'group' => 'General Information',
228: ),
229: 'url_path' => array(
230: 'type' => 'varchar',
231: 'required' => false,
232: 'sort_order' => 17,
233: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
234: 'visible' => false,
235: 'group' => 'General Information',
236: ),
237: 'custom_design' => array(
238: 'type' => 'varchar',
239: 'label' => 'Custom Design',
240: 'input' => 'select',
241: 'source' => 'core/design_source_design',
242: 'required' => false,
243: 'sort_order' => 10,
244: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
245: 'group' => 'Custom Design',
246: ),
247: 'custom_design_from' => array(
248: 'type' => 'datetime',
249: 'label' => 'Active From',
250: 'input' => 'date',
251: 'backend' => 'eav/entity_attribute_backend_datetime',
252: 'required' => false,
253: 'sort_order' => 30,
254: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
255: 'group' => 'Custom Design',
256: ),
257: 'custom_design_to' => array(
258: 'type' => 'datetime',
259: 'label' => 'Active To',
260: 'input' => 'date',
261: 'backend' => 'eav/entity_attribute_backend_datetime',
262: 'required' => false,
263: 'sort_order' => 40,
264: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
265: 'group' => 'Custom Design',
266: ),
267: 'page_layout' => array(
268: 'type' => 'varchar',
269: 'label' => 'Page Layout',
270: 'input' => 'select',
271: 'source' => 'catalog/category_attribute_source_layout',
272: 'required' => false,
273: 'sort_order' => 50,
274: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
275: 'group' => 'Custom Design',
276: ),
277: 'custom_layout_update' => array(
278: 'type' => 'text',
279: 'label' => 'Custom Layout Update',
280: 'input' => 'textarea',
281: 'backend' => 'catalog/attribute_backend_customlayoutupdate',
282: 'required' => false,
283: 'sort_order' => 60,
284: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
285: 'group' => 'Custom Design',
286: ),
287: 'level' => array(
288: 'type' => 'static',
289: 'label' => 'Level',
290: 'required' => false,
291: 'sort_order' => 24,
292: 'visible' => false,
293: 'group' => 'General Information',
294: ),
295: 'children_count' => array(
296: 'type' => 'static',
297: 'label' => 'Children Count',
298: 'required' => false,
299: 'sort_order' => 25,
300: 'visible' => false,
301: 'group' => 'General Information',
302: ),
303: 'available_sort_by' => array(
304: 'type' => 'text',
305: 'label' => 'Available Product Listing Sort By',
306: 'input' => 'multiselect',
307: 'source' => 'catalog/category_attribute_source_sortby',
308: 'backend' => 'catalog/category_attribute_backend_sortby',
309: 'sort_order' => 40,
310: 'input_renderer' => 'adminhtml/catalog_category_helper_sortby_available',
311: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
312: 'group' => 'Display Settings',
313: ),
314: 'default_sort_by' => array(
315: 'type' => 'varchar',
316: 'label' => 'Default Product Listing Sort By',
317: 'input' => 'select',
318: 'source' => 'catalog/category_attribute_source_sortby',
319: 'backend' => 'catalog/category_attribute_backend_sortby',
320: 'sort_order' => 50,
321: 'input_renderer' => 'adminhtml/catalog_category_helper_sortby_default',
322: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
323: 'group' => 'Display Settings',
324: ),
325: 'include_in_menu' => array(
326: 'type' => 'int',
327: 'label' => 'Include in Navigation Menu',
328: 'input' => 'select',
329: 'source' => 'eav/entity_attribute_source_boolean',
330: 'default' => '1',
331: 'sort_order' => 10,
332: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
333: 'group' => 'General Information',
334: ),
335: 'custom_use_parent_settings' => array(
336: 'type' => 'int',
337: 'label' => 'Use Parent Category Settings',
338: 'input' => 'select',
339: 'source' => 'eav/entity_attribute_source_boolean',
340: 'required' => false,
341: 'sort_order' => 5,
342: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
343: 'group' => 'Custom Design',
344: ),
345: 'custom_apply_to_products' => array(
346: 'type' => 'int',
347: 'label' => 'Apply To Products',
348: 'input' => 'select',
349: 'source' => 'eav/entity_attribute_source_boolean',
350: 'required' => false,
351: 'sort_order' => 6,
352: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
353: 'group' => 'Custom Design',
354: ),
355: 'filter_price_range' => array(
356: 'type' => 'decimal',
357: 'label' => 'Layered Navigation Price Step',
358: 'input' => 'text',
359: 'required' => false,
360: 'sort_order' => 51,
361: 'input_renderer' => 'adminhtml/catalog_category_helper_pricestep',
362: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
363: 'group' => 'Display Settings',
364: ),
365: )
366: ),
367: 'catalog_product' => array(
368: 'entity_model' => 'catalog/product',
369: 'attribute_model' => 'catalog/resource_eav_attribute',
370: 'table' => 'catalog/product',
371: 'additional_attribute_table' => 'catalog/eav_attribute',
372: 'entity_attribute_collection' => 'catalog/product_attribute_collection',
373: 'attributes' => array(
374: 'name' => array(
375: 'type' => 'varchar',
376: 'label' => 'Name',
377: 'input' => 'text',
378: 'sort_order' => 1,
379: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
380: 'searchable' => true,
381: 'visible_in_advanced_search' => true,
382: 'used_in_product_listing' => true,
383: 'used_for_sort_by' => true,
384: ),
385: 'description' => array(
386: 'type' => 'text',
387: 'label' => 'Description',
388: 'input' => 'textarea',
389: 'sort_order' => 2,
390: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
391: 'searchable' => true,
392: 'comparable' => true,
393: 'wysiwyg_enabled' => true,
394: 'is_html_allowed_on_front' => true,
395: 'visible_in_advanced_search' => true,
396: ),
397: 'short_description' => array(
398: 'type' => 'text',
399: 'label' => 'Short Description',
400: 'input' => 'textarea',
401: 'sort_order' => 3,
402: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
403: 'searchable' => true,
404: 'comparable' => true,
405: 'wysiwyg_enabled' => true,
406: 'is_html_allowed_on_front' => true,
407: 'visible_in_advanced_search' => true,
408: 'used_in_product_listing' => true,
409: ),
410: 'sku' => array(
411: 'type' => 'static',
412: 'label' => 'SKU',
413: 'input' => 'text',
414: 'backend' => 'catalog/product_attribute_backend_sku',
415: 'unique' => true,
416: 'sort_order' => 4,
417: 'searchable' => true,
418: 'comparable' => true,
419: 'visible_in_advanced_search' => true,
420: ),
421: 'price' => array(
422: 'type' => 'decimal',
423: 'label' => 'Price',
424: 'input' => 'price',
425: 'backend' => 'catalog/product_attribute_backend_price',
426: 'sort_order' => 1,
427: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
428: 'searchable' => true,
429: 'filterable' => true,
430: 'visible_in_advanced_search' => true,
431: 'used_in_product_listing' => true,
432: 'used_for_sort_by' => true,
433: 'apply_to' => 'simple,configurable,virtual',
434: 'group' => 'Prices',
435: ),
436: 'special_price' => array(
437: 'type' => 'decimal',
438: 'label' => 'Special Price',
439: 'input' => 'price',
440: 'backend' => 'catalog/product_attribute_backend_price',
441: 'required' => false,
442: 'sort_order' => 2,
443: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
444: 'used_in_product_listing' => true,
445: 'apply_to' => 'simple,configurable,virtual',
446: 'group' => 'Prices',
447: ),
448: 'special_from_date' => array(
449: 'type' => 'datetime',
450: 'label' => 'Special Price From Date',
451: 'input' => 'date',
452: 'backend' => 'catalog/product_attribute_backend_startdate',
453: 'required' => false,
454: 'sort_order' => 3,
455: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
456: 'used_in_product_listing' => true,
457: 'apply_to' => 'simple,configurable,virtual',
458: 'group' => 'Prices',
459: ),
460: 'special_to_date' => array(
461: 'type' => 'datetime',
462: 'label' => 'Special Price To Date',
463: 'input' => 'date',
464: 'backend' => 'eav/entity_attribute_backend_datetime',
465: 'required' => false,
466: 'sort_order' => 4,
467: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
468: 'used_in_product_listing' => true,
469: 'apply_to' => 'simple,configurable,virtual',
470: 'group' => 'Prices',
471: ),
472: 'cost' => array(
473: 'type' => 'decimal',
474: 'label' => 'Cost',
475: 'input' => 'price',
476: 'backend' => 'catalog/product_attribute_backend_price',
477: 'required' => false,
478: 'user_defined' => true,
479: 'sort_order' => 5,
480: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
481: 'apply_to' => 'simple,virtual',
482: 'group' => 'Prices',
483: ),
484: 'weight' => array(
485: 'type' => 'decimal',
486: 'label' => 'Weight',
487: 'input' => 'weight',
488: 'sort_order' => 5,
489: 'apply_to' => Mage_Catalog_Model_Product_Type::TYPE_SIMPLE,
490: ),
491: 'manufacturer' => array(
492: 'type' => 'int',
493: 'label' => 'Manufacturer',
494: 'input' => 'select',
495: 'required' => false,
496: 'user_defined' => true,
497: 'searchable' => true,
498: 'filterable' => true,
499: 'comparable' => true,
500: 'visible_in_advanced_search' => true,
501: 'apply_to' => Mage_Catalog_Model_Product_Type::TYPE_SIMPLE,
502: ),
503: 'meta_title' => array(
504: 'type' => 'varchar',
505: 'label' => 'Meta Title',
506: 'input' => 'text',
507: 'required' => false,
508: 'sort_order' => 1,
509: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
510: 'group' => 'Meta Information',
511: ),
512: 'meta_keyword' => array(
513: 'type' => 'text',
514: 'label' => 'Meta Keywords',
515: 'input' => 'textarea',
516: 'required' => false,
517: 'sort_order' => 2,
518: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
519: 'group' => 'Meta Information',
520: ),
521: 'meta_description' => array(
522: 'type' => 'varchar',
523: 'label' => 'Meta Description',
524: 'input' => 'textarea',
525: 'required' => false,
526: 'note' => 'Maximum 255 chars',
527: 'class' => 'validate-length maximum-length-255',
528: 'sort_order' => 3,
529: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
530: 'group' => 'Meta Information',
531: ),
532: 'image' => array(
533: 'type' => 'varchar',
534: 'label' => 'Base Image',
535: 'input' => 'media_image',
536: 'frontend' => 'catalog/product_attribute_frontend_image',
537: 'required' => false,
538: 'sort_order' => 1,
539: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
540: 'group' => 'Images',
541: ),
542: 'small_image' => array(
543: 'type' => 'varchar',
544: 'label' => 'Small Image',
545: 'input' => 'media_image',
546: 'frontend' => 'catalog/product_attribute_frontend_image',
547: 'required' => false,
548: 'sort_order' => 2,
549: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
550: 'used_in_product_listing' => true,
551: 'group' => 'Images',
552: ),
553: 'thumbnail' => array(
554: 'type' => 'varchar',
555: 'label' => 'Thumbnail',
556: 'input' => 'media_image',
557: 'frontend' => 'catalog/product_attribute_frontend_image',
558: 'required' => false,
559: 'sort_order' => 3,
560: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
561: 'used_in_product_listing' => true,
562: 'group' => 'Images',
563: ),
564: 'media_gallery' => array(
565: 'type' => 'varchar',
566: 'label' => 'Media Gallery',
567: 'input' => 'gallery',
568: 'backend' => 'catalog/product_attribute_backend_media',
569: 'required' => false,
570: 'sort_order' => 4,
571: 'group' => 'Images',
572: ),
573: 'old_id' => array(
574: 'type' => 'int',
575: 'required' => false,
576: 'sort_order' => 6,
577: 'visible' => false,
578: ),
579: 'group_price' => array(
580: 'type' => 'decimal',
581: 'label' => 'Group Price',
582: 'input' => 'text',
583: 'backend' => 'catalog/product_attribute_backend_groupprice',
584: 'required' => false,
585: 'sort_order' => 6,
586: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
587: 'apply_to' => 'simple,configurable,virtual',
588: 'group' => 'Prices',
589: ),
590: 'tier_price' => array(
591: 'type' => 'decimal',
592: 'label' => 'Tier Price',
593: 'input' => 'text',
594: 'backend' => 'catalog/product_attribute_backend_tierprice',
595: 'required' => false,
596: 'sort_order' => 6,
597: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
598: 'apply_to' => 'simple,configurable,virtual',
599: 'group' => 'Prices',
600: ),
601: 'color' => array(
602: 'type' => 'int',
603: 'label' => 'Color',
604: 'input' => 'select',
605: 'required' => false,
606: 'user_defined' => true,
607: 'searchable' => true,
608: 'filterable' => true,
609: 'comparable' => true,
610: 'visible_in_advanced_search' => true,
611: 'apply_to' => Mage_Catalog_Model_Product_Type::TYPE_SIMPLE,
612: ),
613: 'news_from_date' => array(
614: 'type' => 'datetime',
615: 'label' => 'Set Product as New from Date',
616: 'input' => 'date',
617: 'backend' => 'eav/entity_attribute_backend_datetime',
618: 'required' => false,
619: 'sort_order' => 7,
620: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
621: 'used_in_product_listing' => true,
622: ),
623: 'news_to_date' => array(
624: 'type' => 'datetime',
625: 'label' => 'Set Product as New to Date',
626: 'input' => 'date',
627: 'backend' => 'eav/entity_attribute_backend_datetime',
628: 'required' => false,
629: 'sort_order' => 8,
630: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
631: 'used_in_product_listing' => true,
632: ),
633: 'gallery' => array(
634: 'type' => 'varchar',
635: 'label' => 'Image Gallery',
636: 'input' => 'gallery',
637: 'required' => false,
638: 'sort_order' => 5,
639: 'group' => 'Images',
640: ),
641: 'status' => array(
642: 'type' => 'int',
643: 'label' => 'Status',
644: 'input' => 'select',
645: 'source' => 'catalog/product_status',
646: 'sort_order' => 9,
647: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
648: 'searchable' => true,
649: 'used_in_product_listing' => true,
650: ),
651: 'url_key' => array(
652: 'type' => 'varchar',
653: 'label' => 'URL Key',
654: 'input' => 'text',
655: 'backend' => 'catalog/product_attribute_backend_urlkey',
656: 'required' => false,
657: 'sort_order' => 10,
658: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
659: 'used_in_product_listing' => true,
660: ),
661: 'url_path' => array(
662: 'type' => 'varchar',
663: 'required' => false,
664: 'sort_order' => 11,
665: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
666: 'visible' => false,
667: ),
668: 'minimal_price' => array(
669: 'type' => 'decimal',
670: 'label' => 'Minimal Price',
671: 'input' => 'price',
672: 'required' => false,
673: 'sort_order' => 7,
674: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
675: 'visible' => false,
676: 'apply_to' => 'simple,configurable,virtual',
677: 'group' => 'Prices',
678: ),
679: 'is_recurring' => array(
680: 'type' => 'int',
681: 'label' => 'Enable Recurring Profile',
682: 'input' => 'select',
683: 'source' => 'eav/entity_attribute_source_boolean',
684: 'required' => false,
685: 'note' =>
686: 'Products with recurring profile participate in catalog as nominal items.',
687: 'sort_order' => 1,
688: 'apply_to' => 'simple,virtual',
689: 'is_configurable' => false,
690: 'group' => 'Recurring Profile',
691: ),
692: 'recurring_profile' => array(
693: 'type' => 'text',
694: 'label' => 'Recurring Payment Profile',
695: 'input' => 'text',
696: 'backend' => 'catalog/product_attribute_backend_recurring',
697: 'required' => false,
698: 'sort_order' => 2,
699: 'apply_to' => 'simple,virtual',
700: 'is_configurable' => false,
701: 'group' => 'Recurring Profile',
702: ),
703: 'visibility' => array(
704: 'type' => 'int',
705: 'label' => 'Visibility',
706: 'input' => 'select',
707: 'source' => 'catalog/product_visibility',
708: 'default' => '4',
709: 'sort_order' => 12,
710: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
711: ),
712: 'custom_design' => array(
713: 'type' => 'varchar',
714: 'label' => 'Custom Design',
715: 'input' => 'select',
716: 'source' => 'core/design_source_design',
717: 'required' => false,
718: 'sort_order' => 1,
719: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
720: 'group' => 'Design',
721: ),
722: 'custom_design_from' => array(
723: 'type' => 'datetime',
724: 'label' => 'Active From',
725: 'input' => 'date',
726: 'backend' => 'eav/entity_attribute_backend_datetime',
727: 'required' => false,
728: 'sort_order' => 2,
729: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
730: 'group' => 'Design',
731: ),
732: 'custom_design_to' => array(
733: 'type' => 'datetime',
734: 'label' => 'Active To',
735: 'input' => 'date',
736: 'backend' => 'eav/entity_attribute_backend_datetime',
737: 'required' => false,
738: 'sort_order' => 3,
739: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
740: 'group' => 'Design',
741: ),
742: 'custom_layout_update' => array(
743: 'type' => 'text',
744: 'label' => 'Custom Layout Update',
745: 'input' => 'textarea',
746: 'backend' => 'catalog/attribute_backend_customlayoutupdate',
747: 'required' => false,
748: 'sort_order' => 4,
749: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
750: 'group' => 'Design',
751: ),
752: 'page_layout' => array(
753: 'type' => 'varchar',
754: 'label' => 'Page Layout',
755: 'input' => 'select',
756: 'source' => 'catalog/product_attribute_source_layout',
757: 'required' => false,
758: 'sort_order' => 5,
759: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
760: 'group' => 'Design',
761: ),
762: 'category_ids' => array(
763: 'type' => 'static',
764: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
765: 'required' => false,
766: 'sort_order' => 13,
767: 'visible' => false,
768: ),
769: 'options_container' => array(
770: 'type' => 'varchar',
771: 'label' => 'Display Product Options In',
772: 'input' => 'select',
773: 'source' => 'catalog/entity_product_attribute_design_options_container',
774: 'required' => false,
775: 'default' => 'container2',
776: 'sort_order' => 6,
777: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
778: 'group' => 'Design',
779: ),
780: 'required_options' => array(
781: 'type' => 'static',
782: 'input' => 'text',
783: 'required' => false,
784: 'sort_order' => 14,
785: 'visible' => false,
786: 'used_in_product_listing' => true,
787: ),
788: 'has_options' => array(
789: 'type' => 'static',
790: 'input' => 'text',
791: 'required' => false,
792: 'sort_order' => 15,
793: 'visible' => false,
794: ),
795: 'image_label' => array(
796: 'type' => 'varchar',
797: 'label' => 'Image Label',
798: 'input' => 'text',
799: 'required' => false,
800: 'sort_order' => 16,
801: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
802: 'visible' => false,
803: 'used_in_product_listing' => true,
804: 'is_configurable' => false,
805: ),
806: 'small_image_label' => array(
807: 'type' => 'varchar',
808: 'label' => 'Small Image Label',
809: 'input' => 'text',
810: 'required' => false,
811: 'sort_order' => 17,
812: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
813: 'visible' => false,
814: 'used_in_product_listing' => true,
815: 'is_configurable' => false,
816: ),
817: 'thumbnail_label' => array(
818: 'type' => 'varchar',
819: 'label' => 'Thumbnail Label',
820: 'input' => 'text',
821: 'required' => false,
822: 'sort_order' => 18,
823: 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
824: 'visible' => false,
825: 'used_in_product_listing' => true,
826: 'is_configurable' => false,
827: ),
828: 'created_at' => array(
829: 'type' => 'static',
830: 'input' => 'text',
831: 'backend' => 'eav/entity_attribute_backend_time_created',
832: 'sort_order' => 19,
833: 'visible' => false,
834: ),
835: 'updated_at' => array(
836: 'type' => 'static',
837: 'input' => 'text',
838: 'backend' => 'eav/entity_attribute_backend_time_updated',
839: 'sort_order' => 20,
840: 'visible' => false,
841: ),
842: )
843: )
844: );
845: }
846:
847: /**
848: * Converts old tree to new
849: *
850: * @deprecated since 1.5.0.0
851: * @return Mage_Catalog_Model_Resource_Setup
852: */
853: public function convertOldTreeToNew()
854: {
855: if (!Mage::getModel('catalog/category')->load(1)->getId()) {
856: Mage::getModel('catalog/category')->setId(1)->setPath(1)->save();
857: }
858:
859: $categories = array();
860:
861: $select = $this->getConnection()->select();
862: $select->from($this->getTable('catalog/category'));
863: $categories = $this->getConnection()->fetchAll($select);
864:
865: if (is_array($categories)) {
866: foreach ($categories as $category) {
867: $path = $this->_getCategoryPath($category);
868: $path = array_reverse($path);
869: $path = implode('/', $path);
870: if ($category['entity_id'] != 1 && substr($path, 0, 2) != '1/') {
871: $path = "1/{$path}";
872: }
873:
874: $this
875: ->getConnection()
876: ->update(
877: $this->getTable('catalog/category'),
878: array('path' => $path),
879: array('entity_id = ?' => $category['entity_id'])
880: );
881: }
882: }
883: return $this;
884: }
885:
886: /**
887: * Returns category entity row by category id
888: *
889: * @param int $entityId
890: * @return array
891: */
892: protected function _getCategoryEntityRow($entityId)
893: {
894: $select = $this->getConnection()->select();
895:
896: $select->from($this->getTable('catalog/category'));
897: $select->where('entity_id = :entity_id');
898:
899: return $this->getConnection()->fetchRow($select, array('entity_id' => $entityId));
900: }
901:
902: /**
903: * Returns category path as array
904: *
905: * @param array $category
906: * @param array $path
907: * @return string
908: */
909: protected function _getCategoryPath($category, $path = array())
910: {
911: $path[] = $category['entity_id'];
912:
913: if ($category['parent_id'] != 0) {
914: $parentCategory = $this->_getCategoryEntityRow($category['parent_id']);
915: if ($parentCategory) {
916: $path = $this->_getCategoryPath($parentCategory, $path);
917: }
918: }
919:
920: return $path;
921: }
922:
923: /**
924: * Creates level values for categories and saves them
925: *
926: * @deprecated since 1.5.0.0
927: * @return Mage_Catalog_Model_Resource_Setup
928: */
929: public function rebuildCategoryLevels()
930: {
931: $adapter = $this->getConnection();
932: $select = $adapter->select()
933: ->from($this->getTable('catalog/category'));
934:
935: $categories = $adapter->fetchAll($select);
936:
937: foreach ($categories as $category) {
938: $level = count(explode('/', $category['path']))-1;
939: $adapter->update(
940: $this->getTable('catalog/category'),
941: array('level' => $level),
942: array('entity_id = ?' => $category['entity_id'])
943: );
944: }
945: return $this;
946: }
947: }
948: