Version Notes
fixed minor bugs
Download this release
Release Info
Developer | Minglong Li |
Extension | Achang_Scene7 |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/local/Achang/Scene7/Block/Adminhtml/Attribute.php +12 -0
- app/code/local/Achang/Scene7/Block/Adminhtml/Attribute/Edit.php +45 -0
- app/code/local/Achang/Scene7/Block/Adminhtml/Attribute/Edit/Form.php +19 -0
- app/code/local/Achang/Scene7/Block/Adminhtml/Attribute/Edit/Tab/Form.php +58 -0
- app/code/local/Achang/Scene7/Block/Adminhtml/Attribute/Edit/Tabs.php +24 -0
- app/code/local/Achang/Scene7/Block/Adminhtml/Attribute/Grid.php +120 -0
- app/code/local/Achang/Scene7/Block/Adminhtml/Catalog/Product/Edit/Tab/Options/Option.php +158 -0
- app/code/local/Achang/Scene7/Block/Adminhtml/Catalog/Product/Edit/Tab/Options/Type/Select.php +84 -0
- app/code/local/Achang/Scene7/Block/Cart/Item/Renderer/Scene7.php +30 -0
- app/code/local/Achang/Scene7/Block/Product/View/Options.php +61 -0
- app/code/local/Achang/Scene7/Block/Product/View/Options/Type/Scene7select.php +51 -0
- app/code/local/Achang/Scene7/Block/Product/View/Options/Type/Scene7text.php +13 -0
- app/code/local/Achang/Scene7/Block/Sales/Order/Item/Renderer/Default.php +56 -0
- app/code/local/Achang/Scene7/Helper/Data.php +94 -0
- app/code/local/Achang/Scene7/Model/Attribute.php +10 -0
- app/code/local/Achang/Scene7/Model/Catalog/Product/Option.php +227 -0
- app/code/local/Achang/Scene7/Model/Catalog/Product/Option/Type/Default.php +65 -0
- app/code/local/Achang/Scene7/Model/Catalog/Product/Option/Type/Scene7select.php +306 -0
- app/code/local/Achang/Scene7/Model/Catalog/Product/Option/Type/Scene7text.php +85 -0
- app/code/local/Achang/Scene7/Model/Catalog/Product/Option/Value.php +41 -0
- app/code/local/Achang/Scene7/Model/Product/Price/Scene7.php +21 -0
- app/code/local/Achang/Scene7/Model/Product/Type.php +5 -0
- app/code/local/Achang/Scene7/Model/Product/Type/Scene7.php +34 -0
- app/code/local/Achang/Scene7/Model/Product/Type/Scene7.php.bak +34 -0
- app/code/local/Achang/Scene7/Model/Resource/Attribute.php +10 -0
- app/code/local/Achang/Scene7/Model/Resource/Attribute/Collection.php +10 -0
- app/code/local/Achang/Scene7/Model/Resource/Product/Option.php +287 -0
- app/code/local/Achang/Scene7/Model/Resource/Product/Option/Collection.php +83 -0
- app/code/local/Achang/Scene7/Model/Resource/Product/Option/Value.php +180 -0
- app/code/local/Achang/Scene7/Model/Resource/Product/Option/Value/Collection.php +59 -0
- app/code/local/Achang/Scene7/Model/Scene7.php +127 -0
- app/code/local/Achang/Scene7/Model/Session.php +6 -0
- app/code/local/Achang/Scene7/Model/Status.php +15 -0
- app/code/local/Achang/Scene7/Model/System/Config/Source/Product/Options/Type.php +73 -0
- app/code/local/Achang/Scene7/controllers/Adminhtml/AttributeController.php +185 -0
- app/code/local/Achang/Scene7/controllers/IndexController.php +18 -0
- app/code/local/Achang/Scene7/etc/adminhtml.xml +35 -0
- app/code/local/Achang/Scene7/etc/config.xml +172 -0
- app/code/local/Achang/Scene7/etc/system.xml +47 -0
- app/code/local/Achang/Scene7/sql/scenescene7_setup/mysql4-install-0.5.0.php +21 -0
- app/code/local/Achang/Scene7/sql/scenescene7_setup/mysql4-upgrade-0.5.0-0.5.1.php +48 -0
- app/code/local/Achang/Scene7/sql/scenescene7_setup/mysql4-upgrade-0.5.1-0.5.2.php +11 -0
- app/code/local/Achang/Scene7/sql/scenescene7_setup/mysql4-upgrade-0.5.2-0.5.3.php +13 -0
- app/code/local/Achang/Scene7/sql/scenescene7_setup/mysql4-upgrade-0.5.3-0.5.4.php +10 -0
- app/design/adminhtml/default/default/layout/achang_scene7.xml +8 -0
- app/design/frontend/default/default/layout/achang_scene7.xml +46 -0
- app/design/frontend/default/default/template/scene7/catalog/product/view.phtml +131 -0
- app/design/frontend/default/default/template/scene7/catalog/product/view/options.phtml +263 -0
- app/design/frontend/default/default/template/scene7/catalog/product/view/options/type/scene7select.phtml +39 -0
- app/design/frontend/default/default/template/scene7/catalog/product/view/options/type/scene7text.phtml +41 -0
- app/design/frontend/default/default/template/scene7/checkout/cart/scene7.phtml +244 -0
- app/etc/modules/Achang_All.xml +13 -0
- js/jquery/jquery-1.4.2.min.js +154 -0
- js/jquery/jquery-noconflict.js +29 -0
- js/jquery/jquery.ajaxmanager.js +342 -0
- package.xml +18 -0
- skin/frontend/default/default/css/scene7.css +1 -0
- skin/frontend/default/default/images/image_loading.gif +0 -0
app/code/local/Achang/Scene7/Block/Adminhtml/Attribute.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Achang_Scene7_Block_Adminhtml_Attribute extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->_controller = 'adminhtml_attribute';
|
7 |
+
$this->_blockGroup = 'scenescene7';
|
8 |
+
$this->_headerText = Mage::helper('scenescene7')->__('Attributes Manager');
|
9 |
+
$this->_addButtonLabel = Mage::helper('scenescene7')->__('Add Attribute');
|
10 |
+
parent::__construct();
|
11 |
+
}
|
12 |
+
}
|
app/code/local/Achang/Scene7/Block/Adminhtml/Attribute/Edit.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Achang_Scene7_Block_Adminhtml_Attribute_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
|
9 |
+
$this->_objectId = 'id';
|
10 |
+
$this->_blockGroup = 'scenescene7';
|
11 |
+
$this->_controller = 'adminhtml_attribute';
|
12 |
+
|
13 |
+
$this->_updateButton('save', 'label', Mage::helper('scenescene7')->__('Save Item'));
|
14 |
+
$this->_updateButton('delete', 'label', Mage::helper('scenescene7')->__('Delete Item'));
|
15 |
+
|
16 |
+
$this->_addButton('saveandcontinue', array(
|
17 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
18 |
+
'onclick' => 'saveAndContinueEdit()',
|
19 |
+
'class' => 'save',
|
20 |
+
), -100);
|
21 |
+
|
22 |
+
$this->_formScripts[] = "
|
23 |
+
function toggleEditor() {
|
24 |
+
if (tinyMCE.getInstanceById('attribute_content') == null) {
|
25 |
+
tinyMCE.execCommand('mceAddControl', false, 'attribute_content');
|
26 |
+
} else {
|
27 |
+
tinyMCE.execCommand('mceRemoveControl', false, 'attribute_content');
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
function saveAndContinueEdit(){
|
32 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
33 |
+
}
|
34 |
+
";
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getHeaderText()
|
38 |
+
{
|
39 |
+
if( Mage::registry('attribute_data') && Mage::registry('attribute_data')->getId() ) {
|
40 |
+
return Mage::helper('scenescene7')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('attribute_data')->getTitle()));
|
41 |
+
} else {
|
42 |
+
return Mage::helper('scenescene7')->__('Add Item');
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
app/code/local/Achang/Scene7/Block/Adminhtml/Attribute/Edit/Form.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Achang_Scene7_Block_Adminhtml_Attribute_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
protected function _prepareForm()
|
6 |
+
{
|
7 |
+
$form = new Varien_Data_Form(array(
|
8 |
+
'id' => 'edit_form',
|
9 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
10 |
+
'method' => 'post',
|
11 |
+
'enctype' => 'multipart/form-data'
|
12 |
+
)
|
13 |
+
);
|
14 |
+
|
15 |
+
$form->setUseContainer(true);
|
16 |
+
$this->setForm($form);
|
17 |
+
return parent::_prepareForm();
|
18 |
+
}
|
19 |
+
}
|
app/code/local/Achang/Scene7/Block/Adminhtml/Attribute/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Achang_Scene7_Block_Adminhtml_Attribute_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
protected function _prepareForm()
|
6 |
+
{
|
7 |
+
$form = new Varien_Data_Form();
|
8 |
+
$this->setForm($form);
|
9 |
+
$fieldset = $form->addFieldset('attribute_form', array('legend'=>Mage::helper('scenescene7')->__('Item information')));
|
10 |
+
|
11 |
+
$fieldset->addField('title', 'text', array(
|
12 |
+
'label' => Mage::helper('scenescene7')->__('Title'),
|
13 |
+
'class' => 'required-entry',
|
14 |
+
'required' => true,
|
15 |
+
'name' => 'title',
|
16 |
+
));
|
17 |
+
|
18 |
+
$fieldset->addField('scene7_code', 'text', array(
|
19 |
+
'label' => Mage::helper('scenescene7')->__('Scene7 Code'),
|
20 |
+
'class' => 'required-entry',
|
21 |
+
'required' => true,
|
22 |
+
'name' => 'scene7_code',
|
23 |
+
));
|
24 |
+
|
25 |
+
$fieldset->addField('attribute_code', 'text', array(
|
26 |
+
'label' => Mage::helper('scenescene7')->__('Attribute Code'),
|
27 |
+
'class' => 'required-entry',
|
28 |
+
'required' => true,
|
29 |
+
'name' => 'attribute_code',
|
30 |
+
));
|
31 |
+
|
32 |
+
|
33 |
+
$fieldset->addField('type', 'select', array(
|
34 |
+
'label' => Mage::helper('scenescene7')->__('Attribute Type'),
|
35 |
+
'name' => 'type',
|
36 |
+
'values' => array(
|
37 |
+
array(
|
38 |
+
'value' => Achang_Scene7_Model_Status::SCENE7TEXT,
|
39 |
+
'label' => Mage::helper('scenescene7')->__('Scene7 Text'),
|
40 |
+
),
|
41 |
+
|
42 |
+
array(
|
43 |
+
'value' => Achang_Scene7_Model_Status::SCENE7SELECT,
|
44 |
+
'label' => Mage::helper('scenescene7')->__('Scene7 Select'),
|
45 |
+
),
|
46 |
+
),
|
47 |
+
));
|
48 |
+
|
49 |
+
if ( Mage::getSingleton('adminhtml/session')->getAttributeData() )
|
50 |
+
{
|
51 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getAttributeData());
|
52 |
+
Mage::getSingleton('adminhtml/session')->setAttributeData(null);
|
53 |
+
} elseif ( Mage::registry('attribute_data') ) {
|
54 |
+
$form->setValues(Mage::registry('attribute_data')->getData());
|
55 |
+
}
|
56 |
+
return parent::_prepareForm();
|
57 |
+
}
|
58 |
+
}
|
app/code/local/Achang/Scene7/Block/Adminhtml/Attribute/Edit/Tabs.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Achang_Scene7_Block_Adminhtml_Attribute_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId('attribute_tabs');
|
10 |
+
$this->setDestElementId('edit_form');
|
11 |
+
$this->setTitle(Mage::helper('scenescene7')->__('Item Information'));
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _beforeToHtml()
|
15 |
+
{
|
16 |
+
$this->addTab('form_section', array(
|
17 |
+
'label' => Mage::helper('scenescene7')->__('Item Information'),
|
18 |
+
'title' => Mage::helper('scenescene7')->__('Item Information'),
|
19 |
+
'content' => $this->getLayout()->createBlock('scenescene7/adminhtml_attribute_edit_tab_form')->toHtml(),
|
20 |
+
));
|
21 |
+
|
22 |
+
return parent::_beforeToHtml();
|
23 |
+
}
|
24 |
+
}
|
app/code/local/Achang/Scene7/Block/Adminhtml/Attribute/Grid.php
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Achang_Scene7_Block_Adminhtml_Attribute_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('attributeGrid');
|
9 |
+
$this->setDefaultSort('attribute_id');
|
10 |
+
$this->setDefaultDir('ASC');
|
11 |
+
$this->setSaveParametersInSession(true);
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _prepareCollection()
|
15 |
+
{
|
16 |
+
$collection = Mage::getModel('scenescene7/attribute')->getCollection();
|
17 |
+
$this->setCollection($collection);
|
18 |
+
return parent::_prepareCollection();
|
19 |
+
}
|
20 |
+
|
21 |
+
protected function _prepareColumns()
|
22 |
+
{
|
23 |
+
$this->addColumn('attribute_id', array(
|
24 |
+
'header' => Mage::helper('scenescene7')->__('ID'),
|
25 |
+
'align' =>'right',
|
26 |
+
'width' => '50px',
|
27 |
+
'index' => 'attribute_id',
|
28 |
+
));
|
29 |
+
|
30 |
+
$this->addColumn('title', array(
|
31 |
+
'header' => Mage::helper('scenescene7')->__('Title'),
|
32 |
+
'align' =>'left',
|
33 |
+
'index' => 'title',
|
34 |
+
));
|
35 |
+
|
36 |
+
$this->addColumn('scene7_code', array(
|
37 |
+
'header' => Mage::helper('scenescene7')->__('Scene7 Code'),
|
38 |
+
'align' =>'left',
|
39 |
+
'index' => 'scene7_code',
|
40 |
+
));
|
41 |
+
|
42 |
+
$this->addColumn('attribute_code', array(
|
43 |
+
'header' => Mage::helper('scenescene7')->__('Attribute Code'),
|
44 |
+
'align' =>'left',
|
45 |
+
'index' => 'attribute_code',
|
46 |
+
));
|
47 |
+
|
48 |
+
$this->addColumn('type', array(
|
49 |
+
'header' => Mage::helper('scenescene7')->__('Attribute Type'),
|
50 |
+
'align' => 'left',
|
51 |
+
'width' => '80px',
|
52 |
+
'index' => 'type',
|
53 |
+
'type' => 'options',
|
54 |
+
'options' => array(
|
55 |
+
Achang_Scene7_Model_Status::SCENE7TEXT => Mage::helper('scenescene7')->__('Scene7 Text'),
|
56 |
+
Achang_Scene7_Model_Status::SCENE7SELECT => Mage::helper('scenescene7')->__('Scene7 Select'),
|
57 |
+
),
|
58 |
+
));
|
59 |
+
|
60 |
+
$this->addColumn('action',
|
61 |
+
array(
|
62 |
+
'header' => Mage::helper('scenescene7')->__('Action'),
|
63 |
+
'width' => '100',
|
64 |
+
'type' => 'action',
|
65 |
+
'getter' => 'getId',
|
66 |
+
'actions' => array(
|
67 |
+
array(
|
68 |
+
'caption' => Mage::helper('scenescene7')->__('Edit'),
|
69 |
+
'url' => array('base'=> '*/*/edit'),
|
70 |
+
'field' => 'id'
|
71 |
+
)
|
72 |
+
),
|
73 |
+
'filter' => false,
|
74 |
+
'sortable' => false,
|
75 |
+
'index' => 'stores',
|
76 |
+
'is_system' => true,
|
77 |
+
));
|
78 |
+
|
79 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('scenescene7')->__('CSV'));
|
80 |
+
$this->addExportType('*/*/exportXml', Mage::helper('scenescene7')->__('XML'));
|
81 |
+
|
82 |
+
return parent::_prepareColumns();
|
83 |
+
}
|
84 |
+
|
85 |
+
protected function _prepareMassaction()
|
86 |
+
{
|
87 |
+
$this->setMassactionIdField('attribute_id');
|
88 |
+
$this->getMassactionBlock()->setFormFieldName('scenescene7attribute');
|
89 |
+
|
90 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
91 |
+
'label' => Mage::helper('scenescene7')->__('Delete'),
|
92 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
93 |
+
'confirm' => Mage::helper('scenescene7')->__('Are you sure?')
|
94 |
+
));
|
95 |
+
|
96 |
+
$statuses = Mage::getSingleton('scenescene7/status')->getOptionArray();
|
97 |
+
|
98 |
+
array_unshift($statuses, array('label'=>'', 'value'=>''));
|
99 |
+
$this->getMassactionBlock()->addItem('status', array(
|
100 |
+
'label'=> Mage::helper('scenescene7')->__('Change status'),
|
101 |
+
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
102 |
+
'additional' => array(
|
103 |
+
'visibility' => array(
|
104 |
+
'name' => 'status',
|
105 |
+
'type' => 'select',
|
106 |
+
'class' => 'required-entry',
|
107 |
+
'label' => Mage::helper('scenescene7')->__('Status'),
|
108 |
+
'values' => $statuses
|
109 |
+
)
|
110 |
+
)
|
111 |
+
));
|
112 |
+
return $this;
|
113 |
+
}
|
114 |
+
|
115 |
+
public function getRowUrl($row)
|
116 |
+
{
|
117 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
118 |
+
}
|
119 |
+
|
120 |
+
}
|
app/code/local/Achang/Scene7/Block/Adminhtml/Catalog/Product/Edit/Tab/Options/Option.php
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* customers defined options
|
4 |
+
*
|
5 |
+
* @category Aijko
|
6 |
+
* @package Aijko_CustomOptionDescription
|
7 |
+
* @author Gerrit Pechmann <gp@aijko.de>
|
8 |
+
* @copyright Copyright (c) 2012, aijko GmbH (http://www.aijko.de)
|
9 |
+
*/
|
10 |
+
class Achang_Scene7_Block_Adminhtml_Catalog_Product_Edit_Tab_Options_Option extends Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Option
|
11 |
+
{
|
12 |
+
|
13 |
+
|
14 |
+
public function __construct()
|
15 |
+
{
|
16 |
+
parent::__construct();
|
17 |
+
$this->setTemplate('scene7/catalog/product/edit/options/option.phtml');
|
18 |
+
}
|
19 |
+
|
20 |
+
public function getTemplatesHtml()
|
21 |
+
{
|
22 |
+
$templates = $this->getChildHtml('text_option_type') . "\n" .
|
23 |
+
$this->getChildHtml('file_option_type') . "\n" .
|
24 |
+
$this->getChildHtml('select_option_type') . "\n" .
|
25 |
+
$this->getChildHtml('date_option_type');
|
26 |
+
$scene7groups = Achang_Scene7_Model_System_Config_Source_Product_Options_Type::getScene7OptionGroups();
|
27 |
+
|
28 |
+
foreach($scene7groups as $k =>$v){
|
29 |
+
$templates .= $this->getChildHtml($k.'_option_type'). "\n" ;
|
30 |
+
}
|
31 |
+
|
32 |
+
return $templates;
|
33 |
+
}
|
34 |
+
|
35 |
+
public function getScene7OptionGroupsJson(){
|
36 |
+
$scene7groups = Achang_Scene7_Model_System_Config_Source_Product_Options_Type::getScene7OptionGroups();
|
37 |
+
echo Zend_Json::encode($scene7groups);
|
38 |
+
}
|
39 |
+
|
40 |
+
public function getScene7OptionGroupsTypeJson(){
|
41 |
+
$scene7groups = Achang_Scene7_Model_System_Config_Source_Product_Options_Type::getScene7OptionGroups();
|
42 |
+
echo Zend_Json::encode(array_keys($scene7groups));
|
43 |
+
}
|
44 |
+
|
45 |
+
protected function _prepareLayout()
|
46 |
+
{
|
47 |
+
$this->setChild('delete_button',
|
48 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
49 |
+
->setData(array(
|
50 |
+
'label' => Mage::helper('catalog')->__('Delete Option'),
|
51 |
+
'class' => 'delete delete-product-option '
|
52 |
+
))
|
53 |
+
);
|
54 |
+
|
55 |
+
$path = 'global/catalog/product/options/custom/groups';
|
56 |
+
|
57 |
+
foreach (Mage::getConfig()->getNode($path)->children() as $group) {
|
58 |
+
$this->setChild($group->getName() . '_option_type',
|
59 |
+
$this->getLayout()->createBlock(
|
60 |
+
(string) Mage::getConfig()->getNode($path . '/' . $group->getName() . '/render')
|
61 |
+
)
|
62 |
+
);
|
63 |
+
// echo (string) Mage::getConfig()->getNode($path . '/' . $group->getName() . '/render').'<br>';
|
64 |
+
// echo (string) $group->getName() . '_option_type'.'<br>';
|
65 |
+
}
|
66 |
+
|
67 |
+
$scene7groups = Achang_Scene7_Model_System_Config_Source_Product_Options_Type::getScene7OptionGroups();
|
68 |
+
|
69 |
+
foreach($scene7groups as $k =>$v){
|
70 |
+
$this->setChild($k . '_option_type',
|
71 |
+
$this->getLayout()->createBlock($v['render'])
|
72 |
+
);
|
73 |
+
}
|
74 |
+
|
75 |
+
return Mage_Core_Block_Abstract::_prepareLayout();
|
76 |
+
}
|
77 |
+
|
78 |
+
public function getOptionValues()
|
79 |
+
{
|
80 |
+
$optionsArr = array_reverse($this->getProduct()->getOptions(), true);
|
81 |
+
|
82 |
+
if (!$this->_values) {
|
83 |
+
$values = array();
|
84 |
+
$scope = (int) Mage::app()->getStore()->getConfig(Mage_Core_Model_Store::XML_PATH_PRICE_SCOPE);
|
85 |
+
foreach ($optionsArr as $option) {
|
86 |
+
/* @var $option Aijko_CustomOptionDescription_Model_Catalog_Product_Option */
|
87 |
+
|
88 |
+
$this->setItemCount($option->getOptionId());
|
89 |
+
|
90 |
+
$value = array();
|
91 |
+
|
92 |
+
$value['id'] = $option->getOptionId();
|
93 |
+
$value['item_count'] = $this->getItemCount();
|
94 |
+
$value['option_id'] = $option->getOptionId();
|
95 |
+
$value['title'] = $this->escapeHtml($option->getTitle());
|
96 |
+
$value['description'] = $this->escapeHtml($option->getDescription());
|
97 |
+
$value['type'] = $option->getType();
|
98 |
+
$value['is_require'] = $option->getIsRequire();
|
99 |
+
$value['sort_order'] = $option->getSortOrder();
|
100 |
+
|
101 |
+
if ($this->getProduct()->getStoreId() != '0') {
|
102 |
+
$value['checkboxScopeTitle'] = $this->getCheckboxScopeHtml($option->getOptionId(), 'title', is_null($option->getStoreTitle()));
|
103 |
+
$value['scopeTitleDisabled'] = is_null($option->getStoreTitle())?'disabled':null;
|
104 |
+
|
105 |
+
$value['checkboxScopeDescription'] = $this->getCheckboxScopeHtml($option->getOptionId(), 'description', is_null($option->getStoreDescription()));
|
106 |
+
$value['scopeDescriptionDisabled'] = is_null($option->getStoreDescription())?'disabled':null;
|
107 |
+
}
|
108 |
+
|
109 |
+
if ($option->getGroupByType() == Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT || $option->getGroupByType() == Achang_Scene7_Model_Catalog_Product_Option::OPTION_GROUP_SCENE7SELECT) {
|
110 |
+
|
111 |
+
$i = 0;
|
112 |
+
$itemCount = 0;
|
113 |
+
foreach ($option->getValues() as $_value) {
|
114 |
+
/* @var $_value Mage_Catalog_Model_Product_Option_Value */
|
115 |
+
$value['optionValues'][$i] = array(
|
116 |
+
'item_count' => max($itemCount, $_value->getOptionTypeId()),
|
117 |
+
'option_id' => $_value->getOptionId(),
|
118 |
+
'option_type_id' => $_value->getOptionTypeId(),
|
119 |
+
'title' => $this->escapeHtml($_value->getTitle()),
|
120 |
+
'price' => $this->getPriceValue($_value->getPrice(), $_value->getPriceType()),
|
121 |
+
'price_type' => $_value->getPriceType(),
|
122 |
+
'sku' => $this->escapeHtml($_value->getSku()),
|
123 |
+
'scene7_code' => $this->escapeHtml($_value->getScene7Code()),
|
124 |
+
'is_default' => $_value->getIsDefault(),
|
125 |
+
'sort_order' => $_value->getSortOrder(),
|
126 |
+
);
|
127 |
+
|
128 |
+
if ($this->getProduct()->getStoreId() != '0') {
|
129 |
+
$value['optionValues'][$i]['checkboxScopeTitle'] = $this->getCheckboxScopeHtml($_value->getOptionId(), 'title', is_null($_value->getStoreTitle()), $_value->getOptionTypeId());
|
130 |
+
$value['optionValues'][$i]['scopeTitleDisabled'] = is_null($_value->getStoreTitle())?'disabled':null;
|
131 |
+
if ($scope == Mage_Core_Model_Store::PRICE_SCOPE_WEBSITE) {
|
132 |
+
$value['optionValues'][$i]['checkboxScopePrice'] = $this->getCheckboxScopeHtml($_value->getOptionId(), 'price', is_null($_value->getstorePrice()), $_value->getOptionTypeId());
|
133 |
+
$value['optionValues'][$i]['scopePriceDisabled'] = is_null($_value->getStorePrice())?'disabled':null;
|
134 |
+
}
|
135 |
+
}
|
136 |
+
$i++;
|
137 |
+
}
|
138 |
+
} else {
|
139 |
+
$value['price'] = $this->getPriceValue($option->getPrice(), $option->getPriceType());
|
140 |
+
$value['price_type'] = $option->getPriceType();
|
141 |
+
$value['sku'] = $this->escapeHtml($option->getSku());
|
142 |
+
$value['max_characters'] = $option->getMaxCharacters();
|
143 |
+
$value['file_extension'] = $option->getFileExtension();
|
144 |
+
$value['image_size_x'] = $option->getImageSizeX();
|
145 |
+
$value['image_size_y'] = $option->getImageSizeY();
|
146 |
+
if ($this->getProduct()->getStoreId() != '0' && $scope == Mage_Core_Model_Store::PRICE_SCOPE_WEBSITE) {
|
147 |
+
$value['checkboxScopePrice'] = $this->getCheckboxScopeHtml($option->getOptionId(), 'price', is_null($option->getStorePrice()));
|
148 |
+
$value['scopePriceDisabled'] = is_null($option->getStorePrice())?'disabled':null;
|
149 |
+
}
|
150 |
+
}
|
151 |
+
$values[] = new Varien_Object($value);
|
152 |
+
}
|
153 |
+
$this->_values = $values;
|
154 |
+
}
|
155 |
+
|
156 |
+
return $this->_values;
|
157 |
+
}
|
158 |
+
}
|
app/code/local/Achang/Scene7/Block/Adminhtml/Catalog/Product/Edit/Tab/Options/Type/Select.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Adminhtml
|
23 |
+
* @copyright Copyright (c) 2010 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 |
+
* customers defined options
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Adminhtml
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
|
35 |
+
class Achang_Scene7_Block_Adminhtml_Catalog_Product_Edit_Tab_Options_Type_Select extends
|
36 |
+
Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Type_Abstract
|
37 |
+
{
|
38 |
+
public function __construct()
|
39 |
+
{
|
40 |
+
parent::__construct();
|
41 |
+
$this->setTemplate('scene7/catalog/product/edit/options/type/select.phtml');
|
42 |
+
}
|
43 |
+
|
44 |
+
protected function _prepareLayout()
|
45 |
+
{
|
46 |
+
$this->setChild('add_scene7select_row_button',
|
47 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
48 |
+
->setData(array(
|
49 |
+
'label' => Mage::helper('catalog')->__('Add New Scene7 Option'),
|
50 |
+
'class' => 'add add-scene7select-row',
|
51 |
+
'id' => 'add_scene7select_row_button_{{option_id}}',
|
52 |
+
))
|
53 |
+
);
|
54 |
+
|
55 |
+
$this->setChild('delete_scene7select_row_button',
|
56 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
57 |
+
->setData(array(
|
58 |
+
'label' => Mage::helper('catalog')->__('Delete Row'),
|
59 |
+
'class' => 'delete delete-scene7select-row icon-btn',
|
60 |
+
))
|
61 |
+
);
|
62 |
+
|
63 |
+
return parent::_prepareLayout();
|
64 |
+
}
|
65 |
+
|
66 |
+
public function getAddButtonHtml()
|
67 |
+
{
|
68 |
+
return $this->getChildHtml('add_scene7select_row_button');
|
69 |
+
}
|
70 |
+
|
71 |
+
public function getDeleteButtonHtml()
|
72 |
+
{
|
73 |
+
return $this->getChildHtml('delete_scene7select_row_button');
|
74 |
+
}
|
75 |
+
|
76 |
+
public function getPriceTypeSelectHtml()
|
77 |
+
{
|
78 |
+
$this->getChild('option_price_type')
|
79 |
+
->setData('id', 'product_option_{{id}}_select_{{select_id}}_price_type')
|
80 |
+
->setName('product[options][{{id}}][values][{{select_id}}][price_type]');
|
81 |
+
|
82 |
+
return parent::getPriceTypeSelectHtml();
|
83 |
+
}
|
84 |
+
}
|
app/code/local/Achang/Scene7/Block/Cart/Item/Renderer/Scene7.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Achang_Scene7_Block_Cart_Item_Renderer_Scene7 extends Mage_Checkout_Block_Cart_Item_Renderer
|
4 |
+
{
|
5 |
+
public function getOptionList()
|
6 |
+
{
|
7 |
+
return array_merge($this->_getMgbOptions(), parent::getOptionList());
|
8 |
+
}
|
9 |
+
|
10 |
+
protected function _getMgbOptions($useCache = true)
|
11 |
+
{
|
12 |
+
$product = $this->getProduct();
|
13 |
+
$src_option = $product->getCustomOption('src_option');
|
14 |
+
if($src_option){
|
15 |
+
$options = array();
|
16 |
+
$this->_addSimpleOptions($options, $product,$src_option->getValue());
|
17 |
+
return $options;
|
18 |
+
}else{
|
19 |
+
return array();
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
protected function _addSimpleOptions(&$options,$product, $src_option = '') {
|
24 |
+
if($src_option){
|
25 |
+
$option = array('label' => 'Personalized Image');
|
26 |
+
$option['value'][] = "<img width='100' src='{$src_option}'>";
|
27 |
+
$options[] = $option;
|
28 |
+
}
|
29 |
+
}
|
30 |
+
}
|
app/code/local/Achang/Scene7/Block/Product/View/Options.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Achang_Scene7_Block_Product_View_Options extends Mage_Catalog_Block_Product_View_Options
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->addOptionRenderer(
|
9 |
+
Achang_Scene7_Model_Catalog_Product_Option::OPTION_GROUP_SCENE7SELECT,
|
10 |
+
'scenescene7/product_view_options_type_scene7select',
|
11 |
+
'scene7/catalog/product/view/options/type/scene7select.phtml'
|
12 |
+
);
|
13 |
+
|
14 |
+
$this->addOptionRenderer(
|
15 |
+
Achang_Scene7_Model_Catalog_Product_Option::OPTION_GROUP_SCENE7TEXT,
|
16 |
+
'scenescene7/catalog/product_view_options_type_scene7text',
|
17 |
+
'scene7/catalog/product/view/options/type/scene7text.phtml'
|
18 |
+
);
|
19 |
+
}
|
20 |
+
|
21 |
+
public function getJsonConfig()
|
22 |
+
{
|
23 |
+
$config = array();
|
24 |
+
|
25 |
+
foreach ($this->getOptions() as $option) {
|
26 |
+
/* @var $option Mage_Catalog_Model_Product_Option */
|
27 |
+
$priceValue = 0;
|
28 |
+
if ($option->getGroupByType() == Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT || $option->getGroupByType() == Achang_Scene7_Model_Catalog_Product_Option::OPTION_GROUP_SCENE7SELECT) {
|
29 |
+
$_tmpPriceValues = array();
|
30 |
+
foreach ($option->getValues() as $value) {
|
31 |
+
/* @var $value Mage_Catalog_Model_Product_Option_Value */
|
32 |
+
$_tmpPriceValues[$value->getId()] = Mage::helper('core')->currency($value->getPrice(true), false, false);
|
33 |
+
}
|
34 |
+
$priceValue = $_tmpPriceValues;
|
35 |
+
} else {
|
36 |
+
$priceValue = Mage::helper('core')->currency($option->getPrice(true), false, false);
|
37 |
+
}
|
38 |
+
$config[$option->getId()] = $priceValue;
|
39 |
+
}
|
40 |
+
|
41 |
+
return Mage::helper('core')->jsonEncode($config);
|
42 |
+
}
|
43 |
+
|
44 |
+
public function getScene7AttributeJsonConfig()
|
45 |
+
{
|
46 |
+
$config = array();
|
47 |
+
foreach ($this->getOptions() as $option) {
|
48 |
+
if ($option->getGroupByType() == Achang_Scene7_Model_Catalog_Product_Option::OPTION_GROUP_SCENE7SELECT) {
|
49 |
+
$values = Mage::getModel('catalog/product_option_value')->getCollection()
|
50 |
+
->addScene7DetailToResult(Mage::app()->getStore()->getId())
|
51 |
+
->addOptionToFilter(array($option->getId()));
|
52 |
+
foreach ($values as $value) {
|
53 |
+
$config[$option->getId()][$value->getId()] = array('sku'=>$value->getSku(),'scene7_code'=>$value->getScene7Code(),'is_default'=>$value->getIsDefault());
|
54 |
+
}
|
55 |
+
} else if($option->getGroupByType() == Achang_Scene7_Model_Catalog_Product_Option::OPTION_GROUP_SCENE7TEXT){
|
56 |
+
$config[$option->getId()] = array('sku'=>$value->getSku());
|
57 |
+
}
|
58 |
+
}
|
59 |
+
return Mage::helper('core')->jsonEncode($config);
|
60 |
+
}
|
61 |
+
}
|
app/code/local/Achang/Scene7/Block/Product/View/Options/Type/Scene7select.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Product options text type block
|
4 |
+
*
|
5 |
+
* @category Mage
|
6 |
+
* @package Mage_Catalog
|
7 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
8 |
+
*/
|
9 |
+
class Achang_Scene7_Block_Product_View_Options_Type_Scene7select
|
10 |
+
extends Mage_Catalog_Block_Product_View_Options_Abstract
|
11 |
+
{
|
12 |
+
|
13 |
+
public function getValuesHtml()
|
14 |
+
{
|
15 |
+
$_option = $this->getOption();
|
16 |
+
|
17 |
+
if (Mage::getSingleton('catalog/product_option')->getGroupByType($_option->getType()) == Achang_Scene7_Model_Catalog_Product_Option::OPTION_GROUP_SCENE7SELECT) {
|
18 |
+
$require = ($_option->getIsRequire()) ? ' required-entry' : '';
|
19 |
+
$extraParams = '';
|
20 |
+
$select = $this->getLayout()->createBlock('core/html_select')
|
21 |
+
->setData(array(
|
22 |
+
'id' => 'select_'.$_option->getId(),
|
23 |
+
'class' => $require.' product-custom-option'
|
24 |
+
));
|
25 |
+
if (Mage::getSingleton('catalog/product_option')->getGroupByType($_option->getType()) == Achang_Scene7_Model_Catalog_Product_Option::OPTION_GROUP_SCENE7SELECT) {
|
26 |
+
$select->setName('options['.$_option->getid().']')
|
27 |
+
->addOption('', $this->__('-- Please Select --'));
|
28 |
+
} else {
|
29 |
+
$select->setName('options['.$_option->getid().'][]');
|
30 |
+
$select->setClass('multiselect'.$require.' product-custom-option');
|
31 |
+
}
|
32 |
+
foreach ($_option->getValues() as $_value) {
|
33 |
+
$priceStr = $this->_formatPrice(array(
|
34 |
+
'is_percent' => ($_value->getPriceType() == 'percent') ? true : false,
|
35 |
+
'pricing_value' => $_value->getPrice(true)
|
36 |
+
), false);
|
37 |
+
$select->addOption(
|
38 |
+
$_value->getOptionTypeId(),
|
39 |
+
$_value->getTitle() . ' ' . $priceStr . ''
|
40 |
+
);
|
41 |
+
}
|
42 |
+
// if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_MULTIPLE) {
|
43 |
+
// $extraParams = ' multiple="multiple"';
|
44 |
+
// }
|
45 |
+
$select->setExtraParams('onchange="opConfig.reloadPrice()"'.$extraParams);
|
46 |
+
|
47 |
+
return $select->getHtml();
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
}
|
app/code/local/Achang/Scene7/Block/Product/View/Options/Type/Scene7text.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Product options text type block
|
4 |
+
*
|
5 |
+
* @category Mage
|
6 |
+
* @package Mage_Catalog
|
7 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
8 |
+
*/
|
9 |
+
class Achang_Scene7_Block_Product_View_Options_Type_Scene7text
|
10 |
+
extends Mage_Catalog_Block_Product_View_Options_Abstract
|
11 |
+
{
|
12 |
+
|
13 |
+
}
|
app/code/local/Achang/Scene7/Block/Sales/Order/Item/Renderer/Default.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Achang_Scene7_Block_Sales_Order_Item_Renderer_Default extends Mage_Sales_Block_Order_Item_Renderer_Default
|
3 |
+
{
|
4 |
+
public function getFormatedOptionValue($optionValue)
|
5 |
+
{
|
6 |
+
$optionInfo = array();
|
7 |
+
|
8 |
+
// define input data format
|
9 |
+
if (is_array($optionValue)) {
|
10 |
+
if (isset($optionValue['option_id'])) {
|
11 |
+
$optionInfo = $optionValue;
|
12 |
+
if (isset($optionInfo['value'])) {
|
13 |
+
$optionValue = $optionInfo['value'];
|
14 |
+
}
|
15 |
+
} elseif (isset($optionValue['value'])) {
|
16 |
+
$optionInfo = $optionValue;//added by minglong
|
17 |
+
$optionValue = $optionValue['value'];
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
// render customized option view
|
22 |
+
if (isset($optionInfo['custom_view']) && $optionInfo['custom_view']) {
|
23 |
+
$_default = array('value' => $optionValue);
|
24 |
+
if (isset($optionInfo['option_type'])) {
|
25 |
+
try {
|
26 |
+
$group = Mage::getModel('catalog/product_option')->groupFactory($optionInfo['option_type']);
|
27 |
+
return array('value' => $group->getCustomizedView($optionInfo));
|
28 |
+
} catch (Exception $e) {
|
29 |
+
return $_default;
|
30 |
+
}
|
31 |
+
}
|
32 |
+
return $_default;
|
33 |
+
}
|
34 |
+
|
35 |
+
// truncate standard view
|
36 |
+
$result = array();
|
37 |
+
if (is_array($optionValue)) {
|
38 |
+
$_truncatedValue = implode("\n", $optionValue);
|
39 |
+
$_truncatedValue = nl2br($_truncatedValue);
|
40 |
+
return array('value' => $_truncatedValue);
|
41 |
+
} else {
|
42 |
+
$_truncatedValue = Mage::helper('core/string')->truncate($optionValue, 55, '');
|
43 |
+
$_truncatedValue = nl2br($_truncatedValue);
|
44 |
+
}
|
45 |
+
|
46 |
+
$result = array('value' => $_truncatedValue);
|
47 |
+
|
48 |
+
if (Mage::helper('core/string')->strlen($optionValue) > 55) {
|
49 |
+
$result['value'] = $result['value'] . ' <a href="#" class="dots" onclick="return false">...</a>';
|
50 |
+
$optionValue = nl2br($optionValue);
|
51 |
+
$result = array_merge($result, array('full_view' => $optionValue));
|
52 |
+
}
|
53 |
+
|
54 |
+
return $result;
|
55 |
+
}
|
56 |
+
}
|
app/code/local/Achang/Scene7/Helper/Data.php
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Achang_Scene7_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
public function createAttributeSet($setName, $copyGroupsFromID = -1)
|
5 |
+
{
|
6 |
+
|
7 |
+
$setName = trim($setName);
|
8 |
+
|
9 |
+
|
10 |
+
if($setName == '')
|
11 |
+
{
|
12 |
+
$this->logError("Could not create attribute set with an empty name.");
|
13 |
+
return false;
|
14 |
+
}
|
15 |
+
|
16 |
+
//>>>> Create an incomplete version of the desired set.
|
17 |
+
|
18 |
+
$model = Mage::getModel('eav/entity_attribute_set');
|
19 |
+
|
20 |
+
// Set the entity type.
|
21 |
+
|
22 |
+
$entityTypeID = Mage::getModel('catalog/product')->getResource()->getTypeId();
|
23 |
+
|
24 |
+
$model->setEntityTypeId($entityTypeID);
|
25 |
+
|
26 |
+
// We don't currently support groups, or more than one level. See
|
27 |
+
// Mage_Adminhtml_Catalog_Product_SetController::saveAction().
|
28 |
+
|
29 |
+
|
30 |
+
$model->setAttributeSetName($setName);
|
31 |
+
|
32 |
+
// We suspect that this isn't really necessary since we're just
|
33 |
+
// initializing new sets with a name and nothing else, but we do
|
34 |
+
// this for the purpose of completeness, and of prevention if we
|
35 |
+
// should expand in the future.
|
36 |
+
$model->validate();
|
37 |
+
|
38 |
+
// Create the record.
|
39 |
+
|
40 |
+
try
|
41 |
+
{
|
42 |
+
$model->save();
|
43 |
+
}
|
44 |
+
catch(Exception $ex)
|
45 |
+
{
|
46 |
+
return false;
|
47 |
+
}
|
48 |
+
|
49 |
+
if(($id = $model->getId()) == false)
|
50 |
+
{
|
51 |
+
return false;
|
52 |
+
}
|
53 |
+
|
54 |
+
|
55 |
+
//<<<<
|
56 |
+
|
57 |
+
//>>>> Load the new set with groups (mandatory).
|
58 |
+
|
59 |
+
// Attach the same groups from the given set-ID to the new set.
|
60 |
+
if($copyGroupsFromID !== -1)
|
61 |
+
{
|
62 |
+
|
63 |
+
$model->initFromSkeleton($copyGroupsFromID);
|
64 |
+
}
|
65 |
+
|
66 |
+
// Just add a default group.
|
67 |
+
else
|
68 |
+
{
|
69 |
+
|
70 |
+
$modelGroup = Mage::getModel('eav/entity_attribute_group');
|
71 |
+
$modelGroup->setAttributeGroupName($this->groupName);
|
72 |
+
$modelGroup->setAttributeSetId($id);
|
73 |
+
|
74 |
+
// This is optional, and just a sorting index in the case of
|
75 |
+
// multiple groups.
|
76 |
+
// $modelGroup->setSortOrder(1);
|
77 |
+
|
78 |
+
$model->setGroups(array($modelGroup));
|
79 |
+
}
|
80 |
+
|
81 |
+
//<<<<
|
82 |
+
|
83 |
+
// Save the final version of our set.
|
84 |
+
|
85 |
+
try
|
86 |
+
{
|
87 |
+
$model->save();
|
88 |
+
}
|
89 |
+
catch(Exception $ex)
|
90 |
+
{
|
91 |
+
return false;
|
92 |
+
}
|
93 |
+
}
|
94 |
+
}
|
app/code/local/Achang/Scene7/Model/Attribute.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Achang_Scene7_Model_Attribute extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('scenescene7/attribute');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Achang/Scene7/Model/Catalog/Product/Option.php
ADDED
@@ -0,0 +1,227 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Catalog product option model
|
4 |
+
*
|
5 |
+
* @category Aijko
|
6 |
+
* @package Aijko_CustomOptionDescription
|
7 |
+
* @author Gerrit Pechmann <gp@aijko.de>
|
8 |
+
* @copyright Copyright (c) 2012, aijko GmbH (http://www.aijko.de)
|
9 |
+
*/
|
10 |
+
class Achang_Scene7_Model_Catalog_Product_Option extends Mage_Catalog_Model_Product_Option
|
11 |
+
{
|
12 |
+
const OPTION_GROUP_SCENE7SELECT = 'scene7select';
|
13 |
+
const OPTION_GROUP_SCENE7TEXT = 'scene7text';
|
14 |
+
|
15 |
+
protected function _construct()
|
16 |
+
{
|
17 |
+
$this->_init('scenescene7/product_option');
|
18 |
+
}
|
19 |
+
|
20 |
+
public function getGroupByType($type = null)
|
21 |
+
{
|
22 |
+
if (is_null($type)) {
|
23 |
+
$type = $this->getType();
|
24 |
+
}
|
25 |
+
$optionGroupsToTypes = array(
|
26 |
+
Mage_Catalog_Model_Product_Option::OPTION_TYPE_FIELD => Mage_Catalog_Model_Product_Option::OPTION_GROUP_TEXT,
|
27 |
+
Mage_Catalog_Model_Product_Option::OPTION_TYPE_AREA => Mage_Catalog_Model_Product_Option::OPTION_GROUP_TEXT,
|
28 |
+
Mage_Catalog_Model_Product_Option::OPTION_TYPE_FILE => Mage_Catalog_Model_Product_Option::OPTION_GROUP_FILE,
|
29 |
+
Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN => Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT,
|
30 |
+
Mage_Catalog_Model_Product_Option::OPTION_TYPE_RADIO => Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT,
|
31 |
+
Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX => Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT,
|
32 |
+
Mage_Catalog_Model_Product_Option::OPTION_TYPE_MULTIPLE => Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT,
|
33 |
+
Mage_Catalog_Model_Product_Option::OPTION_TYPE_DATE => Mage_Catalog_Model_Product_Option::OPTION_GROUP_DATE,
|
34 |
+
Mage_Catalog_Model_Product_Option::OPTION_TYPE_DATE_TIME => Mage_Catalog_Model_Product_Option::OPTION_GROUP_DATE,
|
35 |
+
Mage_Catalog_Model_Product_Option::OPTION_TYPE_TIME => Mage_Catalog_Model_Product_Option::OPTION_GROUP_DATE,
|
36 |
+
);
|
37 |
+
|
38 |
+
$scene7groups = Achang_Scene7_Model_System_Config_Source_Product_Options_Type::getScene7OptionGroups();
|
39 |
+
|
40 |
+
foreach($scene7groups as $k =>$v){
|
41 |
+
if(is_array($v['types'])){
|
42 |
+
foreach($v['types'] as $k1=>$v1){
|
43 |
+
if($v1['value'] == $type){
|
44 |
+
return $k;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
return isset($optionGroupsToTypes[$type])?$optionGroupsToTypes[$type]:'';
|
51 |
+
}
|
52 |
+
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Save options.
|
56 |
+
*
|
57 |
+
* @return Mage_Catalog_Model_Product_Option
|
58 |
+
*/
|
59 |
+
public function saveOptions()
|
60 |
+
{
|
61 |
+
foreach ($this->getOptions() as $option) {
|
62 |
+
$this->setData($option)
|
63 |
+
->setData('product_id', $this->getProduct()->getId())
|
64 |
+
->setData('store_id', $this->getProduct()->getStoreId());
|
65 |
+
if ($this->getData('option_id') == '0') {
|
66 |
+
$this->unsetData('option_id');
|
67 |
+
} else {
|
68 |
+
$this->setId($this->getData('option_id'));
|
69 |
+
}
|
70 |
+
$isEdit = (bool)$this->getId()? true:false;
|
71 |
+
|
72 |
+
if ($this->getData('is_delete') == '1') {
|
73 |
+
if ($isEdit) {
|
74 |
+
$this->getValueInstance()->deleteValue($this->getId());
|
75 |
+
$this->deletePrices($this->getId());
|
76 |
+
$this->deleteTitles($this->getId());
|
77 |
+
$this->delete();
|
78 |
+
}
|
79 |
+
} else {
|
80 |
+
if ($this->getData('previous_type') != '') {
|
81 |
+
$previousType = $this->getData('previous_type');
|
82 |
+
//if previous option has dfferent group from one is came now need to remove all data of previous group
|
83 |
+
if ($this->getGroupByType($previousType) != $this->getGroupByType($this->getData('type'))) {
|
84 |
+
|
85 |
+
switch ($this->getGroupByType($previousType)) {
|
86 |
+
case Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT:
|
87 |
+
if($this->getGroupByType($this->getData('type')) != self::OPTION_GROUP_SCENE7SELECT){
|
88 |
+
$this->unsetData('values');
|
89 |
+
if ($isEdit) {
|
90 |
+
$this->getValueInstance()->deleteValue($this->getId());
|
91 |
+
}
|
92 |
+
}else{
|
93 |
+
$values = $this->getData('values');
|
94 |
+
foreach($values as $k=>$value){
|
95 |
+
if($value['option_type_id'] > 0){
|
96 |
+
unset($values[$k]);
|
97 |
+
}
|
98 |
+
}
|
99 |
+
$this->setData('values',$values);
|
100 |
+
if ($isEdit) {
|
101 |
+
$this->getValueInstance()->deleteValue($this->getId());
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
|
106 |
+
break;
|
107 |
+
/**
|
108 |
+
* addedd by Minglong
|
109 |
+
*/
|
110 |
+
case self::OPTION_GROUP_SCENE7SELECT:
|
111 |
+
if($this->getGroupByType($this->getData('type')) != Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT){
|
112 |
+
$this->unsetData('values');
|
113 |
+
if ($isEdit) {
|
114 |
+
$this->getValueInstance()->deleteValue($this->getId());
|
115 |
+
}
|
116 |
+
}else{
|
117 |
+
$values = $this->getData('values');
|
118 |
+
foreach($values as $k=>$value){
|
119 |
+
if($value['option_type_id'] > 0){
|
120 |
+
unset($values[$k]);
|
121 |
+
}
|
122 |
+
}
|
123 |
+
$this->setData('values',$values);
|
124 |
+
if ($isEdit) {
|
125 |
+
$this->getValueInstance()->deleteValue($this->getId());
|
126 |
+
}
|
127 |
+
}
|
128 |
+
|
129 |
+
break;
|
130 |
+
/**
|
131 |
+
* ended by Minglong
|
132 |
+
*/
|
133 |
+
case Mage_Catalog_Model_Product_Option::OPTION_GROUP_FILE:
|
134 |
+
$this->setData('file_extension', '');
|
135 |
+
$this->setData('image_size_x', '0');
|
136 |
+
$this->setData('image_size_y', '0');
|
137 |
+
break;
|
138 |
+
case Mage_Catalog_Model_Product_Option::OPTION_GROUP_TEXT:
|
139 |
+
if($this->getGroupByType($this->getData('type')) != self::OPTION_GROUP_SCENE7TEXT){
|
140 |
+
$this->setData('max_characters', '0');
|
141 |
+
}
|
142 |
+
break;
|
143 |
+
case Mage_Catalog_Model_Product_Option::OPTION_GROUP_DATE:
|
144 |
+
break;
|
145 |
+
case self::OPTION_GROUP_SCENE7TEXT:
|
146 |
+
if($this->getGroupByType($this->getData('type')) != Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT && $this->getGroupByType($this->getData('type')) != self::OPTION_GROUP_SCENE7SELECT){
|
147 |
+
|
148 |
+
}else{
|
149 |
+
|
150 |
+
}
|
151 |
+
break;
|
152 |
+
}
|
153 |
+
if ($this->getGroupByType($this->getData('type')) == Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT || $this->getGroupByType($this->getData('type')) == self::OPTION_GROUP_SCENE7SELECT) {
|
154 |
+
$this->setData('sku', '');
|
155 |
+
$this->unsetData('price');
|
156 |
+
$this->unsetData('price_type');
|
157 |
+
if ($isEdit) {
|
158 |
+
$this->deletePrices($this->getId());
|
159 |
+
}
|
160 |
+
}
|
161 |
+
}
|
162 |
+
}
|
163 |
+
$this->save(); }
|
164 |
+
}//eof foreach()
|
165 |
+
return $this;
|
166 |
+
}
|
167 |
+
|
168 |
+
protected function _afterSave()
|
169 |
+
{
|
170 |
+
$this->getValueInstance()->unsetValues();
|
171 |
+
if (is_array($this->getData('values'))) {
|
172 |
+
foreach ($this->getData('values') as $value) {
|
173 |
+
$this->getValueInstance()->addValue($value);
|
174 |
+
}
|
175 |
+
|
176 |
+
$this->getValueInstance()->setOption($this)
|
177 |
+
->saveValues();
|
178 |
+
} elseif ($this->getGroupByType($this->getType()) == Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT || $this->getGroupByType($this->getType()) == self::OPTION_GROUP_SCENE7SELECT) {
|
179 |
+
Mage::throwException(Mage::helper('catalog')->__('Select type options required values rows.'));
|
180 |
+
}
|
181 |
+
|
182 |
+
Mage_Core_Model_Abstract::_afterSave();
|
183 |
+
}
|
184 |
+
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Get Product Option Collection
|
188 |
+
*
|
189 |
+
* @param Mage_Catalog_Model_Product $product
|
190 |
+
* @return Aijko_CustomOptionDescription_Model_Resource_Eav_Mysql4_Product_Option_Collection
|
191 |
+
*/
|
192 |
+
public function getProductOptionCollection(Mage_Catalog_Model_Product $product)
|
193 |
+
{
|
194 |
+
$collection = $this->getCollection()
|
195 |
+
->addFieldToFilter('product_id', $product->getId())
|
196 |
+
->addTitleToResult($product->getStoreId())
|
197 |
+
->addPriceToResult($product->getStoreId())
|
198 |
+
->addDescriptionToResult($product->getStoreId())
|
199 |
+
->setOrder('sort_order', 'asc')
|
200 |
+
->setOrder('title', 'asc')
|
201 |
+
->addValuesToResult($product->getStoreId());
|
202 |
+
|
203 |
+
return $collection;
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Group model factory
|
208 |
+
*
|
209 |
+
* @param string $type Option type
|
210 |
+
* @return Mage_Catalog_Model_Product_Option_Group_Abstract
|
211 |
+
*/
|
212 |
+
public function groupFactory($type)
|
213 |
+
{
|
214 |
+
$group = $this->getGroupByType($type);
|
215 |
+
if ($group == self::OPTION_GROUP_SCENE7SELECT){
|
216 |
+
return Mage::getModel('scenescene7/catalog_product_option_type_' . $group);
|
217 |
+
}
|
218 |
+
if ($group == self::OPTION_GROUP_SCENE7TEXT){
|
219 |
+
return Mage::getModel('scenescene7/catalog_product_option_type_' . $group);
|
220 |
+
}
|
221 |
+
if (!empty($group)) {
|
222 |
+
return Mage::getModel('catalog/product_option_type_' . $group);
|
223 |
+
}
|
224 |
+
|
225 |
+
Mage::throwException(Mage::helper('catalog')->__('Wrong option type to get group instance.'));
|
226 |
+
}
|
227 |
+
}
|
app/code/local/Achang/Scene7/Model/Catalog/Product/Option/Type/Default.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2010 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 |
+
* Catalog product option default type
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Catalog
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Achang_Scene7_Model_Catalog_Product_Option_Type_Default extends Mage_Catalog_Model_Product_Option_Type_Default
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Return value => key all product options (using for parsing)
|
38 |
+
*
|
39 |
+
* @return array Array of Product custom options, reversing option values and option ids
|
40 |
+
*/
|
41 |
+
public function getProductOptions()
|
42 |
+
{
|
43 |
+
if (!isset($this->_productOptions[$this->getProduct()->getId()])) {
|
44 |
+
foreach ($this->getProduct()->getOptions() as $_option) {
|
45 |
+
/* @var $option Mage_Catalog_Model_Product_Option */
|
46 |
+
$this->_productOptions[$this->getProduct()->getId()][$_option->getTitle()] = array('option_id' => $_option->getId());
|
47 |
+
if ($_option->getGroupByType() == Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT || $_option->getGroupByType() == Achang_Scene7_Model_Catalog_Product_Option::OPTION_GROUP_SCENE7SELECT) {
|
48 |
+
$optionValues = array();
|
49 |
+
foreach ($_option->getValues() as $_value) {
|
50 |
+
/* @var $value Mage_Catalog_Model_Product_Option_Value */
|
51 |
+
$optionValues[$_value->getTitle()] = $_value->getId();
|
52 |
+
}
|
53 |
+
$this->_productOptions[$this->getProduct()->getId()][$_option->getTitle()]['values'] = $optionValues;
|
54 |
+
} else {
|
55 |
+
$this->_productOptions[$this->getProduct()->getId()][$_option->getTitle()]['values'] = array();
|
56 |
+
}
|
57 |
+
}
|
58 |
+
}
|
59 |
+
if (isset($this->_productOptions[$this->getProduct()->getId()])) {
|
60 |
+
return $this->_productOptions[$this->getProduct()->getId()];
|
61 |
+
}
|
62 |
+
return array();
|
63 |
+
}
|
64 |
+
|
65 |
+
}
|
app/code/local/Achang/Scene7/Model/Catalog/Product/Option/Type/Scene7select.php
ADDED
@@ -0,0 +1,306 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2010 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 |
+
* Catalog product option select type
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Catalog
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Achang_Scene7_Model_Catalog_Product_Option_Type_Scene7select extends Achang_Scene7_Model_Catalog_Product_Option_Type_Default
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Validate user input for option
|
38 |
+
*
|
39 |
+
* @throws Mage_Core_Exception
|
40 |
+
* @param array $values All product option values, i.e. array (option_id => mixed, option_id => mixed...)
|
41 |
+
* @return Mage_Catalog_Model_Product_Option_Type_Default
|
42 |
+
*/
|
43 |
+
public function validateUserValue($values)
|
44 |
+
{
|
45 |
+
parent::validateUserValue($values);
|
46 |
+
|
47 |
+
$option = $this->getOption();
|
48 |
+
$value = $this->getUserValue();
|
49 |
+
|
50 |
+
if (empty($value) && $option->getIsRequire() && !$this->getProduct()->getSkipCheckRequiredOption()) {
|
51 |
+
$this->setIsValid(false);
|
52 |
+
Mage::throwException(Mage::helper('catalog')->__('Please specify the product required option(s).'));
|
53 |
+
}
|
54 |
+
if (!$this->_isSingleSelection()) {
|
55 |
+
$valuesCollection = $option->getOptionValuesByOptionId($value, $this->getProduct()->getStoreId())
|
56 |
+
->load();
|
57 |
+
if ($valuesCollection->count() != count($value)) {
|
58 |
+
$this->setIsValid(false);
|
59 |
+
Mage::throwException(Mage::helper('catalog')->__('Please specify the product required option(s).'));
|
60 |
+
}
|
61 |
+
}
|
62 |
+
return $this;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Prepare option value for cart
|
67 |
+
*
|
68 |
+
* @throws Mage_Core_Exception
|
69 |
+
* @return mixed Prepared option value
|
70 |
+
*/
|
71 |
+
public function prepareForCart()
|
72 |
+
{
|
73 |
+
if ($this->getIsValid() && $this->getUserValue()) {
|
74 |
+
return is_array($this->getUserValue()) ? implode(',', $this->getUserValue()) : $this->getUserValue();
|
75 |
+
} else {
|
76 |
+
return null;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Return formatted option value for quote option
|
82 |
+
*
|
83 |
+
* @param string $optionValue Prepared for cart option value
|
84 |
+
* @return string
|
85 |
+
*/
|
86 |
+
public function getFormattedOptionValue($optionValue)
|
87 |
+
{
|
88 |
+
if ($this->_formattedOptionValue === null) {
|
89 |
+
$this->_formattedOptionValue = Mage::helper('core')->htmlEscape(
|
90 |
+
$this->getEditableOptionValue($optionValue)
|
91 |
+
);
|
92 |
+
}
|
93 |
+
return $this->_formattedOptionValue;
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Return printable option value
|
98 |
+
*
|
99 |
+
* @param string $optionValue Prepared for cart option value
|
100 |
+
* @return string
|
101 |
+
*/
|
102 |
+
public function getPrintableOptionValue($optionValue)
|
103 |
+
{
|
104 |
+
return $this->getFormattedOptionValue($optionValue);
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Return formatted option value ready to edit, ready to parse
|
109 |
+
*
|
110 |
+
* @param string $optionValue Prepared for cart option value
|
111 |
+
* @return string
|
112 |
+
*/
|
113 |
+
public function getEditableOptionValue($optionValue)
|
114 |
+
{
|
115 |
+
$option = $this->getOption();
|
116 |
+
$result = '';
|
117 |
+
if (!$this->_isSingleSelection()) {
|
118 |
+
foreach (explode(',', $optionValue) as $_value) {
|
119 |
+
if ($_result = $option->getValueById($_value)) {
|
120 |
+
$result .= $_result->getTitle() . ', ';
|
121 |
+
} else {
|
122 |
+
if ($this->getListener()) {
|
123 |
+
$this->getListener()
|
124 |
+
->setHasError(true)
|
125 |
+
->setMessage(
|
126 |
+
Mage::helper('catalog')->__('Some of the products below do not have all the required options. Please remove them and add again with all the required options.')
|
127 |
+
);
|
128 |
+
$result = '';
|
129 |
+
break;
|
130 |
+
}
|
131 |
+
}
|
132 |
+
}
|
133 |
+
$result = Mage::helper('core/string')->substr($result, 0, -2);
|
134 |
+
} elseif ($this->_isSingleSelection()) {
|
135 |
+
if ($_result = $option->getValueById($optionValue)) {
|
136 |
+
$result = $_result->getTitle();
|
137 |
+
} else {
|
138 |
+
if ($this->getListener()) {
|
139 |
+
$this->getListener()
|
140 |
+
->setHasError(true)
|
141 |
+
->setMessage(
|
142 |
+
Mage::helper('catalog')->__('Some of the products below do not have all the required options. Please remove them and add again with all the required options.')
|
143 |
+
);
|
144 |
+
}
|
145 |
+
$result = '';
|
146 |
+
}
|
147 |
+
} else {
|
148 |
+
$result = $optionValue;
|
149 |
+
}
|
150 |
+
return $result;
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Parse user input value and return cart prepared value, i.e. "one, two" => "1,2"
|
155 |
+
*
|
156 |
+
* @param string $optionValue
|
157 |
+
* @param array $productOptionValues Values for product option
|
158 |
+
* @return string|null
|
159 |
+
*/
|
160 |
+
public function parseOptionValue($optionValue, $productOptionValues)
|
161 |
+
{
|
162 |
+
$_values = array();
|
163 |
+
if (!$this->_isSingleSelection()) {
|
164 |
+
foreach (explode(',', $optionValue) as $_value) {
|
165 |
+
$_value = trim($_value);
|
166 |
+
if (array_key_exists($_value, $productOptionValues)) {
|
167 |
+
$_values[] = $productOptionValues[$_value];
|
168 |
+
}
|
169 |
+
}
|
170 |
+
} elseif ($this->_isSingleSelection() && array_key_exists($optionValue, $productOptionValues)) {
|
171 |
+
$_values[] = $productOptionValues[$optionValue];
|
172 |
+
}
|
173 |
+
if (count($_values)) {
|
174 |
+
return implode(',', $_values);
|
175 |
+
} else {
|
176 |
+
return null;
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Prepare option value for info buy request
|
182 |
+
*
|
183 |
+
* @param string $optionValue
|
184 |
+
* @return mixed
|
185 |
+
*/
|
186 |
+
public function prepareOptionValueForRequest($optionValue)
|
187 |
+
{
|
188 |
+
if (!$this->_isSingleSelection()) {
|
189 |
+
return explode(',', $optionValue);
|
190 |
+
}
|
191 |
+
return $optionValue;
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Return Price for selected option
|
196 |
+
*
|
197 |
+
* @param string $optionValue Prepared for cart option value
|
198 |
+
* @return float
|
199 |
+
*/
|
200 |
+
public function getOptionPrice($optionValue, $basePrice)
|
201 |
+
{
|
202 |
+
$option = $this->getOption();
|
203 |
+
$result = 0;
|
204 |
+
|
205 |
+
if (!$this->_isSingleSelection()) {
|
206 |
+
foreach(explode(',', $optionValue) as $value) {
|
207 |
+
if ($_result = $option->getValueById($value)) {
|
208 |
+
$result += $this->_getChargableOptionPrice(
|
209 |
+
$_result->getPrice(),
|
210 |
+
$_result->getPriceType() == 'percent',
|
211 |
+
$basePrice
|
212 |
+
);
|
213 |
+
} else {
|
214 |
+
if ($this->getListener()) {
|
215 |
+
$this->getListener()
|
216 |
+
->setHasError(true)
|
217 |
+
->setMessage(
|
218 |
+
Mage::helper('catalog')->__('Some of the products below do not have all the required options. Please remove them and add again with all the required options.')
|
219 |
+
);
|
220 |
+
break;
|
221 |
+
}
|
222 |
+
}
|
223 |
+
}
|
224 |
+
} elseif ($this->_isSingleSelection()) {
|
225 |
+
if ($_result = $option->getValueById($optionValue)) {
|
226 |
+
$result = $this->_getChargableOptionPrice(
|
227 |
+
$_result->getPrice(),
|
228 |
+
$_result->getPriceType() == 'percent',
|
229 |
+
$basePrice
|
230 |
+
);
|
231 |
+
} else {
|
232 |
+
if ($this->getListener()) {
|
233 |
+
$this->getListener()
|
234 |
+
->setHasError(true)
|
235 |
+
->setMessage(
|
236 |
+
Mage::helper('catalog')->__('Some of the products below do not have all the required options. Please remove them and add again with all the required options.')
|
237 |
+
);
|
238 |
+
}
|
239 |
+
}
|
240 |
+
}
|
241 |
+
|
242 |
+
return $result;
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Return SKU for selected option
|
247 |
+
*
|
248 |
+
* @param string $optionValue Prepared for cart option value
|
249 |
+
* @param string $skuDelimiter Delimiter for Sku parts
|
250 |
+
* @return string
|
251 |
+
*/
|
252 |
+
public function getOptionSku($optionValue, $skuDelimiter)
|
253 |
+
{
|
254 |
+
$option = $this->getOption();
|
255 |
+
|
256 |
+
if (!$this->_isSingleSelection()) {
|
257 |
+
$skus = array();
|
258 |
+
foreach(explode(',', $optionValue) as $value) {
|
259 |
+
if ($optionSku = $option->getValueById($value)) {
|
260 |
+
$skus[] = $optionSku->getSku();
|
261 |
+
} else {
|
262 |
+
if ($this->getListener()) {
|
263 |
+
$this->getListener()
|
264 |
+
->setHasError(true)
|
265 |
+
->setMessage(
|
266 |
+
Mage::helper('catalog')->__('Some of the products below do not have all the required options. Please remove them and add again with all the required options.')
|
267 |
+
);
|
268 |
+
break;
|
269 |
+
}
|
270 |
+
}
|
271 |
+
}
|
272 |
+
$result = implode($skuDelimiter, $skus);
|
273 |
+
} elseif ($this->_isSingleSelection()) {
|
274 |
+
if ($result = $option->getValueById($optionValue)) {
|
275 |
+
return $result->getSku();
|
276 |
+
} else {
|
277 |
+
if ($this->getListener()) {
|
278 |
+
$this->getListener()
|
279 |
+
->setHasError(true)
|
280 |
+
->setMessage(
|
281 |
+
Mage::helper('catalog')->__('Some of the products below do not have all the required options. Please remove them and add again with all the required options.')
|
282 |
+
);
|
283 |
+
}
|
284 |
+
return '';
|
285 |
+
}
|
286 |
+
} else {
|
287 |
+
$result = parent::getOptionSku($optionValue, $skuDelimiter);
|
288 |
+
}
|
289 |
+
|
290 |
+
return $result;
|
291 |
+
}
|
292 |
+
|
293 |
+
/**
|
294 |
+
* Check if option has single or multiple values selection
|
295 |
+
*
|
296 |
+
* @return boolean
|
297 |
+
*/
|
298 |
+
protected function _isSingleSelection()
|
299 |
+
{
|
300 |
+
$_single = array(
|
301 |
+
Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN,
|
302 |
+
Mage_Catalog_Model_Product_Option::OPTION_TYPE_RADIO
|
303 |
+
);
|
304 |
+
return in_array($this->getOption()->getType(), $_single);
|
305 |
+
}
|
306 |
+
}
|
app/code/local/Achang/Scene7/Model/Catalog/Product/Option/Type/Scene7text.php
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2010 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 |
+
* Catalog product option text type
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Catalog
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Achang_Scene7_Model_Catalog_Product_Option_Type_Scene7text extends Achang_Scene7_Model_Catalog_Product_Option_Type_Default
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Validate user input for option
|
38 |
+
*
|
39 |
+
* @throws Mage_Core_Exception
|
40 |
+
* @param array $values All product option values, i.e. array (option_id => mixed, option_id => mixed...)
|
41 |
+
* @return Mage_Catalog_Model_Product_Option_Type_Default
|
42 |
+
*/
|
43 |
+
public function validateUserValue($values)
|
44 |
+
{
|
45 |
+
parent::validateUserValue($values);
|
46 |
+
|
47 |
+
$option = $this->getOption();
|
48 |
+
$value = trim($this->getUserValue());
|
49 |
+
if (strlen($value) == 0 && $option->getIsRequire() && !$this->getProduct()->getSkipCheckRequiredOption()) {
|
50 |
+
$this->setIsValid(false);
|
51 |
+
Mage::throwException(Mage::helper('catalog')->__('Please specify the product\'s required option(s).'));
|
52 |
+
}
|
53 |
+
if (strlen($value) > $option->getMaxCharacters() && $option->getMaxCharacters() > 0) {
|
54 |
+
$this->setIsValid(false);
|
55 |
+
Mage::throwException(Mage::helper('catalog')->__('The text is too long'));
|
56 |
+
}
|
57 |
+
$this->setUserValue($value);
|
58 |
+
return $this;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Prepare option value for cart
|
63 |
+
*
|
64 |
+
* @return mixed Prepared option value
|
65 |
+
*/
|
66 |
+
public function prepareForCart()
|
67 |
+
{
|
68 |
+
if ($this->getIsValid() && strlen($this->getUserValue()) > 0) {
|
69 |
+
return $this->getUserValue();
|
70 |
+
} else {
|
71 |
+
return null;
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Return formatted option value for quote option
|
77 |
+
*
|
78 |
+
* @param string $value Prepared for cart option value
|
79 |
+
* @return string
|
80 |
+
*/
|
81 |
+
public function getFormattedOptionValue($value)
|
82 |
+
{
|
83 |
+
return Mage::helper('core')->htmlEscape($value);
|
84 |
+
}
|
85 |
+
}
|
app/code/local/Achang/Scene7/Model/Catalog/Product/Option/Value.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Catalog product option select type model
|
4 |
+
*
|
5 |
+
* @category Mage
|
6 |
+
* @package Mage_Catalog
|
7 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
8 |
+
*/
|
9 |
+
class Achang_Scene7_Model_Catalog_Product_Option_Value extends Mage_Catalog_Model_Product_Option_Value
|
10 |
+
{
|
11 |
+
|
12 |
+
protected function _construct()
|
13 |
+
{
|
14 |
+
$this->_init('scenescene7/product_option_value');
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Enter description here...
|
19 |
+
*
|
20 |
+
* @param Mage_Catalog_Model_Product_Option $option
|
21 |
+
* @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Option_Value_Collection
|
22 |
+
*/
|
23 |
+
public function getValuesCollection(Mage_Catalog_Model_Product_Option $option)
|
24 |
+
{
|
25 |
+
$collection = Mage::getResourceModel('catalog/product_option_value_collection')
|
26 |
+
->addFieldToFilter('option_id', $option->getId())
|
27 |
+
->getValues($option->getStoreId());
|
28 |
+
|
29 |
+
return $collection;
|
30 |
+
}
|
31 |
+
|
32 |
+
public function getValuesByOption($optionIds, $option_id, $store_id)
|
33 |
+
{
|
34 |
+
$collection = Mage::getResourceModel('catalog/product_option_value_collection')
|
35 |
+
->addFieldToFilter('option_id', $option_id)
|
36 |
+
->getValuesByOption($optionIds, $store_id);
|
37 |
+
|
38 |
+
return $collection;
|
39 |
+
}
|
40 |
+
|
41 |
+
}
|
app/code/local/Achang/Scene7/Model/Product/Price/Scene7.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Achang_Scene7_Model_Product_Price_Scene7 extends Mage_Catalog_Model_Product_Type_Price{
|
3 |
+
// public function getFinalPrice($qty=null, $product){
|
4 |
+
// if ($sceneopt = $product->getCustomOption('scene_option')) {
|
5 |
+
// $price = $product->getPrice();
|
6 |
+
// $sceneoptions = unserialize($sceneopt->getValue());
|
7 |
+
// $numberoption = $product->getCustomOption('number_option')->getValue();
|
8 |
+
// $number = 1;
|
9 |
+
// foreach ($sceneoptions as $key => $val) {
|
10 |
+
// if ($number <= $numberoption) {
|
11 |
+
// $jewel = Mage::getModel('scenescene7/sceneitem')->load($val);
|
12 |
+
// $price +=$jewel->getSceneitemPrice();
|
13 |
+
// ++$number;
|
14 |
+
// }
|
15 |
+
// }
|
16 |
+
// return $price;
|
17 |
+
// }else {
|
18 |
+
// return parent::getFinalPrice($qty, $product);
|
19 |
+
// }
|
20 |
+
// }
|
21 |
+
}
|
app/code/local/Achang/Scene7/Model/Product/Type.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Achang_Scene7_Model_Product_Type
|
3 |
+
{
|
4 |
+
const TYPE_SCENE7_PRODUCT = 'scene7_product';
|
5 |
+
}
|
app/code/local/Achang/Scene7/Model/Product/Type/Scene7.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Achang_Scene7_Model_Product_Type_Scene7 extends Mage_Catalog_Model_Product_Type_Abstract{
|
3 |
+
public function prepareForCart(Varien_Object $buyRequest, $product = null)
|
4 |
+
{
|
5 |
+
$product = $this->getProduct($product);
|
6 |
+
$data = $buyRequest->getData();
|
7 |
+
$product->addCustomOption('src_option',$data['src_option']);
|
8 |
+
return parent::prepareForCart($buyRequest,$product);
|
9 |
+
}
|
10 |
+
|
11 |
+
public function prepareForCartAdvanced(Varien_Object $buyRequest, $product = null, $processMode = null)
|
12 |
+
{
|
13 |
+
|
14 |
+
$product = $this->getProduct($product);
|
15 |
+
$data = $buyRequest->getData();
|
16 |
+
$product->addCustomOption('src_option',$data['src_option']);
|
17 |
+
return parent::prepareForCartAdvanced($buyRequest,$product,$processMode);
|
18 |
+
}
|
19 |
+
|
20 |
+
public function getOrderOptions($product = null){
|
21 |
+
$optionArr = parent::getOrderOptions($product);
|
22 |
+
if ($product->hasCustomOptions()) {
|
23 |
+
$src_option = $product->getCustomOption('src_option')->getValue();
|
24 |
+
$option['label'] = 'Personalized Image';
|
25 |
+
$option['value'] = "<img width='100' src='{$src_option}'>";//// array order page not ok
|
26 |
+
$option['print_value'] = "<img width='100' src='{$src_option}'>";
|
27 |
+
$option['custom_view'] = "<img width='100' src='{$src_option}'>";
|
28 |
+
|
29 |
+
$optionArr['options'][] = $option;
|
30 |
+
}
|
31 |
+
|
32 |
+
return $optionArr;
|
33 |
+
}
|
34 |
+
}
|
app/code/local/Achang/Scene7/Model/Product/Type/Scene7.php.bak
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Achang_Scene7_Model_Product_Type_Scene7 extends Mage_Catalog_Model_Product_Type_Abstract{
|
3 |
+
public function prepareForCart(Varien_Object $buyRequest, $product = null)
|
4 |
+
{
|
5 |
+
$product = $this->getProduct($product);
|
6 |
+
$data = $buyRequest->getData();
|
7 |
+
$product->addCustomOption('src_option',$data['src_option']);
|
8 |
+
return parent::prepareForCart($buyRequest,$product);
|
9 |
+
}
|
10 |
+
|
11 |
+
public function prepareForCartAdvanced(Varien_Object $buyRequest, $product = null, $processMode = null)
|
12 |
+
{
|
13 |
+
|
14 |
+
$product = $this->getProduct($product);
|
15 |
+
$data = $buyRequest->getData();
|
16 |
+
$product->addCustomOption('src_option',$data['src_option']);
|
17 |
+
return parent::prepareForCartAdvanced($buyRequest,$product,$processMode);
|
18 |
+
}
|
19 |
+
|
20 |
+
public function getOrderOptions($product = null){
|
21 |
+
$optionArr = parent::getOrderOptions($product);
|
22 |
+
if ($product->hasCustomOptions()) {
|
23 |
+
$src_option = $product->getCustomOption('src_option')->getValue();
|
24 |
+
$option['label'] = 'Personalized Image';
|
25 |
+
$option['value'] = "<img width='100' src='{$src_option}'>";//// array order page not ok
|
26 |
+
$option['print_value'] = "<img width='100' src='{$src_option}'>";
|
27 |
+
$option['custom_view'] = "<img width='100' src='{$src_option}'>";
|
28 |
+
|
29 |
+
$optionArr['options'][] = $option;
|
30 |
+
}
|
31 |
+
|
32 |
+
return $optionArr;
|
33 |
+
}
|
34 |
+
}
|
app/code/local/Achang/Scene7/Model/Resource/Attribute.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Achang_Scene7_Model_Resource_Attribute extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the attribute_id refers to the key field in your database table.
|
8 |
+
$this->_init('scenescene7/scene_scene7_attribute', 'attribute_id');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Achang/Scene7/Model/Resource/Attribute/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Achang_Scene7_Model_Resource_Attribute_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('scenescene7/attribute');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Achang/Scene7/Model/Resource/Product/Option.php
ADDED
@@ -0,0 +1,287 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Catalog product custom option resource model
|
4 |
+
*
|
5 |
+
* @category Aijko
|
6 |
+
* @package Aijko_CustomOptionDescription
|
7 |
+
* @author Gerrit Pechmann <gp@aijko.de>
|
8 |
+
* @copyright Copyright (c) 2012, aijko GmbH (http://www.aijko.de)
|
9 |
+
*/
|
10 |
+
class Achang_Scene7_Model_Resource_Product_Option extends Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Option
|
11 |
+
{
|
12 |
+
protected function _afterSave(Mage_Core_Model_Abstract $object)
|
13 |
+
{
|
14 |
+
|
15 |
+
$priceTable = $this->getTable('catalog/product_option_price');
|
16 |
+
$titleTable = $this->getTable('catalog/product_option_title');
|
17 |
+
|
18 |
+
|
19 |
+
$opt = new Achang_Scene7_Model_Catalog_Product_Option();
|
20 |
+
$issvene7text = false;
|
21 |
+
if($opt->getGroupByType($object->getType()) == 'scene7text'){
|
22 |
+
$issvene7text = true;
|
23 |
+
}
|
24 |
+
//better to check param 'price' and 'price_type' for saving. If there is not price scip saving price
|
25 |
+
if ($object->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_FIELD
|
26 |
+
|| $object->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_AREA
|
27 |
+
|| $object->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_FILE
|
28 |
+
|| $object->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DATE
|
29 |
+
|| $object->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DATE_TIME
|
30 |
+
|| $object->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_TIME
|
31 |
+
|| $issvene7text
|
32 |
+
) {
|
33 |
+
|
34 |
+
//save for store_id = 0
|
35 |
+
if (!$object->getData('scope', 'price')) {
|
36 |
+
$statement = $this->_getReadAdapter()->select()
|
37 |
+
->from($priceTable)
|
38 |
+
->where('option_id = '.$object->getId().' AND store_id = ?', 0);
|
39 |
+
if ($this->_getReadAdapter()->fetchOne($statement)) {
|
40 |
+
if ($object->getStoreId() == '0') {
|
41 |
+
$this->_getWriteAdapter()->update(
|
42 |
+
$priceTable,
|
43 |
+
array(
|
44 |
+
'price' => $object->getPrice(),
|
45 |
+
'price_type' => $object->getPriceType()
|
46 |
+
),
|
47 |
+
$this->_getWriteAdapter()->quoteInto('option_id = '.$object->getId().' AND store_id = ?', 0)
|
48 |
+
);
|
49 |
+
}
|
50 |
+
} else {
|
51 |
+
$this->_getWriteAdapter()->insert(
|
52 |
+
$priceTable,
|
53 |
+
array(
|
54 |
+
'option_id' => $object->getId(),
|
55 |
+
'store_id' => 0,
|
56 |
+
'price' => $object->getPrice(),
|
57 |
+
'price_type' => $object->getPriceType()
|
58 |
+
)
|
59 |
+
);
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
$scope = (int) Mage::app()->getStore()->getConfig(Mage_Core_Model_Store::XML_PATH_PRICE_SCOPE);
|
64 |
+
|
65 |
+
if ($object->getStoreId() != '0' && $scope == Mage_Core_Model_Store::PRICE_SCOPE_WEBSITE
|
66 |
+
&& !$object->getData('scope', 'price')) {
|
67 |
+
|
68 |
+
$baseCurrency = Mage::app()->getBaseCurrencyCode();
|
69 |
+
|
70 |
+
$storeIds = Mage::app()->getStore($object->getStoreId())->getWebsite()->getStoreIds();
|
71 |
+
if (is_array($storeIds)) {
|
72 |
+
foreach ($storeIds as $storeId) {
|
73 |
+
if ($object->getPriceType() == 'fixed') {
|
74 |
+
$storeCurrency = Mage::app()->getStore($storeId)->getBaseCurrencyCode();
|
75 |
+
$rate = Mage::getModel('directory/currency')->load($baseCurrency)->getRate($storeCurrency);
|
76 |
+
if (!$rate) {
|
77 |
+
$rate=1;
|
78 |
+
}
|
79 |
+
$newPrice = $object->getPrice() * $rate;
|
80 |
+
} else {
|
81 |
+
$newPrice = $object->getPrice();
|
82 |
+
}
|
83 |
+
$statement = $this->_getReadAdapter()->select()
|
84 |
+
->from($priceTable)
|
85 |
+
->where('option_id = '.$object->getId().' AND store_id = ?', $storeId);
|
86 |
+
|
87 |
+
if ($this->_getReadAdapter()->fetchOne($statement)) {
|
88 |
+
$this->_getWriteAdapter()->update(
|
89 |
+
$priceTable,
|
90 |
+
array(
|
91 |
+
'price' => $newPrice,
|
92 |
+
'price_type' => $object->getPriceType()
|
93 |
+
),
|
94 |
+
$this->_getWriteAdapter()->quoteInto('option_id = '.$object->getId().' AND store_id = ?', $storeId)
|
95 |
+
);
|
96 |
+
} else {
|
97 |
+
$this->_getWriteAdapter()->insert(
|
98 |
+
$priceTable,
|
99 |
+
array(
|
100 |
+
'option_id' => $object->getId(),
|
101 |
+
'store_id' => $storeId,
|
102 |
+
'price' => $newPrice,
|
103 |
+
'price_type' => $object->getPriceType()
|
104 |
+
)
|
105 |
+
);
|
106 |
+
}
|
107 |
+
}// end foreach()
|
108 |
+
}
|
109 |
+
} elseif ($scope == Mage_Core_Model_Store::PRICE_SCOPE_WEBSITE && $object->getData('scope', 'price')) {
|
110 |
+
$this->_getWriteAdapter()->delete(
|
111 |
+
$priceTable,
|
112 |
+
$this->_getWriteAdapter()->quoteInto('option_id = '.$object->getId().' AND store_id = ?', $object->getStoreId())
|
113 |
+
);
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
//title
|
118 |
+
if (!$object->getData('scope', 'title')) {
|
119 |
+
$statement = $this->_getReadAdapter()->select()
|
120 |
+
->from($titleTable)
|
121 |
+
->where('option_id = '.$object->getId().' and store_id = ?', 0);
|
122 |
+
|
123 |
+
if ($this->_getReadAdapter()->fetchOne($statement)) {
|
124 |
+
if ($object->getStoreId() == '0') {
|
125 |
+
$this->_getWriteAdapter()->update(
|
126 |
+
$titleTable,
|
127 |
+
array('title' => $object->getTitle()),
|
128 |
+
$this->_getWriteAdapter()->quoteInto('option_id='.$object->getId().' AND store_id=?', 0)
|
129 |
+
);
|
130 |
+
}
|
131 |
+
} else {
|
132 |
+
$this->_getWriteAdapter()->insert(
|
133 |
+
$titleTable,
|
134 |
+
array(
|
135 |
+
'option_id' => $object->getId(),
|
136 |
+
'store_id' => 0,
|
137 |
+
'title' => $object->getTitle()
|
138 |
+
));
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
if ($object->getStoreId() != '0' && !$object->getData('scope', 'title')) {
|
143 |
+
$statement = $this->_getReadAdapter()->select()
|
144 |
+
->from($titleTable)
|
145 |
+
->where('option_id = '.$object->getId().' and store_id = ?', $object->getStoreId());
|
146 |
+
|
147 |
+
if ($this->_getReadAdapter()->fetchOne($statement)) {
|
148 |
+
$this->_getWriteAdapter()->update(
|
149 |
+
$titleTable,
|
150 |
+
array('title' => $object->getTitle()),
|
151 |
+
$this->_getWriteAdapter()
|
152 |
+
->quoteInto('option_id='.$object->getId().' AND store_id=?', $object->getStoreId()));
|
153 |
+
} else {
|
154 |
+
$this->_getWriteAdapter()->insert(
|
155 |
+
$titleTable,
|
156 |
+
array(
|
157 |
+
'option_id' => $object->getId(),
|
158 |
+
'store_id' => $object->getStoreId(),
|
159 |
+
'title' => $object->getTitle()
|
160 |
+
));
|
161 |
+
}
|
162 |
+
} elseif ($object->getData('scope', 'title')) {
|
163 |
+
$this->_getWriteAdapter()->delete(
|
164 |
+
$titleTable,
|
165 |
+
$this->_getWriteAdapter()->quoteInto('option_id = '.$object->getId().' AND store_id = ?', $object->getStoreId())
|
166 |
+
);
|
167 |
+
}
|
168 |
+
|
169 |
+
//////////////////////////
|
170 |
+
$descriptionTable = $this->getTable('scenescene7/product_option_description');
|
171 |
+
|
172 |
+
if (!$object->getData('scope', 'description')) {
|
173 |
+
$statement = $this->_getReadAdapter()->select()
|
174 |
+
->from($descriptionTable)
|
175 |
+
->where('option_id = '.$object->getId().' and store_id = ?', 0);
|
176 |
+
|
177 |
+
if ($this->_getReadAdapter()->fetchOne($statement)) {
|
178 |
+
if ($object->getStoreId() == '0') {
|
179 |
+
$this->_getWriteAdapter()->update(
|
180 |
+
$descriptionTable,
|
181 |
+
array('description' => $object->getDescription()),
|
182 |
+
$this->_getWriteAdapter()->quoteInto('option_id='.$object->getId().' AND store_id=?', 0)
|
183 |
+
);
|
184 |
+
}
|
185 |
+
} else {
|
186 |
+
$this->_getWriteAdapter()->insert(
|
187 |
+
$descriptionTable,
|
188 |
+
array(
|
189 |
+
'option_id' => $object->getId(),
|
190 |
+
'store_id' => 0,
|
191 |
+
'description' => $object->getDescription()
|
192 |
+
));
|
193 |
+
}
|
194 |
+
}
|
195 |
+
|
196 |
+
if ($object->getStoreId() != '0' && !$object->getData('scope', 'description')) {
|
197 |
+
$statement = $this->_getReadAdapter()->select()
|
198 |
+
->from($descriptionTable)
|
199 |
+
->where('option_id = '.$object->getId().' and store_id = ?', $object->getStoreId());
|
200 |
+
|
201 |
+
if ($this->_getReadAdapter()->fetchOne($statement)) {
|
202 |
+
$this->_getWriteAdapter()->update(
|
203 |
+
$descriptionTable,
|
204 |
+
array('description' => $object->getDescription()),
|
205 |
+
$this->_getWriteAdapter()
|
206 |
+
->quoteInto('option_id='.$object->getId().' AND store_id=?', $object->getStoreId()));
|
207 |
+
} else {
|
208 |
+
$this->_getWriteAdapter()->insert(
|
209 |
+
$descriptionTable,
|
210 |
+
array(
|
211 |
+
'option_id' => $object->getId(),
|
212 |
+
'store_id' => $object->getStoreId(),
|
213 |
+
'description' => $object->getDescription()
|
214 |
+
));
|
215 |
+
}
|
216 |
+
} elseif ($object->getData('scope', 'description')) {
|
217 |
+
$this->_getWriteAdapter()->delete(
|
218 |
+
$descriptionTable,
|
219 |
+
$this->_getWriteAdapter()->quoteInto('option_id = '.$object->getId().' AND store_id = ?', $object->getStoreId())
|
220 |
+
);
|
221 |
+
}
|
222 |
+
|
223 |
+
return Mage_Core_Model_Mysql4_Abstract::_afterSave($object);
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* Duplicate custom options for product
|
228 |
+
*
|
229 |
+
* @param Mage_Catalog_Model_Product_Option $object
|
230 |
+
* @param int $oldProductId
|
231 |
+
* @param int $newProductId
|
232 |
+
* @return Mage_Catalog_Model_Product_Option
|
233 |
+
*/
|
234 |
+
public function duplicate(Mage_Catalog_Model_Product_Option $object, $oldProductId, $newProductId)
|
235 |
+
{
|
236 |
+
$write = $this->_getWriteAdapter();
|
237 |
+
$read = $this->_getReadAdapter();
|
238 |
+
|
239 |
+
$optionsCond = array();
|
240 |
+
$optionsData = array();
|
241 |
+
|
242 |
+
// read and prepare original product options
|
243 |
+
$select = $read->select()
|
244 |
+
->from($this->getTable('catalog/product_option'))
|
245 |
+
->where('product_id=?', $oldProductId);
|
246 |
+
$query = $read->query($select);
|
247 |
+
while ($row = $query->fetch()) {
|
248 |
+
$optionsData[$row['option_id']] = $row;
|
249 |
+
$optionsData[$row['option_id']]['product_id'] = $newProductId;
|
250 |
+
unset($optionsData[$row['option_id']]['option_id']);
|
251 |
+
}
|
252 |
+
|
253 |
+
// insert options to duplicated product
|
254 |
+
foreach ($optionsData as $oId => $data) {
|
255 |
+
$write->insert($this->getMainTable(), $data);
|
256 |
+
$optionsCond[$oId] = $write->lastInsertId();
|
257 |
+
}
|
258 |
+
|
259 |
+
// copy options prefs
|
260 |
+
foreach ($optionsCond as $oldOptionId => $newOptionId) {
|
261 |
+
// title
|
262 |
+
$table = $this->getTable('catalog/product_option_title');
|
263 |
+
$sql = 'REPLACE INTO `' . $table . '` '
|
264 |
+
. 'SELECT NULL, ' . $newOptionId . ', `store_id`, `title`'
|
265 |
+
. 'FROM `' . $table . '` WHERE `option_id`=' . $oldOptionId;
|
266 |
+
$this->_getWriteAdapter()->query($sql);
|
267 |
+
|
268 |
+
// price
|
269 |
+
$table = $this->getTable('catalog/product_option_price');
|
270 |
+
$sql = 'REPLACE INTO `' . $table . '` '
|
271 |
+
. 'SELECT NULL, ' . $newOptionId . ', `store_id`, `price`, `price_type`'
|
272 |
+
. 'FROM `' . $table . '` WHERE `option_id`=' . $oldOptionId;
|
273 |
+
$this->_getWriteAdapter()->query($sql);
|
274 |
+
|
275 |
+
// description
|
276 |
+
$table = $this->getTable('scenescene7/product_option_description');
|
277 |
+
$sql = 'REPLACE INTO `' . $table . '` '
|
278 |
+
. 'SELECT NULL, ' . $newOptionId . ', `store_id`, `description`'
|
279 |
+
. 'FROM `' . $table . '` WHERE `option_id`=' . $oldOptionId;
|
280 |
+
$this->_getWriteAdapter()->query($sql);
|
281 |
+
|
282 |
+
$object->getValueInstance()->duplicate($oldOptionId, $newOptionId);
|
283 |
+
}
|
284 |
+
|
285 |
+
return $object;
|
286 |
+
}
|
287 |
+
}
|
app/code/local/Achang/Scene7/Model/Resource/Product/Option/Collection.php
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Catalog product options collection
|
4 |
+
*
|
5 |
+
* @category Aijko
|
6 |
+
* @package Aijko_CustomOptionDescription
|
7 |
+
* @author Gerrit Pechmann <gp@aijko.de>
|
8 |
+
* @copyright Copyright (c) 2012, aijko GmbH (http://www.aijko.de)
|
9 |
+
*/
|
10 |
+
class Achang_Scene7_Model_Resource_Product_Option_Collection extends Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Option_Collection
|
11 |
+
{
|
12 |
+
public function getOptions($store_id)
|
13 |
+
{
|
14 |
+
$this->getSelect()
|
15 |
+
->joinLeft(array('default_option_price'=>$this->getTable('catalog/product_option_price')),
|
16 |
+
'`default_option_price`.option_id=`main_table`.option_id AND '.$this->getConnection()->quoteInto('`default_option_price`.store_id=?',0),
|
17 |
+
array('default_price'=>'price','default_price_type'=>'price_type'))
|
18 |
+
->joinLeft(array('store_option_price'=>$this->getTable('catalog/product_option_price')),
|
19 |
+
'`store_option_price`.option_id=`main_table`.option_id AND '.$this->getConnection()->quoteInto('`store_option_price`.store_id=?', $store_id),
|
20 |
+
array('store_price'=>'price','store_price_type'=>'price_type',
|
21 |
+
'price'=>new Zend_Db_Expr('IFNULL(`store_option_price`.price,`default_option_price`.price)'),
|
22 |
+
'price_type'=>new Zend_Db_Expr('IFNULL(`store_option_price`.price_type,`default_option_price`.price_type)')))
|
23 |
+
->joinLeft(array('default_option_description'=>$this->getTable('scenescene7/product_option_description')),
|
24 |
+
'`default_option_description`.option_id=`main_table`.option_id AND '.$this->getConnection()->quoteInto('`default_option_description`.store_id=?',0),
|
25 |
+
array('default_description'=>'description'))
|
26 |
+
->joinLeft(array('store_option_description'=>$this->getTable('scenescene7/product_option_description')),
|
27 |
+
'`store_option_description`.option_id=`main_table`.option_id AND '.$this->getConnection()->quoteInto('`store_option_description`.store_id=?', $store_id),
|
28 |
+
array('store_description'=>'description',
|
29 |
+
'description'=>new Zend_Db_Expr('IFNULL(`store_option_description`.description,`default_option_description`.description)')))
|
30 |
+
->join(array('default_option_title'=>$this->getTable('catalog/product_option_title')),
|
31 |
+
'`default_option_title`.option_id=`main_table`.option_id',
|
32 |
+
array('default_title'=>'title'))
|
33 |
+
->joinLeft(array('store_option_title'=>$this->getTable('catalog/product_option_title')),
|
34 |
+
'`store_option_title`.option_id=`main_table`.option_id AND '.$this->getConnection()->quoteInto('`store_option_title`.store_id=?', $store_id),
|
35 |
+
array('store_title'=>'title',
|
36 |
+
'title'=>new Zend_Db_Expr('IFNULL(`store_option_title`.title,`default_option_title`.title)')))
|
37 |
+
->where('`default_option_title`.store_id=?', 0);
|
38 |
+
|
39 |
+
return $this;
|
40 |
+
}
|
41 |
+
|
42 |
+
public function addDescriptionToResult($store_id)
|
43 |
+
{
|
44 |
+
$this->getSelect()
|
45 |
+
->joinLeft(array('default_option_description'=>$this->getTable('scenescene7/product_option_description')),
|
46 |
+
'`default_option_description`.option_id=`main_table`.option_id AND '.$this->getConnection()->quoteInto('`default_option_description`.store_id=?',0),
|
47 |
+
array('default_description'=>'description'))
|
48 |
+
->joinLeft(array('store_option_description'=>$this->getTable('scenescene7/product_option_description')),
|
49 |
+
'`store_option_description`.option_id=`main_table`.option_id AND '.$this->getConnection()->quoteInto('`store_option_description`.store_id=?', $store_id),
|
50 |
+
array('store_description'=>'description',
|
51 |
+
'description'=>new Zend_Db_Expr('IFNULL(`store_option_description`.description,`default_option_description`.description)')));
|
52 |
+
return $this;
|
53 |
+
}
|
54 |
+
|
55 |
+
public function addValuesToResult($storeId = null)
|
56 |
+
{
|
57 |
+
if (null === $storeId) {
|
58 |
+
$storeId = Mage::app()->getStore()->getId();
|
59 |
+
}
|
60 |
+
$optionIds = array();
|
61 |
+
foreach ($this as $option) {
|
62 |
+
$optionIds[] = $option->getId();
|
63 |
+
}
|
64 |
+
if (!empty($optionIds)) {
|
65 |
+
$values = Mage::getModel('catalog/product_option_value')
|
66 |
+
->getCollection()
|
67 |
+
->addTitleToResult($storeId)
|
68 |
+
->addPriceToResult($storeId)
|
69 |
+
->addScene7DetailToResult($storeId)//added by minglong
|
70 |
+
->addOptionToFilter($optionIds)
|
71 |
+
->setOrder('sort_order', 'asc')
|
72 |
+
->setOrder('title', 'asc');
|
73 |
+
foreach ($values as $value) {
|
74 |
+
if($this->getItemById($value->getOptionId())) {
|
75 |
+
$this->getItemById($value->getOptionId())->addValue($value);
|
76 |
+
$value->setOption($this->getItemById($value->getOptionId()));
|
77 |
+
}
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
return $this;
|
82 |
+
}
|
83 |
+
}
|
app/code/local/Achang/Scene7/Model/Resource/Product/Option/Value.php
ADDED
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Achang_Scene7_Model_Resource_Product_Option_Value extends Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Option_Value
|
4 |
+
{
|
5 |
+
|
6 |
+
|
7 |
+
protected function _afterSave(Mage_Core_Model_Abstract $object)
|
8 |
+
{
|
9 |
+
$scene7detailTable = $this->getTable('scenescene7/product_option_type_detail');
|
10 |
+
//scene7 detail
|
11 |
+
if (!$object->getData('scope', 'scene7_code')) {
|
12 |
+
$statement = $this->_getReadAdapter()->select()
|
13 |
+
->from($scene7detailTable)
|
14 |
+
->where('option_type_id = '.$object->getId().' AND store_id = ?', 0);
|
15 |
+
|
16 |
+
if ($this->_getReadAdapter()->fetchOne($statement)) {
|
17 |
+
if ($object->getStoreId() == '0') {
|
18 |
+
$this->_getWriteAdapter()->update(
|
19 |
+
$scene7detailTable,
|
20 |
+
array('scene7_code' => $object->getScene7Code()),
|
21 |
+
$this->_getWriteAdapter()->quoteInto('option_type_id='.$object->getId().' AND store_id=?', 0)
|
22 |
+
);
|
23 |
+
}
|
24 |
+
} else {
|
25 |
+
$this->_getWriteAdapter()->insert(
|
26 |
+
$scene7detailTable,
|
27 |
+
array(
|
28 |
+
'option_type_id' => $object->getId(),
|
29 |
+
'store_id' => 0,
|
30 |
+
'scene7_code' => $object->getScene7Code()
|
31 |
+
));
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
if ($object->getStoreId() != '0' && !$object->getData('scope', 'scene7_code')) {
|
36 |
+
$statement = $this->_getReadAdapter()->select()
|
37 |
+
->from($scene7detailTable)
|
38 |
+
->where('option_type_id = '.$object->getId().' AND store_id = ?', $object->getStoreId());
|
39 |
+
|
40 |
+
if ($this->_getReadAdapter()->fetchOne($statement)) {
|
41 |
+
$this->_getWriteAdapter()->update(
|
42 |
+
$scene7detailTable,
|
43 |
+
array('scene7_code' => $object->getScene7Code()),
|
44 |
+
$this->_getWriteAdapter()
|
45 |
+
->quoteInto('option_type_id='.$object->getId().' AND store_id=?', $object->getStoreId()));
|
46 |
+
} else {
|
47 |
+
$this->_getWriteAdapter()->insert(
|
48 |
+
$scene7detailTable,
|
49 |
+
array(
|
50 |
+
'option_type_id' => $object->getId(),
|
51 |
+
'store_id' => $object->getStoreId(),
|
52 |
+
'scene7_code' => $object->getScene7Code()
|
53 |
+
));
|
54 |
+
}
|
55 |
+
} elseif ($object->getData('scope', 'scene7_code')) {
|
56 |
+
$this->_getWriteAdapter()->delete(
|
57 |
+
$scene7detailTable,
|
58 |
+
$this->_getWriteAdapter()->quoteInto('option_type_id = '.$object->getId().' AND store_id = ?', $object->getStoreId())
|
59 |
+
);
|
60 |
+
}
|
61 |
+
|
62 |
+
if (!$object->getData('scope', 'is_default')) {
|
63 |
+
$statement = $this->_getReadAdapter()->select()
|
64 |
+
->from($scene7detailTable)
|
65 |
+
->where('option_type_id = '.$object->getId().' AND store_id = ?', 0);
|
66 |
+
|
67 |
+
if ($this->_getReadAdapter()->fetchOne($statement)) {
|
68 |
+
if ($object->getStoreId() == '0') {
|
69 |
+
$this->_getWriteAdapter()->update(
|
70 |
+
$scene7detailTable,
|
71 |
+
array('is_default' => $object->getIsDefault()),
|
72 |
+
$this->_getWriteAdapter()->quoteInto('option_type_id='.$object->getId().' AND store_id=?', 0)
|
73 |
+
);
|
74 |
+
}
|
75 |
+
} else {
|
76 |
+
$this->_getWriteAdapter()->insert(
|
77 |
+
$scene7detailTable,
|
78 |
+
array(
|
79 |
+
'option_type_id' => $object->getId(),
|
80 |
+
'store_id' => 0,
|
81 |
+
'is_default' => $object->getIsDefault()
|
82 |
+
));
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
if ($object->getStoreId() != '0' && !$object->getData('scope', 'is_default')) {
|
87 |
+
$statement = $this->_getReadAdapter()->select()
|
88 |
+
->from($scene7detailTable)
|
89 |
+
->where('option_type_id = '.$object->getId().' AND store_id = ?', $object->getStoreId());
|
90 |
+
|
91 |
+
if ($this->_getReadAdapter()->fetchOne($statement)) {
|
92 |
+
$this->_getWriteAdapter()->update(
|
93 |
+
$scene7detailTable,
|
94 |
+
array('is_default' => $object->getIsDefault()),
|
95 |
+
$this->_getWriteAdapter()
|
96 |
+
->quoteInto('option_type_id='.$object->getId().' AND store_id=?', $object->getStoreId()));
|
97 |
+
} else {
|
98 |
+
$this->_getWriteAdapter()->insert(
|
99 |
+
$scene7detailTable,
|
100 |
+
array(
|
101 |
+
'option_type_id' => $object->getId(),
|
102 |
+
'store_id' => $object->getStoreId(),
|
103 |
+
'is_default' => $object->getIsDefault()
|
104 |
+
));
|
105 |
+
}
|
106 |
+
} elseif ($object->getData('scope', 'is_default')) {
|
107 |
+
$this->_getWriteAdapter()->delete(
|
108 |
+
$scene7detailTable,
|
109 |
+
$this->_getWriteAdapter()->quoteInto('option_type_id = '.$object->getId().' AND store_id = ?', $object->getStoreId())
|
110 |
+
);
|
111 |
+
}
|
112 |
+
|
113 |
+
return parent::_afterSave($object);
|
114 |
+
}
|
115 |
+
|
116 |
+
public function deleteValues($option_type_id)
|
117 |
+
{
|
118 |
+
$childCondition = $this->_getWriteAdapter()->quoteInto('option_type_id=?', $option_type_id);
|
119 |
+
$this->_getWriteAdapter()->delete(
|
120 |
+
$this->getTable('scenescene7/product_option_type_detail'),
|
121 |
+
$childCondition
|
122 |
+
);
|
123 |
+
parent::deleteValues($option_type_id);
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Duplicate product options value
|
128 |
+
*
|
129 |
+
* @param Mage_Catalog_Model_Product_Option_Value $object
|
130 |
+
* @param int $oldOptionId
|
131 |
+
* @param int $newOptionId
|
132 |
+
* @return Mage_Catalog_Model_Product_Option_Value
|
133 |
+
*/
|
134 |
+
public function duplicate(Mage_Catalog_Model_Product_Option_Value $object, $oldOptionId, $newOptionId)
|
135 |
+
{
|
136 |
+
$select = $this->_getReadAdapter()->select()
|
137 |
+
->from($this->getMainTable())
|
138 |
+
->where('option_id=?', $oldOptionId);
|
139 |
+
$valueData = $this->_getReadAdapter()->fetchAll($select);
|
140 |
+
|
141 |
+
$valueCond = array();
|
142 |
+
|
143 |
+
foreach ($valueData as $data) {
|
144 |
+
$optionTypeId = $data[$this->getIdFieldName()];
|
145 |
+
unset($data[$this->getIdFieldName()]);
|
146 |
+
$data['option_id'] = $newOptionId;
|
147 |
+
|
148 |
+
$this->_getWriteAdapter()->insert($this->getMainTable(), $data);
|
149 |
+
$valueCond[$optionTypeId] = $this->_getWriteAdapter()->lastInsertId();
|
150 |
+
}
|
151 |
+
|
152 |
+
unset($valueData);
|
153 |
+
|
154 |
+
foreach ($valueCond as $oldTypeId => $newTypeId) {
|
155 |
+
// price
|
156 |
+
$table = $this->getTable('catalog/product_option_type_price');
|
157 |
+
$sql = 'REPLACE INTO `' . $table . '` '
|
158 |
+
. 'SELECT NULL, ' . $newTypeId . ', `store_id`, `price`, `price_type`'
|
159 |
+
. 'FROM `' . $table . '` WHERE `option_type_id`=' . $oldTypeId;
|
160 |
+
$this->_getWriteAdapter()->query($sql);
|
161 |
+
|
162 |
+
// title
|
163 |
+
$table = $this->getTable('catalog/product_option_type_title');
|
164 |
+
$sql = 'REPLACE INTO `' . $table . '` '
|
165 |
+
. 'SELECT NULL, ' . $newTypeId . ', `store_id`, `title`'
|
166 |
+
. 'FROM `' . $table . '` WHERE `option_type_id`=' . $oldTypeId;
|
167 |
+
$this->_getWriteAdapter()->query($sql);
|
168 |
+
|
169 |
+
|
170 |
+
// scene7 detail
|
171 |
+
$table = $this->getTable('scenescene7/product_option_type_detail');
|
172 |
+
$sql = 'REPLACE INTO `' . $table . '` '
|
173 |
+
. 'SELECT NULL, ' . $newTypeId . ', `store_id`, `scene7_code`,`is_default`'
|
174 |
+
. 'FROM `' . $table . '` WHERE `option_type_id`=' . $oldTypeId;
|
175 |
+
$this->_getWriteAdapter()->query($sql);
|
176 |
+
}
|
177 |
+
|
178 |
+
return $object;
|
179 |
+
}
|
180 |
+
}
|
app/code/local/Achang/Scene7/Model/Resource/Product/Option/Value/Collection.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Catalog product option values collection
|
5 |
+
*
|
6 |
+
* @category Mage
|
7 |
+
* @package Mage_Catalog
|
8 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Achang_Scene7_Model_Resource_Product_Option_Value_Collection
|
12 |
+
extends Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Option_Value_Collection
|
13 |
+
{
|
14 |
+
|
15 |
+
public function getValues($store_id)
|
16 |
+
{
|
17 |
+
$this->getSelect()
|
18 |
+
->joinLeft(array('default_value_price'=>$this->getTable('catalog/product_option_type_price')),
|
19 |
+
'`default_value_price`.option_type_id=`main_table`.option_type_id AND '.$this->getConnection()->quoteInto('`default_value_price`.store_id=?',0),
|
20 |
+
array('default_price'=>'price','default_price_type'=>'price_type'))
|
21 |
+
->joinLeft(array('store_value_price'=>$this->getTable('catalog/product_option_type_price')),
|
22 |
+
'`store_value_price`.option_type_id=`main_table`.option_type_id AND '.$this->getConnection()->quoteInto('`store_value_price`.store_id=?', $store_id),
|
23 |
+
array('store_price'=>'price','store_price_type'=>'price_type',
|
24 |
+
'price'=>new Zend_Db_Expr('IFNULL(`store_value_price`.price,`default_value_price`.price)'),
|
25 |
+
'price_type'=>new Zend_Db_Expr('IFNULL(`store_value_price`.price_type,`default_value_price`.price_type)')))
|
26 |
+
|
27 |
+
->join(array('default_value_detail'=>$this->getTable('scenescene7/product_option_type_detail')),
|
28 |
+
'`default_value_detail`.option_type_id=`main_table`.option_type_id',
|
29 |
+
array('default_scene7_code'=>'scene7_code','default_is_default'=>'is_default'))
|
30 |
+
->joinLeft(array('store_value_detail'=>$this->getTable('scenescene7/product_option_type_detail')),
|
31 |
+
'`store_value_detail`.option_type_id=`main_table`.option_type_id AND '.$this->getConnection()->quoteInto('`store_value_detail`.store_id=?',$store_id),
|
32 |
+
array('store_scene7_code'=>'scene7_code','store_is_default'=>'is_default','scene7_code'=>new Zend_Db_Expr('IFNULL(`store_value_detail`.scene7_code,`default_value_detail`.scene7_code)'),'is_default'=>new Zend_Db_Expr('IFNULL(`store_value_detail`.is_default,`default_value_detail`.is_default)')))
|
33 |
+
|
34 |
+
->join(array('default_value_title'=>$this->getTable('catalog/product_option_type_title')),
|
35 |
+
'`default_value_title`.option_type_id=`main_table`.option_type_id',
|
36 |
+
array('default_title'=>'title'))
|
37 |
+
->joinLeft(array('store_value_title'=>$this->getTable('catalog/product_option_type_title')),
|
38 |
+
'`store_value_title`.option_type_id=`main_table`.option_type_id AND '.$this->getConnection()->quoteInto('`store_value_title`.store_id=?',$store_id),
|
39 |
+
array('store_title'=>'title','title'=>new Zend_Db_Expr('IFNULL(`store_value_title`.title,`default_value_title`.title)')))
|
40 |
+
->where('`default_value_title`.store_id=?',0);
|
41 |
+
return $this;
|
42 |
+
}
|
43 |
+
|
44 |
+
public function addScene7DetailToResult($store_id){
|
45 |
+
$this->getSelect()
|
46 |
+
->join(array('default_value_detail'=>$this->getTable('scenescene7/product_option_type_detail')),
|
47 |
+
'`default_value_detail`.option_type_id=`main_table`.option_type_id',
|
48 |
+
array('default_scene7_code'=>'scene7_code','default_is_default'=>'is_default'))
|
49 |
+
->joinLeft(array('store_value_detail'=>$this->getTable('scenescene7/product_option_type_detail')),
|
50 |
+
'`store_value_detail`.option_type_id=`main_table`.option_type_id AND '.$this->getConnection()->quoteInto('`store_value_detail`.store_id=?',$store_id),
|
51 |
+
array('store_scene7_code'=>'scene7_code','store_is_default'=>'is_default','scene7_code'=>new Zend_Db_Expr('IFNULL(`store_value_detail`.scene7_code,`default_value_detail`.scene7_code)'),'is_default'=>new Zend_Db_Expr('IFNULL(`store_value_detail`.is_default,`default_value_detail`.is_default)')))
|
52 |
+
->where('`default_value_detail`.store_id=?',0);
|
53 |
+
return $this;
|
54 |
+
}
|
55 |
+
|
56 |
+
|
57 |
+
|
58 |
+
|
59 |
+
}
|
app/code/local/Achang/Scene7/Model/Scene7.php
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author minglong
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class Achang_Scene7_Model_Scene7 extends Mage_Core_Model_Abstract{
|
7 |
+
|
8 |
+
private $_product = null;
|
9 |
+
private $_options = null;
|
10 |
+
|
11 |
+
public function getBaseUrl(){
|
12 |
+
$baseUrl = Mage::getStoreConfig('scenescene7/scene7settings/scene7_main_url');
|
13 |
+
return $baseUrl;
|
14 |
+
}
|
15 |
+
|
16 |
+
public function getCompanyName(){
|
17 |
+
$companyName = Mage::getStoreConfig('scenescene7/scene7settings/scene7_company');
|
18 |
+
return $companyName;
|
19 |
+
}
|
20 |
+
|
21 |
+
public function getProduct() {
|
22 |
+
return $this->_product;
|
23 |
+
}
|
24 |
+
|
25 |
+
public function setProduct($product) {
|
26 |
+
$this->_product = $product;
|
27 |
+
return $this;
|
28 |
+
}
|
29 |
+
|
30 |
+
public function getTemplateName() {
|
31 |
+
$product = $this->getProduct();
|
32 |
+
$templateName = $product->getScene7Template();
|
33 |
+
return $templateName;
|
34 |
+
}
|
35 |
+
|
36 |
+
public function getSceneTemplate(){
|
37 |
+
$baseUrl = $this->getBaseUrl();
|
38 |
+
$co = $this->getCompanyName();
|
39 |
+
$sceneTemplate = $baseUrl.$co.'/';
|
40 |
+
return $sceneTemplate;
|
41 |
+
}
|
42 |
+
|
43 |
+
public function getDefaultSceneTemplate(){
|
44 |
+
$template = $this->getTemplateName();
|
45 |
+
$sceneDefaultTemplate = $this->getSceneTemplate().$template;
|
46 |
+
return $sceneDefaultTemplate;
|
47 |
+
}
|
48 |
+
|
49 |
+
public function getSceneParams(){
|
50 |
+
$size = array(300,300);
|
51 |
+
$hei = $size[0];
|
52 |
+
$wid = $size[1];
|
53 |
+
$sceneParams = '?qlt=100,1'.'&hei='.$hei.'&wei='.$wid.'&op_sharpen=1';
|
54 |
+
return $sceneParams;
|
55 |
+
}
|
56 |
+
|
57 |
+
public function setOptions($options){
|
58 |
+
$tempOption = array();
|
59 |
+
foreach($options as $k => $v){
|
60 |
+
$option = Mage::getModel('catalog/product_option')->load($k);
|
61 |
+
if ($option->getGroupByType() == Achang_Scene7_Model_Catalog_Product_Option::OPTION_GROUP_SCENE7SELECT) {
|
62 |
+
$attributes = Mage::getModel('scenescene7/attribute')->getCollection()->addFieldToFilter('attribute_code',array('eq'=>$option->getType()));
|
63 |
+
if(count($attributes) == 1){
|
64 |
+
$attribute = $attributes->getFirstItem();
|
65 |
+
$values = Mage::getModel('catalog/product_option_value')->getCollection()->addFieldToFilter('`main_table`.`option_type_id`',array('eq'=>$v))
|
66 |
+
->addScene7DetailToResult(Mage::app()->getStore()->getId())
|
67 |
+
->addOptionToFilter(array($option->getId()));
|
68 |
+
if(count($values) == 1){
|
69 |
+
$value = $values->getFirstItem();
|
70 |
+
$tempOption[$attribute->getScene7Code()] = array('value'=>$value->getScene7Code(),'params'=>$this->getOptionParams($k));
|
71 |
+
}else{
|
72 |
+
continue;
|
73 |
+
}
|
74 |
+
}else{
|
75 |
+
continue;
|
76 |
+
}
|
77 |
+
}
|
78 |
+
}
|
79 |
+
$this->_options = $tempOption;
|
80 |
+
return $this;
|
81 |
+
}
|
82 |
+
|
83 |
+
public function getOptionParams($optionId){
|
84 |
+
$collection = Mage::getModel('catalog/product_option')->getCollection()
|
85 |
+
->addFieldToFilter('`main_table`.`option_id`', $optionId)
|
86 |
+
->addDescriptionToResult(Mage::app()->getStore()->getId());
|
87 |
+
if(count($collection) == 1){
|
88 |
+
return $collection->getFirstItem()->getDescription();
|
89 |
+
}else{
|
90 |
+
return '';
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
public function getOptions(){
|
95 |
+
return $this->_options;
|
96 |
+
}
|
97 |
+
|
98 |
+
public function getUrl(){
|
99 |
+
$url = $this->getDefaultSceneTemplate().$this->getSceneParams();
|
100 |
+
return $url;
|
101 |
+
}
|
102 |
+
|
103 |
+
public function toUrl(){
|
104 |
+
try{
|
105 |
+
$co = $this->getCompanyName();
|
106 |
+
$params = $this->getOptions();
|
107 |
+
$url = '';
|
108 |
+
if($params){
|
109 |
+
foreach($params as $k => $v){
|
110 |
+
$temp= '&$'.$k.'=is{'.$co.'/'.$v['value'];
|
111 |
+
if($v['params']){
|
112 |
+
$temp .= '?'.$v['params'].'}';
|
113 |
+
}else{
|
114 |
+
$temp .= '}';
|
115 |
+
}
|
116 |
+
$url .= $temp;
|
117 |
+
}
|
118 |
+
}
|
119 |
+
$ImageUrl = $this->getUrl().$url;
|
120 |
+
return $ImageUrl;
|
121 |
+
}
|
122 |
+
catch(Exception $e){
|
123 |
+
return '';
|
124 |
+
}
|
125 |
+
|
126 |
+
}
|
127 |
+
}
|
app/code/local/Achang/Scene7/Model/Session.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Achang_Scene7_Model_Session extends Mage_Core_Model_Session_Abstract{
|
3 |
+
public function __construct(){
|
4 |
+
$this->init('scenescene7');
|
5 |
+
}
|
6 |
+
}
|
app/code/local/Achang/Scene7/Model/Status.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Achang_Scene7_Model_Status extends Varien_Object
|
4 |
+
{
|
5 |
+
const SCENE7TEXT = 'text';
|
6 |
+
const SCENE7SELECT = 'select';
|
7 |
+
|
8 |
+
static public function getOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
self::SCENE7TEXT => Mage::helper('scenescene7')->__('Scene7 text'),
|
12 |
+
self::SCENE7SELECT => Mage::helper('scenescene7')->__('Scene7 select')
|
13 |
+
);
|
14 |
+
}
|
15 |
+
}
|
app/code/local/Achang/Scene7/Model/System/Config/Source/Product/Options/Type.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Achang_Scene7_Model_System_Config_Source_Product_Options_Type
|
3 |
+
{
|
4 |
+
const PRODUCT_OPTIONS_GROUPS_PATH = 'global/catalog/product/options/custom/groups';
|
5 |
+
|
6 |
+
public function toOptionArray()
|
7 |
+
{
|
8 |
+
$groups = array(
|
9 |
+
array('value' => '', 'label' => Mage::helper('adminhtml')->__('-- Please select --'))
|
10 |
+
);
|
11 |
+
foreach (Mage::getConfig()->getNode(self::PRODUCT_OPTIONS_GROUPS_PATH)->children() as $group) {
|
12 |
+
$types = array();
|
13 |
+
$typesPath = self::PRODUCT_OPTIONS_GROUPS_PATH . '/' . $group->getName() . '/types';
|
14 |
+
foreach (Mage::getConfig()->getNode($typesPath)->children() as $type) {
|
15 |
+
$labelPath = self::PRODUCT_OPTIONS_GROUPS_PATH . '/' . $group->getName() . '/types/' . $type->getName() . '/label';
|
16 |
+
$types[] = array(
|
17 |
+
'label' => (string) Mage::getConfig()->getNode($labelPath),
|
18 |
+
'value' => $type->getName()
|
19 |
+
);
|
20 |
+
}
|
21 |
+
|
22 |
+
$labelPath = self::PRODUCT_OPTIONS_GROUPS_PATH . '/' . $group->getName() . '/label';
|
23 |
+
|
24 |
+
$groups[] = array(
|
25 |
+
'label' => (string) Mage::getConfig()->getNode($labelPath),
|
26 |
+
'value' => $types
|
27 |
+
);
|
28 |
+
}
|
29 |
+
|
30 |
+
foreach(self::getScene7OptionGroups() as $k =>$v){
|
31 |
+
$scene7Types = array();
|
32 |
+
foreach($v['types'] as $k1=>$v1){
|
33 |
+
$scene7Types[] = array('label'=>$v1['label'],'value'=>$v1['value']);
|
34 |
+
}
|
35 |
+
$groups[] = array(
|
36 |
+
'label' => $v['label'],
|
37 |
+
'value' => $scene7Types
|
38 |
+
);
|
39 |
+
}
|
40 |
+
|
41 |
+
|
42 |
+
return $groups;
|
43 |
+
}
|
44 |
+
|
45 |
+
static function getScene7OptionGroups(){
|
46 |
+
$allattribute = Mage::getModel('scenescene7/attribute')->getCollection();
|
47 |
+
// $selectAttribute = array();
|
48 |
+
// $textAttribute = array();
|
49 |
+
$selectTypes = array();
|
50 |
+
$textTypes = array();
|
51 |
+
|
52 |
+
foreach($allattribute as $attribute){
|
53 |
+
if($attribute->getType() == 'select'){
|
54 |
+
//$selectAttribute[] = $attribute;
|
55 |
+
$selectTypes[] = array('label'=>$attribute->getTitle(),'value'=>$attribute->getAttributeCode());
|
56 |
+
}
|
57 |
+
if($attribute->getType() == 'text'){
|
58 |
+
//$textAttribute[] = $attribute;
|
59 |
+
$textTypes[] = array('label'=>$attribute->getTitle(),'value'=>$attribute->getAttributeCode());
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
$groups['scene7select'] = array('label' => 'Scene7 Select',
|
64 |
+
'render' => 'scenescene7/adminhtml_catalog_product_edit_tab_options_type_select',
|
65 |
+
'types' => $selectTypes
|
66 |
+
);
|
67 |
+
$groups['scene7text'] = array('label' => 'Scene7 Text',
|
68 |
+
'render' => 'adminhtml/catalog_product_edit_tab_options_type_text',
|
69 |
+
'types' => $textTypes
|
70 |
+
);
|
71 |
+
return $groups;
|
72 |
+
}
|
73 |
+
}
|
app/code/local/Achang/Scene7/controllers/Adminhtml/AttributeController.php
ADDED
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Achang_Scene7_Adminhtml_AttributeController extends Mage_Adminhtml_Controller_action
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _initAction() {
|
7 |
+
$this->loadLayout()
|
8 |
+
->_setActiveMenu('scenescene7/items')
|
9 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
10 |
+
|
11 |
+
return $this;
|
12 |
+
}
|
13 |
+
|
14 |
+
public function indexAction() {
|
15 |
+
$this->_initAction()
|
16 |
+
->renderLayout();
|
17 |
+
}
|
18 |
+
|
19 |
+
public function editAction() {
|
20 |
+
$id = $this->getRequest()->getParam('id');
|
21 |
+
$model = Mage::getModel('scenescene7/attribute')->load($id);
|
22 |
+
|
23 |
+
if ($model->getId() || $id == 0) {
|
24 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
25 |
+
if (!empty($data)) {
|
26 |
+
$model->setData($data);
|
27 |
+
}
|
28 |
+
|
29 |
+
Mage::register('attribute_data', $model);
|
30 |
+
|
31 |
+
$this->loadLayout();
|
32 |
+
$this->_setActiveMenu('scenescene7/items');
|
33 |
+
|
34 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
35 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
|
36 |
+
|
37 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
38 |
+
|
39 |
+
$this->_addContent($this->getLayout()->createBlock('scenescene7/adminhtml_attribute_edit'))
|
40 |
+
->_addLeft($this->getLayout()->createBlock('scenescene7/adminhtml_attribute_edit_tabs'));
|
41 |
+
|
42 |
+
$this->renderLayout();
|
43 |
+
} else {
|
44 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('scenescene7')->__('Item does not exist'));
|
45 |
+
$this->_redirect('*/*/');
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
public function newAction() {
|
50 |
+
$this->_forward('edit');
|
51 |
+
}
|
52 |
+
|
53 |
+
public function saveAction() {
|
54 |
+
if ($data = $this->getRequest()->getPost()) {
|
55 |
+
$model = Mage::getModel('scenescene7/attribute');
|
56 |
+
$model->setData($data)
|
57 |
+
->setId($this->getRequest()->getParam('id'));
|
58 |
+
|
59 |
+
try {
|
60 |
+
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
|
61 |
+
$model->setCreatedTime(now())
|
62 |
+
->setUpdateTime(now());
|
63 |
+
} else {
|
64 |
+
$model->setUpdateTime(now());
|
65 |
+
}
|
66 |
+
|
67 |
+
$model->save();
|
68 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('scenescene7')->__('Item was successfully saved'));
|
69 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
70 |
+
|
71 |
+
if ($this->getRequest()->getParam('back')) {
|
72 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
73 |
+
return;
|
74 |
+
}
|
75 |
+
$this->_redirect('*/*/');
|
76 |
+
return;
|
77 |
+
} catch (Exception $e) {
|
78 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
79 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
80 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
81 |
+
return;
|
82 |
+
}
|
83 |
+
}
|
84 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('scenescene7')->__('Unable to find item to save'));
|
85 |
+
$this->_redirect('*/*/');
|
86 |
+
}
|
87 |
+
|
88 |
+
public function deleteAction() {
|
89 |
+
if( $this->getRequest()->getParam('id') > 0 ) {
|
90 |
+
try {
|
91 |
+
$model = Mage::getModel('scenescene7/attribute');
|
92 |
+
|
93 |
+
$model->setId($this->getRequest()->getParam('id'))
|
94 |
+
->delete();
|
95 |
+
|
96 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
|
97 |
+
$this->_redirect('*/*/');
|
98 |
+
} catch (Exception $e) {
|
99 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
100 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
101 |
+
}
|
102 |
+
}
|
103 |
+
$this->_redirect('*/*/');
|
104 |
+
}
|
105 |
+
|
106 |
+
public function massDeleteAction() {
|
107 |
+
$attributeIds = $this->getRequest()->getParam('attribute');
|
108 |
+
if(!is_array($attributeIds)) {
|
109 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
|
110 |
+
} else {
|
111 |
+
try {
|
112 |
+
foreach ($attributeIds as $attributeId) {
|
113 |
+
$attribute = Mage::getModel('scenescene7/attribute')->load($attributeId);
|
114 |
+
$attribute->delete();
|
115 |
+
}
|
116 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
117 |
+
Mage::helper('adminhtml')->__(
|
118 |
+
'Total of %d record(s) were successfully deleted', count($attributeIds)
|
119 |
+
)
|
120 |
+
);
|
121 |
+
} catch (Exception $e) {
|
122 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
123 |
+
}
|
124 |
+
}
|
125 |
+
$this->_redirect('*/*/index');
|
126 |
+
}
|
127 |
+
|
128 |
+
public function massStatusAction()
|
129 |
+
{
|
130 |
+
$attributeIds = $this->getRequest()->getParam('attribute');
|
131 |
+
if(!is_array($attributeIds)) {
|
132 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
|
133 |
+
} else {
|
134 |
+
try {
|
135 |
+
foreach ($attributeIds as $attributeId) {
|
136 |
+
$attribute = Mage::getSingleton('scenescene7/attribute')
|
137 |
+
->load($attributeId)
|
138 |
+
->setStatus($this->getRequest()->getParam('status'))
|
139 |
+
->setIsMassupdate(true)
|
140 |
+
->save();
|
141 |
+
}
|
142 |
+
$this->_getSession()->addSuccess(
|
143 |
+
$this->__('Total of %d record(s) were successfully updated', count($attributeIds))
|
144 |
+
);
|
145 |
+
} catch (Exception $e) {
|
146 |
+
$this->_getSession()->addError($e->getMessage());
|
147 |
+
}
|
148 |
+
}
|
149 |
+
$this->_redirect('*/*/index');
|
150 |
+
}
|
151 |
+
|
152 |
+
public function exportCsvAction()
|
153 |
+
{
|
154 |
+
$fileName = 'attribute.csv';
|
155 |
+
$content = $this->getLayout()->createBlock('scenescene7/adminhtml_attribute_grid')
|
156 |
+
->getCsv();
|
157 |
+
|
158 |
+
$this->_sendUploadResponse($fileName, $content);
|
159 |
+
}
|
160 |
+
|
161 |
+
public function exportXmlAction()
|
162 |
+
{
|
163 |
+
$fileName = 'attribute.xml';
|
164 |
+
$content = $this->getLayout()->createBlock('scenescene7/adminhtml_attribute_grid')
|
165 |
+
->getXml();
|
166 |
+
|
167 |
+
$this->_sendUploadResponse($fileName, $content);
|
168 |
+
}
|
169 |
+
|
170 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
171 |
+
{
|
172 |
+
$response = $this->getResponse();
|
173 |
+
$response->setHeader('HTTP/1.1 200 OK','');
|
174 |
+
$response->setHeader('Pragma', 'public', true);
|
175 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
176 |
+
$response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
|
177 |
+
$response->setHeader('Last-Modified', date('r'));
|
178 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
179 |
+
$response->setHeader('Content-Length', strlen($content));
|
180 |
+
$response->setHeader('Content-type', $contentType);
|
181 |
+
$response->setBody($content);
|
182 |
+
$response->sendResponse();
|
183 |
+
die;
|
184 |
+
}
|
185 |
+
}
|
app/code/local/Achang/Scene7/controllers/IndexController.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Achang_Scene7_IndexController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
public function indexAction()
|
6 |
+
{
|
7 |
+
$datas = $this->getRequest()->getPost();
|
8 |
+
$product = Mage::getModel('catalog/product')->load($datas['product']);
|
9 |
+
$url = Mage::getModel('scenescene7/scene7')->setProduct($product)->setOptions($datas['options'])->toUrl();
|
10 |
+
if($url){
|
11 |
+
$arr = array('result'=>'ok','url'=>$url);
|
12 |
+
}else{
|
13 |
+
$arr = array('result'=>'failed','error'=>'error');
|
14 |
+
}
|
15 |
+
// Mage::log($arr);
|
16 |
+
echo Zend_Json::encode($arr);die();
|
17 |
+
}
|
18 |
+
}
|
app/code/local/Achang/Scene7/etc/adminhtml.xml
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<admin>
|
6 |
+
<children>
|
7 |
+
<catalog>
|
8 |
+
<children>
|
9 |
+
<scenescene7 translate="title" module="scenescene7">
|
10 |
+
<title>Scene7</title>
|
11 |
+
<sort_order>15</sort_order>
|
12 |
+
</scenescene7>
|
13 |
+
</children>
|
14 |
+
</catalog>
|
15 |
+
</children>
|
16 |
+
</admin>
|
17 |
+
</resources>
|
18 |
+
</acl>
|
19 |
+
<menu>
|
20 |
+
<catalog>
|
21 |
+
<children>
|
22 |
+
<scenescene7 translate="title" module="scenescene7">
|
23 |
+
<title>Scene7</title>
|
24 |
+
<sort_order>30</sort_order>
|
25 |
+
<children>
|
26 |
+
<Sceneattribute translate="title" module="scenescene7">
|
27 |
+
<title>Scene7 Attribute</title>
|
28 |
+
<action>scenescene7_admin/adminhtml_attribute/index/</action>
|
29 |
+
</Sceneattribute>
|
30 |
+
</children>
|
31 |
+
</scenescene7>
|
32 |
+
</children>
|
33 |
+
</catalog>
|
34 |
+
</menu>
|
35 |
+
</config>
|
app/code/local/Achang/Scene7/etc/config.xml
ADDED
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Achang_Scene7>
|
5 |
+
<version>0.5.4</version>
|
6 |
+
</Achang_Scene7>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<scenescene7>
|
11 |
+
<class>Achang_Scene7_Model</class>
|
12 |
+
<resourceModel>scenescene7_resource</resourceModel>
|
13 |
+
</scenescene7>
|
14 |
+
<scenescene7_resource>
|
15 |
+
<class>Achang_Scene7_Model_Resource</class>
|
16 |
+
<entities>
|
17 |
+
<product_option_description>
|
18 |
+
<table>catalog_product_option_description</table>
|
19 |
+
</product_option_description>
|
20 |
+
<product_option_type_detail>
|
21 |
+
<table>catalog_product_option_type_detail</table>
|
22 |
+
</product_option_type_detail>
|
23 |
+
<scene_scene7_attribute>
|
24 |
+
<table>scene_scene7_attribute</table>
|
25 |
+
</scene_scene7_attribute>
|
26 |
+
</entities>
|
27 |
+
</scenescene7_resource>
|
28 |
+
<catalog>
|
29 |
+
<rewrite>
|
30 |
+
<product_option>Achang_Scene7_Model_Catalog_Product_Option</product_option>
|
31 |
+
<product_option_value>Achang_Scene7_Model_Catalog_Product_Option_Value</product_option_value>
|
32 |
+
<product_option_type_default>Achang_Scene7_Model_Catalog_Product_Option_Type_Default</product_option_type_default>
|
33 |
+
</rewrite>
|
34 |
+
</catalog>
|
35 |
+
<adminhtml>
|
36 |
+
<rewrite>
|
37 |
+
<system_config_source_product_options_type>Achang_Scene7_Model_System_Config_Source_Product_Options_Type</system_config_source_product_options_type>
|
38 |
+
</rewrite>
|
39 |
+
</adminhtml>
|
40 |
+
</models>
|
41 |
+
<resources>
|
42 |
+
<scenescene7_setup>
|
43 |
+
<setup>
|
44 |
+
<module>Achang_Scene7</module>
|
45 |
+
<class>Mage_Eav_Model_Entity_Setup</class>
|
46 |
+
</setup>
|
47 |
+
<connection>
|
48 |
+
<use>core_setup</use>
|
49 |
+
</connection>
|
50 |
+
</scenescene7_setup>
|
51 |
+
<scenescene7_write>
|
52 |
+
<connection>
|
53 |
+
<use>core_write</use>
|
54 |
+
</connection>
|
55 |
+
</scenescene7_write>
|
56 |
+
<scenescene7_read>
|
57 |
+
<connection>
|
58 |
+
<use>core_read</use>
|
59 |
+
</connection>
|
60 |
+
</scenescene7_read>
|
61 |
+
</resources>
|
62 |
+
|
63 |
+
<catalog>
|
64 |
+
<product>
|
65 |
+
<type>
|
66 |
+
<scene7_product translate="label" module="scenescene7">
|
67 |
+
<label>Scene7 Product</label>
|
68 |
+
<model>scenescene7/product_type_scene7</model>
|
69 |
+
<composite>0</composite>
|
70 |
+
<is_qty>1</is_qty>
|
71 |
+
<price_model>scenescene7/product_price_scene7</price_model>
|
72 |
+
</scene7_product>
|
73 |
+
</type>
|
74 |
+
</product>
|
75 |
+
</catalog>
|
76 |
+
|
77 |
+
<blocks>
|
78 |
+
<scenescene7>
|
79 |
+
<class> Achang_Scene7_Block</class>
|
80 |
+
</scenescene7>
|
81 |
+
<adminhtml>
|
82 |
+
<rewrite>
|
83 |
+
<catalog_product_edit_tab_options_option>Achang_Scene7_Block_Adminhtml_Catalog_Product_Edit_Tab_Options_Option</catalog_product_edit_tab_options_option>
|
84 |
+
</rewrite>
|
85 |
+
</adminhtml>
|
86 |
+
<catalog>
|
87 |
+
<rewrite>
|
88 |
+
<product_view_options>Achang_Scene7_Block_Product_View_Options</product_view_options>
|
89 |
+
</rewrite>
|
90 |
+
</catalog>
|
91 |
+
<sales>
|
92 |
+
<rewrite>
|
93 |
+
<order_item_renderer_default>Achang_Scene7_Block_Sales_Order_Item_Renderer_Default</order_item_renderer_default>
|
94 |
+
</rewrite>
|
95 |
+
</sales>
|
96 |
+
</blocks>
|
97 |
+
<helpers>
|
98 |
+
<scenescene7>
|
99 |
+
<class>Achang_Scene7_Helper</class>
|
100 |
+
</scenescene7>
|
101 |
+
</helpers>
|
102 |
+
<events>
|
103 |
+
<!--
|
104 |
+
<adminhtml_catalog_product_edit_prepare_form>
|
105 |
+
<observers>
|
106 |
+
<scenescene7_observer>
|
107 |
+
<class>scenescene7/observer</class>
|
108 |
+
<method>prepareProductForm</method>
|
109 |
+
</scenescene7_observer>
|
110 |
+
</observers>
|
111 |
+
</adminhtml_catalog_product_edit_prepare_form>
|
112 |
+
-->
|
113 |
+
</events>
|
114 |
+
</global>
|
115 |
+
<frontend>
|
116 |
+
<layout>
|
117 |
+
<updates>
|
118 |
+
<scenescene7>
|
119 |
+
<file>achang_scene7.xml</file>
|
120 |
+
</scenescene7>
|
121 |
+
</updates>
|
122 |
+
</layout>
|
123 |
+
<routers>
|
124 |
+
<scenescene7>
|
125 |
+
<use>standard</use>
|
126 |
+
<args>
|
127 |
+
<module>Achang_Scene7</module>
|
128 |
+
<frontName>scene7</frontName>
|
129 |
+
</args>
|
130 |
+
</scenescene7>
|
131 |
+
</routers>
|
132 |
+
</frontend>
|
133 |
+
<admin>
|
134 |
+
<routers>
|
135 |
+
<scenescene7_admin>
|
136 |
+
<use>admin</use>
|
137 |
+
<args>
|
138 |
+
<module>Achang_Scene7</module>
|
139 |
+
<frontName>scenescene7_admin</frontName>
|
140 |
+
</args>
|
141 |
+
</scenescene7_admin>
|
142 |
+
</routers>
|
143 |
+
</admin>
|
144 |
+
<adminhtml>
|
145 |
+
<layout>
|
146 |
+
<updates>
|
147 |
+
<scenescene7>
|
148 |
+
<file>achang_scene7.xml</file>
|
149 |
+
</scenescene7>
|
150 |
+
</updates>
|
151 |
+
</layout>
|
152 |
+
<acl>
|
153 |
+
<resources>
|
154 |
+
<admin>
|
155 |
+
<children>
|
156 |
+
<system>
|
157 |
+
<children>
|
158 |
+
<config>
|
159 |
+
<children>
|
160 |
+
<scenescene7 translate="title" module="scenescene7">
|
161 |
+
<title>Scene7 Settings</title>
|
162 |
+
</scenescene7>
|
163 |
+
</children>
|
164 |
+
</config>
|
165 |
+
</children>
|
166 |
+
</system>
|
167 |
+
</children>
|
168 |
+
</admin>
|
169 |
+
</resources>
|
170 |
+
</acl>
|
171 |
+
</adminhtml>
|
172 |
+
</config>
|
app/code/local/Achang/Scene7/etc/system.xml
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<scene7tab translate="label" module="scenescene7">
|
5 |
+
<label>Scene7</label>
|
6 |
+
<sort_order>300</sort_order>
|
7 |
+
</scene7tab>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<scenescene7 translate="label" module="scenescene7">
|
11 |
+
<label>Scene7 Setting</label>
|
12 |
+
<tab>scene7tab</tab>
|
13 |
+
<sort_order>340</sort_order>
|
14 |
+
<show_in_default>1</show_in_default>
|
15 |
+
<show_in_website>1</show_in_website>
|
16 |
+
<show_in_store>1</show_in_store>
|
17 |
+
<groups>
|
18 |
+
<scene7settings translate="label">
|
19 |
+
<label>Scene7 Setting</label>
|
20 |
+
<frontend_type>text</frontend_type>
|
21 |
+
<sort_order>50</sort_order>
|
22 |
+
<show_in_default>1</show_in_default>
|
23 |
+
<show_in_website>1</show_in_website>
|
24 |
+
<show_in_store>1</show_in_store>
|
25 |
+
<fields>
|
26 |
+
<scene7_main_url translate="label">
|
27 |
+
<label>Scene7 Main Publish Url </label>
|
28 |
+
<frontend_type>text</frontend_type>
|
29 |
+
<sort_order>10</sort_order>
|
30 |
+
<show_in_default>1</show_in_default>
|
31 |
+
<show_in_website>1</show_in_website>
|
32 |
+
<show_in_store>0</show_in_store>
|
33 |
+
</scene7_main_url>
|
34 |
+
<scene7_company translate="label">
|
35 |
+
<label>Scene7 Company Code </label>
|
36 |
+
<frontend_type>text</frontend_type>
|
37 |
+
<sort_order>11</sort_order>
|
38 |
+
<show_in_default>1</show_in_default>
|
39 |
+
<show_in_website>1</show_in_website>
|
40 |
+
<show_in_store>0</show_in_store>
|
41 |
+
</scene7_company>
|
42 |
+
</fields>
|
43 |
+
</scene7settings>
|
44 |
+
</groups>
|
45 |
+
</scenescene7>
|
46 |
+
</sections>
|
47 |
+
</config>
|
app/code/local/Achang/Scene7/sql/scenescene7_setup/mysql4-install-0.5.0.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
|
5 |
+
$entityTypeId = $installer->getEntityTypeId('catalog_product');
|
6 |
+
$attrSetId = $installer->getAttributeSetId($entityTypeId, 'Default');
|
7 |
+
Mage::helper('scenescene7')->createAttributeSet('Scene7', $attrSetId);
|
8 |
+
|
9 |
+
$installer->removeAttribute('catalog_product', 'scene7_template');
|
10 |
+
$installer->addAttribute('catalog_product','scene7_template',array(
|
11 |
+
'group' =>'Scene7',
|
12 |
+
'label' => 'Scene7 Template Name',
|
13 |
+
'input' => 'text',
|
14 |
+
'type' => 'varchar',
|
15 |
+
'user_defined' => 1,
|
16 |
+
'apply_to' =>'scene7_product',
|
17 |
+
|
18 |
+
));
|
19 |
+
$installer->updateAttribute(Mage_Catalog_Model_Product::ENTITY, 'scene7_template', 'apply_to', 'scene7_product');
|
20 |
+
|
21 |
+
$installer->endSetup();
|
app/code/local/Achang/Scene7/sql/scenescene7_setup/mysql4-upgrade-0.5.0-0.5.1.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
|
4 |
+
$installer->startSetup();
|
5 |
+
|
6 |
+
$installer->run("
|
7 |
+
|
8 |
+
-- DROP TABLE IF EXISTS {$this->getTable('catalog_product_option_description')};
|
9 |
+
CREATE TABLE {$this->getTable('catalog_product_option_description')} (
|
10 |
+
`option_description_id` int(10) unsigned NOT NULL auto_increment,
|
11 |
+
`option_id` int(10) unsigned NOT NULL default '0',
|
12 |
+
`store_id` smallint(5) unsigned NOT NULL default '0',
|
13 |
+
`description` VARCHAR(500) NOT NULL default '',
|
14 |
+
PRIMARY KEY (`option_description_id`),
|
15 |
+
KEY `CATALOG_PRODUCT_OPTION_DESCRIPTION_OPTION` (`option_id`),
|
16 |
+
KEY `CATALOG_PRODUCT_OPTION_DESCRIPTION_STORE` (`store_id`),
|
17 |
+
CONSTRAINT `FK_CATALOG_PRODUCT_OPTION_DESCRIPTION_OPTION` FOREIGN KEY (`option_id`) REFERENCES {$this->getTable('catalog_product_option')} (`option_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
18 |
+
CONSTRAINT `FK_CATALOG_PRODUCT_OPTION_DESCRIPTION_STORE` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
|
19 |
+
)ENGINE=InnoDB default CHARSET=utf8;
|
20 |
+
|
21 |
+
|
22 |
+
-- DROP TABLE IF EXISTS {$this->getTable('catalog_product_option_type_detail')};
|
23 |
+
CREATE TABLE {$this->getTable('catalog_product_option_type_detail')} (
|
24 |
+
`catalog_product_option_type_detail_id` int(10) unsigned NOT NULL auto_increment,
|
25 |
+
`option_type_id` int(10) unsigned NOT NULL default '0',
|
26 |
+
`store_id` smallint(5) unsigned NOT NULL default '0',
|
27 |
+
`scene7_code` VARCHAR(500) default '',
|
28 |
+
PRIMARY KEY (`catalog_product_option_type_detail_id`),
|
29 |
+
KEY `CATALOG_PRODUCT_OPTION_TYPE_DETAIL_OPTION_TYPE` (`option_type_id`),
|
30 |
+
KEY `CATALOG_PRODUCT_OPTION_TYPE_DETAIL_STORE` (`store_id`),
|
31 |
+
CONSTRAINT `FK_CATALOG_PRODUCT_OPTION_TYPE_DETAIL_OPTION_TYPE` FOREIGN KEY (`option_type_id`) REFERENCES {$this->getTable('catalog_product_option_type_value')} (`option_type_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
32 |
+
CONSTRAINT `FK_CATALOG_PRODUCT_OPTION_TYPE_DETAIL_STORE` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
|
33 |
+
)ENGINE=InnoDB default CHARSET=utf8;
|
34 |
+
|
35 |
+
-- DROP TABLE IF EXISTS {$installer->getTable('scenescene7/scene_scene7_attribute')};
|
36 |
+
CREATE TABLE {$installer->getTable('scenescene7/scene_scene7_attribute')} (
|
37 |
+
`attribute_id` int(11) unsigned NOT NULL auto_increment,
|
38 |
+
`title` varchar(255) NOT NULL default '',
|
39 |
+
`scene7_code` varchar(255) NOT NULL default '',
|
40 |
+
`type` varchar(255) NOT NULL default '',
|
41 |
+
`created_time` datetime NULL,
|
42 |
+
`update_time` datetime NULL,
|
43 |
+
PRIMARY KEY (`attribute_id`)
|
44 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
45 |
+
|
46 |
+
");
|
47 |
+
|
48 |
+
$installer->endSetup();
|
app/code/local/Achang/Scene7/sql/scenescene7_setup/mysql4-upgrade-0.5.1-0.5.2.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
ALTER TABLE `{$installer->getTable('scenescene7/scene_scene7_attribute')}` ADD `attribute_code` VARCHAR( 255 ) NOT NULL AFTER `scene7_code`;
|
9 |
+
");
|
10 |
+
|
11 |
+
$installer->endSetup();
|
app/code/local/Achang/Scene7/sql/scenescene7_setup/mysql4-upgrade-0.5.2-0.5.3.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
|
5 |
+
$installer->updateAttribute(Mage_Catalog_Model_Product::ENTITY, 'price', 'apply_to', 'scene7_product');
|
6 |
+
$installer->updateAttribute(Mage_Catalog_Model_Product::ENTITY, 'cost', 'apply_to', 'scene7_product');
|
7 |
+
$installer->updateAttribute(Mage_Catalog_Model_Product::ENTITY, 'tier_price', 'apply_to', 'scene7_product');
|
8 |
+
$installer->updateAttribute(Mage_Catalog_Model_Product::ENTITY, 'special_price', 'apply_to', 'scene7_product');
|
9 |
+
$installer->updateAttribute(Mage_Catalog_Model_Product::ENTITY, 'special_from_date', 'apply_to', 'scene7_product');
|
10 |
+
$installer->updateAttribute(Mage_Catalog_Model_Product::ENTITY, 'special_to_date', 'apply_to', 'scene7_product');
|
11 |
+
$installer->updateAttribute(Mage_Catalog_Model_Product::ENTITY, 'enable_googlecheckout', 'apply_to', 'scene7_product');
|
12 |
+
|
13 |
+
$installer->endSetup();
|
app/code/local/Achang/Scene7/sql/scenescene7_setup/mysql4-upgrade-0.5.3-0.5.4.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
|
4 |
+
$installer->startSetup();
|
5 |
+
|
6 |
+
$installer->run("
|
7 |
+
ALTER TABLE `{$this->getTable('catalog_product_option_type_detail')}` ADD `is_default` INT NOT NULL AFTER `scene7_code`;
|
8 |
+
");
|
9 |
+
|
10 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/achang_scene7.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout>
|
3 |
+
<scenescene7_admin_adminhtml_attribute_index>
|
4 |
+
<reference name="content">
|
5 |
+
<block type="scenescene7/adminhtml_attribute" name="attribute" />
|
6 |
+
</reference>
|
7 |
+
</scenescene7_admin_adminhtml_attribute_index>
|
8 |
+
</layout>
|
app/design/frontend/default/default/layout/achang_scene7.xml
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout>
|
3 |
+
<PRODUCT_TYPE_scene7_product>
|
4 |
+
<label>Catalog Scene7 Product View (Scene7)</label>
|
5 |
+
<reference name="head">
|
6 |
+
<action method="addJs"><script>jquery/jquery-1.4.2.min.js</script></action>
|
7 |
+
<action method="addJs"><script>jquery/jquery-noconflict.js</script></action>
|
8 |
+
<action method="addJs"><script>jquery/jquery.ajaxmanager.js</script></action>
|
9 |
+
<action method="addCss"><stylesheet>css/scene7.css</stylesheet></action>
|
10 |
+
</reference>
|
11 |
+
<reference name="product.info">
|
12 |
+
<action method="setTemplate">
|
13 |
+
<template>scene7/catalog/product/view.phtml</template>
|
14 |
+
</action>
|
15 |
+
|
16 |
+
<block type="catalog/product_view_type_simple" name="product.info.simple" as="product_type_data" template="catalog/product/view/type/default.phtml">
|
17 |
+
<block type="core/text_list" name="product.info.simple.extra" as="product_type_data_extra" translate="label">
|
18 |
+
<label>Product Extra Info</label>
|
19 |
+
</block>
|
20 |
+
</block>
|
21 |
+
<!-- <remove name="product.info.media"/> -->
|
22 |
+
</reference>
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
<reference name="product.info.options">
|
27 |
+
<action method="setTemplate">
|
28 |
+
<template>scene7/catalog/product/view/options.phtml</template>
|
29 |
+
</action>
|
30 |
+
</reference>
|
31 |
+
|
32 |
+
</PRODUCT_TYPE_scene7_product>
|
33 |
+
|
34 |
+
<checkout_cart_index>
|
35 |
+
<reference name="checkout.cart">
|
36 |
+
<action method="addItemRender">
|
37 |
+
<type>scene7_product</type>
|
38 |
+
<block>scenescene7/cart_item_renderer_scene7</block>
|
39 |
+
<template>scene7/checkout/cart/scene7.phtml</template>
|
40 |
+
</action>
|
41 |
+
</reference>
|
42 |
+
</checkout_cart_index>
|
43 |
+
|
44 |
+
</layout>
|
45 |
+
|
46 |
+
|
app/design/frontend/default/default/template/scene7/catalog/product/view.phtml
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Product view template
|
29 |
+
*
|
30 |
+
* @see Mage_Catalog_Block_Product_View
|
31 |
+
* @see Mage_Review_Block_Product_View
|
32 |
+
*/
|
33 |
+
?>
|
34 |
+
<?php
|
35 |
+
$_helper = $this->helper('catalog/output');
|
36 |
+
$_product = $this->getProduct();
|
37 |
+
?>
|
38 |
+
<script type="text/javascript">
|
39 |
+
var optionsPrice = new Product.OptionsPrice(<?php echo $this->getJsonConfig() ?>);
|
40 |
+
</script>
|
41 |
+
<div id="messages_product_view"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
|
42 |
+
<div class="product-view">
|
43 |
+
<div class="product-essential">
|
44 |
+
<form action="<?php echo $this->getAddToCartUrl($_product) ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
|
45 |
+
<div class="no-display">
|
46 |
+
<input type="hidden" name="product" value="<?php echo $_product->getId() ?>" />
|
47 |
+
<input type="hidden" name="related_product" id="related-products-field" value="" />
|
48 |
+
</div>
|
49 |
+
|
50 |
+
<div class="product-shop">
|
51 |
+
<div class="product-name">
|
52 |
+
<h1><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h1>
|
53 |
+
</div>
|
54 |
+
|
55 |
+
<?php if ($this->canEmailToFriend()): ?>
|
56 |
+
<p class="email-friend"><a href="<?php echo $this->helper('catalog/product')->getEmailToFriendUrl($_product) ?>"><?php echo $this->__('Email to a Friend') ?></a></p>
|
57 |
+
<?php endif; ?>
|
58 |
+
|
59 |
+
<?php echo $this->getReviewsSummaryHtml($_product, false, true)?>
|
60 |
+
<?php echo $this->getChildHtml('alert_urls') ?>
|
61 |
+
<?php echo $this->getChildHtml('product_type_data') ?>
|
62 |
+
<?php echo $this->getTierPriceHtml() ?>
|
63 |
+
<?php echo $this->getChildHtml('extrahint') ?>
|
64 |
+
|
65 |
+
<?php if (!$this->hasOptions()):?>
|
66 |
+
<div class="add-to-box">
|
67 |
+
<?php if($_product->isSaleable()): ?>
|
68 |
+
<?php echo $this->getChildHtml('addtocart') ?>
|
69 |
+
<?php if( $this->helper('wishlist')->isAllow() || $_compareUrl=$this->helper('catalog/product_compare')->getAddUrl($_product)): ?>
|
70 |
+
<span class="or"><?php echo $this->__('OR') ?></span>
|
71 |
+
<?php endif; ?>
|
72 |
+
<?php endif; ?>
|
73 |
+
<?php echo $this->getChildHtml('addto') ?>
|
74 |
+
</div>
|
75 |
+
<?php echo $this->getChildHtml('extra_buttons') ?>
|
76 |
+
<?php else:?>
|
77 |
+
<?php echo $this->getChildHtml('addto') ?>
|
78 |
+
<?php endif; ?>
|
79 |
+
|
80 |
+
<?php if ($_product->getShortDescription()):?>
|
81 |
+
<div class="short-description">
|
82 |
+
<h2><?php echo $this->__('Quick Overview') ?></h2>
|
83 |
+
<div class="std"><?php echo $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description') ?></div>
|
84 |
+
</div>
|
85 |
+
<?php endif;?>
|
86 |
+
|
87 |
+
<?php echo $this->getChildHtml('other');?>
|
88 |
+
|
89 |
+
<?php if ($_product->isSaleable() && $this->hasOptions()):?>
|
90 |
+
<?php echo $this->getChildChildHtml('container1', '', true, true) ?>
|
91 |
+
<?php endif;?>
|
92 |
+
|
93 |
+
</div>
|
94 |
+
|
95 |
+
<div class="product-img-box">
|
96 |
+
<?php echo $this->getChildHtml('media') ?>
|
97 |
+
</div>
|
98 |
+
|
99 |
+
<div class="clearer"></div>
|
100 |
+
<?php if ($_product->isSaleable() && $this->hasOptions()):?>
|
101 |
+
<?php echo $this->getChildChildHtml('container2', '', true, true) ?>
|
102 |
+
<?php endif;?>
|
103 |
+
</form>
|
104 |
+
<script type="text/javascript">
|
105 |
+
//<![CDATA[
|
106 |
+
var productAddToCartForm = new VarienForm('product_addtocart_form');
|
107 |
+
productAddToCartForm.submit = function(button){
|
108 |
+
if (this.validator.validate()) {
|
109 |
+
this.form.submit();
|
110 |
+
if (button && button != 'undefined') {
|
111 |
+
button.disabled = true;
|
112 |
+
}
|
113 |
+
}
|
114 |
+
}.bind(productAddToCartForm);
|
115 |
+
//]]>
|
116 |
+
</script>
|
117 |
+
</div>
|
118 |
+
|
119 |
+
<div class="product-collateral">
|
120 |
+
<?php foreach ($this->getChildGroup('detailed_info', 'getChildHtml') as $alias => $html):?>
|
121 |
+
<div class="box-collateral <?php echo "box-{$alias}"?>">
|
122 |
+
<?php if ($title = $this->getChildData($alias, 'title')):?>
|
123 |
+
<h2><?php echo $this->escapeHtml($title); ?></h2>
|
124 |
+
<?php endif;?>
|
125 |
+
<?php echo $html; ?>
|
126 |
+
</div>
|
127 |
+
<?php endforeach;?>
|
128 |
+
<?php echo $this->getChildHtml('upsell_products') ?>
|
129 |
+
<?php echo $this->getChildHtml('product_additional_data') ?>
|
130 |
+
</div>
|
131 |
+
</div>
|
app/design/frontend/default/default/template/scene7/catalog/product/view/options.phtml
ADDED
@@ -0,0 +1,263 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $_options = Mage::helper('core')->decorateArray($this->getOptions()) ?>
|
2 |
+
<?php if (count($_options)):?>
|
3 |
+
<script type="text/javascript">
|
4 |
+
//<![CDATA[
|
5 |
+
var optionFileUpload = {
|
6 |
+
productForm : $('product_addtocart_form'),
|
7 |
+
formAction : '',
|
8 |
+
formElements : {},
|
9 |
+
upload : function(element){
|
10 |
+
this.formElements = this.productForm.select('input', 'select', 'textarea', 'button');
|
11 |
+
this.removeRequire(element.readAttribute('id').sub('option_', ''));
|
12 |
+
|
13 |
+
template = '<iframe id="upload_target" name="upload_target" style="width:0; height:0; border:0;"><\/iframe>';
|
14 |
+
|
15 |
+
Element.insert($('option_'+element.readAttribute('id').sub('option_', '')+'_uploaded_file'), {after: template});
|
16 |
+
|
17 |
+
this.formAction = this.productForm.action;
|
18 |
+
|
19 |
+
var baseUrl = '<?php echo $this->getUrl('*/product/upload') ?>';
|
20 |
+
var urlExt = 'option_id/'+element.readAttribute('id').sub('option_', '');
|
21 |
+
|
22 |
+
this.productForm.action = parseSidUrl(baseUrl, urlExt);
|
23 |
+
this.productForm.target = 'upload_target';
|
24 |
+
this.productForm.submit();
|
25 |
+
this.productForm.target = '';
|
26 |
+
this.productForm.action = this.formAction;
|
27 |
+
},
|
28 |
+
removeRequire : function(skipElementId){
|
29 |
+
for(var i=0; i<this.formElements.length; i++){
|
30 |
+
if (this.formElements[i].readAttribute('id') != 'option_'+skipElementId+'_file' && this.formElements[i].type != 'button') {
|
31 |
+
this.formElements[i].disabled='disabled';
|
32 |
+
}
|
33 |
+
}
|
34 |
+
},
|
35 |
+
addRequire : function(skipElementId){
|
36 |
+
for(var i=0; i<this.formElements.length; i++){
|
37 |
+
if (this.formElements[i].readAttribute('name') != 'options_'+skipElementId+'_file' && this.formElements[i].type != 'button') {
|
38 |
+
this.formElements[i].disabled='';
|
39 |
+
}
|
40 |
+
}
|
41 |
+
},
|
42 |
+
uploadCallback : function(data){
|
43 |
+
this.addRequire(data.optionId);
|
44 |
+
$('upload_target').remove();
|
45 |
+
|
46 |
+
if (data.error) {
|
47 |
+
|
48 |
+
} else {
|
49 |
+
$('option_'+data.optionId+'_uploaded_file').value = data.fileName;
|
50 |
+
$('option_'+data.optionId+'_file').value = '';
|
51 |
+
$('option_'+data.optionId+'_file').hide();
|
52 |
+
$('option_'+data.optionId+'').hide();
|
53 |
+
template = '<div id="option_'+data.optionId+'_file_box"><a href="#"><img src="var/options/'+data.fileName+'" alt=""><\/a><a href="#" onclick="optionFileUpload.removeFile('+data.optionId+')" title="Remove file" \/>Remove file<\/a>';
|
54 |
+
|
55 |
+
Element.insert($('option_'+data.optionId+'_uploaded_file'), {after: template});
|
56 |
+
}
|
57 |
+
},
|
58 |
+
removeFile : function(optionId)
|
59 |
+
{
|
60 |
+
$('option_'+optionId+'_uploaded_file').value= '';
|
61 |
+
$('option_'+optionId+'_file').show();
|
62 |
+
$('option_'+optionId+'').show();
|
63 |
+
|
64 |
+
$('option_'+optionId+'_file_box').remove();
|
65 |
+
}
|
66 |
+
}
|
67 |
+
var optionTextCounter = {
|
68 |
+
count : function(field,cntfield,maxlimit){
|
69 |
+
if (field.value.length > maxlimit){
|
70 |
+
field.value = field.value.substring(0, maxlimit);
|
71 |
+
} else {
|
72 |
+
cntfield.innerHTML = maxlimit - field.value.length;
|
73 |
+
}
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
Product.Options = Class.create();
|
78 |
+
Product.Options.prototype = {
|
79 |
+
initialize : function(config){
|
80 |
+
this.config = config;
|
81 |
+
this.reloadPrice();
|
82 |
+
},
|
83 |
+
reloadPrice : function(){
|
84 |
+
price = new Number();
|
85 |
+
config = this.config;
|
86 |
+
skipIds = [];
|
87 |
+
$$('.product-custom-option').each(function(element){
|
88 |
+
var optionId = 0;
|
89 |
+
element.name.sub(/[0-9]+/, function(match){
|
90 |
+
optionId = match[0];
|
91 |
+
});
|
92 |
+
if (this.config[optionId]) {
|
93 |
+
if (element.type == 'checkbox' || element.type == 'radio') {
|
94 |
+
if (element.checked) {
|
95 |
+
if (config[optionId][element.getValue()]) {
|
96 |
+
price += parseFloat(config[optionId][element.getValue()]);
|
97 |
+
}
|
98 |
+
}
|
99 |
+
} else if(element.hasClassName('datetime-picker') && !skipIds.include(optionId)) {
|
100 |
+
dateSelected = true;
|
101 |
+
$$('.product-custom-option[id^="options_' + optionId + '"]').each(function(dt){
|
102 |
+
if (dt.getValue() == '') {
|
103 |
+
dateSelected = false;
|
104 |
+
}
|
105 |
+
});
|
106 |
+
if (dateSelected) {
|
107 |
+
price += parseFloat(this.config[optionId]);
|
108 |
+
skipIds[optionId] = optionId;
|
109 |
+
}
|
110 |
+
} else if(element.type == 'select-one' || element.type == 'select-multiple') {
|
111 |
+
if (element.options) {
|
112 |
+
$A(element.options).each(function(selectOption){
|
113 |
+
if (selectOption.selected) {
|
114 |
+
if (this.config[optionId][selectOption.value]) {
|
115 |
+
price += parseFloat(this.config[optionId][selectOption.value]);
|
116 |
+
}
|
117 |
+
}
|
118 |
+
});
|
119 |
+
}
|
120 |
+
} else {
|
121 |
+
if (element.getValue().strip() != '') {
|
122 |
+
price += parseFloat(this.config[optionId]);
|
123 |
+
}
|
124 |
+
}
|
125 |
+
}
|
126 |
+
});
|
127 |
+
try {
|
128 |
+
optionsPrice.changePrice('options', price);
|
129 |
+
optionsPrice.reload();
|
130 |
+
this.updateImage();
|
131 |
+
} catch (e) {
|
132 |
+
|
133 |
+
}
|
134 |
+
},
|
135 |
+
updateImage : function(){//added by Minglong
|
136 |
+
var flag = false;
|
137 |
+
$$('.product-custom-option').each(function(element){
|
138 |
+
var optionId = 0;
|
139 |
+
element.name.sub(/[0-9]+/, function(match){
|
140 |
+
optionId = match[0];
|
141 |
+
});
|
142 |
+
if (this.config[optionId]) {
|
143 |
+
if(element.type == 'select-one') {
|
144 |
+
if (element.options) {
|
145 |
+
$A(element.options).each(function(selectOption){
|
146 |
+
if (selectOption.selected) {
|
147 |
+
if (this.config[optionId][selectOption.value]) {
|
148 |
+
if(opscene7Config[optionId]){
|
149 |
+
if(!opscene7Config[optionId][selectOption.value]['scene7_code']){
|
150 |
+
alert("no scene7 code on the option"+ selectOption.value +"!");
|
151 |
+
}else{
|
152 |
+
flag = true;
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
}
|
157 |
+
}
|
158 |
+
});
|
159 |
+
}
|
160 |
+
}
|
161 |
+
}
|
162 |
+
});
|
163 |
+
|
164 |
+
if(flag){
|
165 |
+
//var form = $('product_addtocart_form');
|
166 |
+
var url = '<?php echo $this->getUrl('scene7/index/index');?>';
|
167 |
+
//var myAjax = new Ajax.Request(url,{method:'post', parameters: Form.serialize(form),onComplete:updateImg});
|
168 |
+
var $imageChangeAjax = $j.manageAjax.create('imageChange', {queue: true, cacheResponse: true, abortOld: true});
|
169 |
+
$imageChangeAjax.add({type:'POST',url: url, dataType: 'json', data: $j("#product_addtocart_form").serialize(),
|
170 |
+
beforeSend: function(data) {
|
171 |
+
updateImageStart();
|
172 |
+
},
|
173 |
+
success: function(data) {
|
174 |
+
if(data.result == "ok"){
|
175 |
+
$j('#image').attr('src',data.url).load(function(){
|
176 |
+
$j('#src_option').val(data.url);
|
177 |
+
updateImageStop();
|
178 |
+
});
|
179 |
+
}else{
|
180 |
+
alert(data.error);
|
181 |
+
}
|
182 |
+
},
|
183 |
+
error: function(res, status, errorThrown) {
|
184 |
+
updateImageStop();
|
185 |
+
}
|
186 |
+
});
|
187 |
+
}
|
188 |
+
}
|
189 |
+
}
|
190 |
+
function validateOptionsCallback(elmId, result){
|
191 |
+
var container = $(elmId).up('ul.options-list');
|
192 |
+
if (result == 'failed') {
|
193 |
+
container.removeClassName('validation-passed');
|
194 |
+
container.addClassName('validation-failed');
|
195 |
+
} else {
|
196 |
+
container.removeClassName('validation-failed');
|
197 |
+
container.addClassName('validation-passed');
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
var opConfig = new Product.Options(<?php echo $this->getJsonConfig() ?>);
|
202 |
+
//added by Minglong
|
203 |
+
var opscene7Config = <?php echo $this->getScene7AttributeJsonConfig();?>;
|
204 |
+
var $image = $j('#image');
|
205 |
+
function updateImageStart() {
|
206 |
+
var loading = $image.next('span.image_loading');
|
207 |
+
if (!loading.size()) {
|
208 |
+
loading = $j('<span class="image_loading"></span>').insertAfter($image);
|
209 |
+
}
|
210 |
+
var cssleft = Math.floor(($image.width() - loading.width()) / 2);
|
211 |
+
var csstop = Math.floor(((parseInt($image.height()) > 15 ? $image.height() : 400) - loading.height()) / 2);
|
212 |
+
loading.css({'position':'absolute', 'left':cssleft, 'top':csstop}).show();
|
213 |
+
}
|
214 |
+
|
215 |
+
function updateImageStop() {
|
216 |
+
var loading = $image.next('span.image_loading');
|
217 |
+
if (loading.size()) {
|
218 |
+
loading.hide();
|
219 |
+
}
|
220 |
+
}
|
221 |
+
|
222 |
+
$j(document).ready(function(){
|
223 |
+
var opConfig2 = <?php echo $this->getJsonConfig() ?>;
|
224 |
+
var opscene7Config = <?php echo $this->getScene7AttributeJsonConfig();?>;
|
225 |
+
|
226 |
+
$$('.product-custom-option').each(function(element){
|
227 |
+
var optionId = 0;
|
228 |
+
element.name.sub(/[0-9]+/, function(match){
|
229 |
+
optionId = match[0];
|
230 |
+
});
|
231 |
+
if (opConfig2[optionId]) {
|
232 |
+
if(element.type == 'select-one') {
|
233 |
+
if (element.options) {
|
234 |
+
$A(element.options).each(function(selectOption){
|
235 |
+
if (opConfig2[optionId][selectOption.value]) {
|
236 |
+
if(opscene7Config[optionId]){
|
237 |
+
if(opscene7Config[optionId][selectOption.value]['is_default']){
|
238 |
+
if(opscene7Config[optionId][selectOption.value]['is_default'] == '1'){
|
239 |
+
element.value = selectOption.value;
|
240 |
+
}
|
241 |
+
}
|
242 |
+
|
243 |
+
}
|
244 |
+
|
245 |
+
}
|
246 |
+
});
|
247 |
+
}
|
248 |
+
}
|
249 |
+
}
|
250 |
+
|
251 |
+
});
|
252 |
+
opConfig.reloadPrice();
|
253 |
+
});
|
254 |
+
//ended by Minglong
|
255 |
+
//]]>
|
256 |
+
</script>
|
257 |
+
<dl>
|
258 |
+
<?php foreach($_options as $_option): ?>
|
259 |
+
<?php echo $this->getOptionHtml($_option) ?>
|
260 |
+
<?php endforeach; ?>
|
261 |
+
<input type="hidden" id="src_option" name="src_option" value=""/>
|
262 |
+
</dl>
|
263 |
+
<?php endif; ?>
|
app/design/frontend/default/default/template/scene7/catalog/product/view/options/type/scene7select.phtml
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php /* @var $this Mage_Catalog_Block_Product_View_Options_Type_Select */ ?>
|
28 |
+
<?php $_option = $this->getOption() ?>
|
29 |
+
<dt><label<?php if ($_option->getIsRequire()) echo ' class="required"' ?>><?php if ($_option->getIsRequire()) echo '<em>*</em>' ?><?php echo $this->htmlEscape($_option->getTitle()) ?></label></dt>
|
30 |
+
<dd<?php if ($_option->decoratedIsLast){?> class="last"<?php }?>>
|
31 |
+
<div class="input-box">
|
32 |
+
<?php echo $this->getValuesHtml() ?>
|
33 |
+
<?php if ($_option->getIsRequire()): ?>
|
34 |
+
<?php if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_RADIO || $_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX): ?>
|
35 |
+
<span id="options-<?php echo $_option->getId() ?>-container"></span>
|
36 |
+
<?php endif; ?>
|
37 |
+
<?php endif;?>
|
38 |
+
</div>
|
39 |
+
</dd>
|
app/design/frontend/default/default/template/scene7/catalog/product/view/options/type/scene7text.phtml
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php $_option = $this->getOption() ?>
|
28 |
+
<dt><label<?php if ($_option->getIsRequire()) echo ' class="required"' ?>><?php if ($_option->getIsRequire()) echo '<em>*</em>' ?><?php echo $this->htmlEscape($_option->getTitle()) ?></label>
|
29 |
+
<?php echo $this->getFormatedPrice() ?></dt>
|
30 |
+
<dd<?php if ($_option->decoratedIsLast){?> class="last"<?php }?>>
|
31 |
+
<div class="input-box">
|
32 |
+
<?php if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_FIELD): ?>
|
33 |
+
<input type="text" onchange="opConfig.reloadPrice()" id="options_<?php echo $_option->getId() ?>_text" class="input-text<?php echo $_option->getIsRequire() ? ' required-entry' : '' ?> <?php echo $_option->getMaxCharacters() ? ' validate-length maximum-length-'.$_option->getMaxCharacters() : '' ?> product-custom-option" name="options[<?php echo $_option->getId() ?>]" value="" />
|
34 |
+
<?php elseif ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_AREA): ?>
|
35 |
+
<textarea id="options_<?php echo $_option->getId() ?>_text" onchange="opConfig.reloadPrice()" class="<?php echo $_option->getIsRequire() ? ' required-entry' : '' ?> <?php echo $_option->getMaxCharacters() ? ' validate-length maximum-length-'.$_option->getMaxCharacters() : '' ?> product-custom-option" name="options[<?php echo $_option->getId() ?>]" rows="5" cols="25"></textarea>
|
36 |
+
<?php endif; ?>
|
37 |
+
<?php if ($_option->getMaxCharacters()): ?>
|
38 |
+
<p class="note"><?php echo Mage::helper('catalog')->__('Maximum number of characters:')?> <strong><?php echo $_option->getMaxCharacters() ?></strong></p>
|
39 |
+
<?php endif; ?>
|
40 |
+
</div>
|
41 |
+
</dd>
|
app/design/frontend/default/default/template/scene7/checkout/cart/scene7.phtml
ADDED
@@ -0,0 +1,244 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php $_item = $this->getItem()?>
|
28 |
+
<tr>
|
29 |
+
<td><?php if ($this->hasProductUrl()):?><a href="<?php echo $this->getProductUrl() ?>" title="<?php echo $this->htmlEscape($this->getProductName()) ?>" class="product-image"><?php endif;?><img src="<?php echo $this->getProductThumbnail()->resize(75); ?>" width="75" height="75" alt="<?php echo $this->htmlEscape($this->getProductName()) ?>" /><?php if ($this->hasProductUrl()):?></a><?php endif;?></td>
|
30 |
+
<td>
|
31 |
+
<h2 class="product-name">
|
32 |
+
<?php if ($this->hasProductUrl()):?>
|
33 |
+
<a href="<?php echo $this->getProductUrl() ?>"><?php echo $this->htmlEscape($this->getProductName()) ?></a>
|
34 |
+
<?php else: ?>
|
35 |
+
<?php echo $this->htmlEscape($this->getProductName()) ?>
|
36 |
+
<?php endif; ?>
|
37 |
+
</h2>
|
38 |
+
<?php if ($_options = $this->getOptionList()):?>
|
39 |
+
<dl class="item-options">
|
40 |
+
<?php foreach ($_options as $_option) : ?>
|
41 |
+
<?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
|
42 |
+
<dt><?php echo $this->htmlEscape($_option['label']) ?></dt>
|
43 |
+
<dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>><?php echo $_formatedOptionValue['value'] ?>
|
44 |
+
<?php if (isset($_formatedOptionValue['full_view'])): ?>
|
45 |
+
<div class="truncated_full_value">
|
46 |
+
<dl class="item-options">
|
47 |
+
<dt><?php echo $this->htmlEscape($_option['label']) ?></dt>
|
48 |
+
<dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
|
49 |
+
</dl>
|
50 |
+
</div>
|
51 |
+
<?php endif; ?>
|
52 |
+
</dd>
|
53 |
+
<?php endforeach; ?>
|
54 |
+
</dl>
|
55 |
+
<?php endif;?>
|
56 |
+
<?php if ($messages = $this->getMessages()): ?>
|
57 |
+
<?php foreach ($messages as $message): ?>
|
58 |
+
<p class="item-msg <?php echo $message['type'] ?>">* <?php echo $message['text'] ?></p>
|
59 |
+
<?php endforeach; ?>
|
60 |
+
<?php endif; ?>
|
61 |
+
<?php if ($addtInfoBlock = $this->getProductAdditionalInformationBlock()):?>
|
62 |
+
<?php echo $addtInfoBlock->setItem($_item)->toHtml() ?>
|
63 |
+
<?php endif;?>
|
64 |
+
</td>
|
65 |
+
<?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
|
66 |
+
<td class="a-center">
|
67 |
+
<input type="checkbox" value="1" name="cart[<?php echo $_item->getId() ?>][wishlist]" title="<?php echo $this->__('Move to Wishlist') ?>" class="checkbox" />
|
68 |
+
</td>
|
69 |
+
<?php endif ?>
|
70 |
+
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
71 |
+
<td class="a-right">
|
72 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
73 |
+
<span class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
74 |
+
<?php else: ?>
|
75 |
+
<span class="cart-price">
|
76 |
+
<?php endif; ?>
|
77 |
+
|
78 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
79 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
|
80 |
+
<?php else: ?>
|
81 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
|
82 |
+
<?php endif; ?>
|
83 |
+
|
84 |
+
</span>
|
85 |
+
|
86 |
+
|
87 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
88 |
+
|
89 |
+
<div class="cart-tax-info" id="eunit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
90 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
91 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
92 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
|
93 |
+
<?php endforeach; ?>
|
94 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
95 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
96 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
|
97 |
+
<?php endforeach; ?>
|
98 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
99 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
100 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
|
101 |
+
<?php endforeach; ?>
|
102 |
+
<?php endif; ?>
|
103 |
+
</div>
|
104 |
+
|
105 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
106 |
+
<div class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
107 |
+
<span class="weee"><?php echo Mage::helper('weee')->__('Total'); ?>: <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span>
|
108 |
+
</div>
|
109 |
+
<?php endif; ?>
|
110 |
+
<?php endif; ?>
|
111 |
+
</td>
|
112 |
+
<?php endif; ?>
|
113 |
+
<?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
114 |
+
<td>
|
115 |
+
<?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
|
116 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
117 |
+
<span class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
118 |
+
<?php else: ?>
|
119 |
+
<span class="cart-price">
|
120 |
+
<?php endif; ?>
|
121 |
+
|
122 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
123 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?>
|
124 |
+
<?php else: ?>
|
125 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?>
|
126 |
+
<?php endif; ?>
|
127 |
+
|
128 |
+
</span>
|
129 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
130 |
+
|
131 |
+
<div class="cart-tax-info" id="unit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
132 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
133 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
134 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
|
135 |
+
<?php endforeach; ?>
|
136 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
137 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
138 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
|
139 |
+
<?php endforeach; ?>
|
140 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
141 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
142 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
|
143 |
+
<?php endforeach; ?>
|
144 |
+
<?php endif; ?>
|
145 |
+
</div>
|
146 |
+
|
147 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
148 |
+
<div class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
149 |
+
<span class="weee"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>: <?php echo $this->helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?></span>
|
150 |
+
</div>
|
151 |
+
<?php endif; ?>
|
152 |
+
<?php endif; ?>
|
153 |
+
</td>
|
154 |
+
<?php endif; ?>
|
155 |
+
<td class="a-center">
|
156 |
+
<input name="cart[<?php echo $_item->getId() ?>][qty]" value="<?php echo $this->getQty() ?>" size="4" title="<?php echo $this->__('Qty') ?>" class="input-text qty" maxlength="12" />
|
157 |
+
</td>
|
158 |
+
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
159 |
+
<td class="a-right">
|
160 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
161 |
+
<span class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
162 |
+
<?php else: ?>
|
163 |
+
<span class="cart-price">
|
164 |
+
<?php endif; ?>
|
165 |
+
|
166 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
167 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
|
168 |
+
<?php else: ?>
|
169 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()) ?>
|
170 |
+
<?php endif; ?>
|
171 |
+
|
172 |
+
</span>
|
173 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
174 |
+
|
175 |
+
<div class="cart-tax-info" id="esubtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
176 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
177 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
178 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span>
|
179 |
+
<?php endforeach; ?>
|
180 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
181 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
182 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
|
183 |
+
<?php endforeach; ?>
|
184 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
185 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
186 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
|
187 |
+
<?php endforeach; ?>
|
188 |
+
<?php endif; ?>
|
189 |
+
</div>
|
190 |
+
|
191 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
192 |
+
<div class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
193 |
+
<span class="weee"><?php echo Mage::helper('weee')->__('Total'); ?>: <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?></span>
|
194 |
+
</div>
|
195 |
+
<?php endif; ?>
|
196 |
+
<?php endif; ?>
|
197 |
+
</td>
|
198 |
+
<?php endif; ?>
|
199 |
+
<?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
200 |
+
<td>
|
201 |
+
<?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
|
202 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
203 |
+
<span class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
204 |
+
<?php else: ?>
|
205 |
+
<span class="cart-price">
|
206 |
+
<?php endif; ?>
|
207 |
+
|
208 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
209 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
|
210 |
+
<?php else: ?>
|
211 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
|
212 |
+
<?php endif; ?>
|
213 |
+
|
214 |
+
</span>
|
215 |
+
|
216 |
+
|
217 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
218 |
+
|
219 |
+
<div class="cart-tax-info" id="subtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
220 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
221 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
222 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span>
|
223 |
+
<?php endforeach; ?>
|
224 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
225 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
226 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
|
227 |
+
<?php endforeach; ?>
|
228 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
229 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
230 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
|
231 |
+
<?php endforeach; ?>
|
232 |
+
<?php endif; ?>
|
233 |
+
</div>
|
234 |
+
|
235 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
236 |
+
<div class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
237 |
+
<span class="weee"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>: <?php echo $this->helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?></span>
|
238 |
+
</div>
|
239 |
+
<?php endif; ?>
|
240 |
+
<?php endif; ?>
|
241 |
+
</td>
|
242 |
+
<?php endif; ?>
|
243 |
+
<td class="a-center"><a href="<?php echo $this->getDeleteUrl() ?>" title="<?php echo $this->__('Remove item')?>" class="btn-remove btn-remove2"><?php echo $this->__('Remove item')?></a></td>
|
244 |
+
</tr>
|
app/etc/modules/Achang_All.xml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Achang_Scene7>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
<depends>
|
8 |
+
<Mage_Adminhtml />
|
9 |
+
<Mage_Catalog />
|
10 |
+
</depends>
|
11 |
+
</Achang_Scene7>
|
12 |
+
</modules>
|
13 |
+
</config>
|
js/jquery/jquery-1.4.2.min.js
ADDED
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* jQuery JavaScript Library v1.4.2
|
3 |
+
* http://jquery.com/
|
4 |
+
*
|
5 |
+
* Copyright 2010, John Resig
|
6 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
7 |
+
* http://jquery.org/license
|
8 |
+
*
|
9 |
+
* Includes Sizzle.js
|
10 |
+
* http://sizzlejs.com/
|
11 |
+
* Copyright 2010, The Dojo Foundation
|
12 |
+
* Released under the MIT, BSD, and GPL Licenses.
|
13 |
+
*
|
14 |
+
* Date: Sat Feb 13 22:33:48 2010 -0500
|
15 |
+
*/
|
16 |
+
(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i?
|
17 |
+
e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r=
|
18 |
+
j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g,
|
19 |
+
"&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e=
|
20 |
+
true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/,
|
21 |
+
Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&&
|
22 |
+
(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this,
|
23 |
+
a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b===
|
24 |
+
"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,
|
25 |
+
function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)||
|
26 |
+
c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded",
|
27 |
+
L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,
|
28 |
+
"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+
|
29 |
+
a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
|
30 |
+
d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===
|
31 |
+
a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&&
|
32 |
+
!c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari=
|
33 |
+
true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
|
34 |
+
var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected,
|
35 |
+
parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent=
|
36 |
+
false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n=
|
37 |
+
s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,
|
38 |
+
applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando];
|
39 |
+
else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,
|
40 |
+
a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===
|
41 |
+
w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i,
|
42 |
+
cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ",
|
43 |
+
i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" ",
|
44 |
+
" ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=
|
45 |
+
this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i=
|
46 |
+
e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected=
|
47 |
+
c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");
|
48 |
+
a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g,
|
49 |
+
function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split(".");
|
50 |
+
k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a),
|
51 |
+
C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!=
|
52 |
+
null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=
|
53 |
+
e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&&
|
54 |
+
f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;
|
55 |
+
if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
|
56 |
+
fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
|
57 |
+
d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this,
|
58 |
+
"events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=
|
59 |
+
a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,
|
60 |
+
isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit=
|
61 |
+
{setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};
|
62 |
+
if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",
|
63 |
+
e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,
|
64 |
+
"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a,
|
65 |
+
d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&
|
66 |
+
!a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},
|
67 |
+
toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector,
|
68 |
+
u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),
|
69 |
+
function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];
|
70 |
+
if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
|
71 |
+
e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift();
|
72 |
+
t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D||
|
73 |
+
g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[];
|
74 |
+
for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length-
|
75 |
+
1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
|
76 |
+
CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},
|
77 |
+
relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]=
|
78 |
+
l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[];
|
79 |
+
h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},
|
80 |
+
CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m,
|
81 |
+
g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},
|
82 |
+
text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},
|
83 |
+
setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=
|
84 |
+
h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m=
|
85 |
+
m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m===
|
86 |
+
"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g,
|
87 |
+
h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition||
|
88 |
+
!h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m=
|
89 |
+
h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&&
|
90 |
+
q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>";
|
91 |
+
if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}();
|
92 |
+
(function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}:
|
93 |
+
function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/,
|
94 |
+
gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;
|
95 |
+
c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j=
|
96 |
+
{},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){i=a[e];j[i]||(j[i]=c.expr.match.POS.test(i)?c(i,b||this.context):i)}for(;f&&f.ownerDocument&&f!==b;){for(i in j){e=j[i];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a===
|
97 |
+
"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",
|
98 |
+
d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?
|
99 |
+
a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType===
|
100 |
+
1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)?
|
101 |
+
a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
|
102 |
+
c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
|
103 |
+
wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},
|
104 |
+
prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,
|
105 |
+
this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
|
106 |
+
return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja,
|
107 |
+
""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var j=c(this),i=j.html();j.empty().append(function(){return a.call(this,e,i)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&
|
108 |
+
this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,b,f))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(u){return c.nodeName(u,"table")?u.getElementsByTagName("tbody")[0]||
|
109 |
+
u.appendChild(u.ownerDocument.createElement("tbody")):u}var e,j,i=a[0],o=[],k;if(!c.support.checkClone&&arguments.length===3&&typeof i==="string"&&ua.test(i))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(i))return this.each(function(u){var z=c(this);a[0]=i.call(this,u,b?z.html():w);z.domManip(a,b,d)});if(this[0]){e=i&&i.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:sa(a,this,o);k=e.fragment;if(j=k.childNodes.length===
|
110 |
+
1?(k=k.firstChild):k.firstChild){b=b&&c.nodeName(j,"tr");for(var n=0,r=this.length;n<r;n++)d.call(b?f(this[n],j):this[n],n>0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]);
|
111 |
+
return this}else{e=0;for(var j=d.length;e<j;e++){var i=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["",
|
112 |
+
""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]==="<table>"&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e=
|
113 |
+
c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]?
|
114 |
+
c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja=
|
115 |
+
function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=
|
116 |
+
Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,
|
117 |
+
"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=
|
118 |
+
a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=
|
119 |
+
a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/<script(.|\s)*?\/script>/gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!==
|
120 |
+
"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("<div />").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this},
|
121 |
+
serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),
|
122 |
+
function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,
|
123 |
+
global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&&
|
124 |
+
e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)?
|
125 |
+
"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===
|
126 |
+
false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B=
|
127 |
+
false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since",
|
128 |
+
c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E||
|
129 |
+
d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x);
|
130 |
+
g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===
|
131 |
+
1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b===
|
132 |
+
"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional;
|
133 |
+
if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");
|
134 |
+
this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],
|
135 |
+
"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},
|
136 |
+
animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.replace(ia,ja);if(i!==n){a[n]=a[i];delete a[i];i=n}if(a[i]==="hide"&&o||a[i]==="show"&&!o)return j.complete.call(this);if((i==="height"||i==="width")&&this.style){j.display=c.css(this,"display");j.overflow=this.style.overflow}if(c.isArray(a[i])){(j.specialEasing=
|
137 |
+
j.specialEasing||{})[i]=a[i][1];a[i]=a[i][0]}}if(j.overflow!=null)this.style.overflow="hidden";j.curAnim=c.extend({},a);c.each(a,function(r,u){var z=new c.fx(k,j,r);if(Ab.test(u))z[u==="toggle"?o?"show":"hide":u](a);else{var C=Bb.exec(u),B=z.cur(true)||0;if(C){u=parseFloat(C[2]);var E=C[3]||"px";if(E!=="px"){k.style[r]=(u||1)+E;B=(u||1)/z.cur(true)*B;k.style[r]=B+E}if(C[1])u=(C[1]==="-="?-1:1)*u+B;z.custom(B,u,E)}else z.custom(B,u,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);
|
138 |
+
this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration===
|
139 |
+
"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||
|
140 |
+
c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;
|
141 |
+
this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=
|
142 |
+
this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,
|
143 |
+
e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||
|
144 |
+
c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement?
|
145 |
+
function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=
|
146 |
+
this[0];if(a)return this.each(function(r){c.offset.setOffset(this,a,r)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=b,e=b.ownerDocument,j,i=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var k=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==i;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;j=e?e.getComputedStyle(b,null):b.currentStyle;
|
147 |
+
k-=b.scrollTop;n-=b.scrollLeft;if(b===d){k+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&j.overflow!=="visible"){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=j}if(f.position==="relative"||f.position==="static"){k+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&&
|
148 |
+
f.position==="fixed"){k+=Math.max(i.scrollTop,o.scrollTop);n+=Math.max(i.scrollLeft,o.scrollLeft)}return{top:k,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),d,f,e,j=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
|
149 |
+
a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b);
|
150 |
+
c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,
|
151 |
+
d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-
|
152 |
+
f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset":
|
153 |
+
"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in
|
154 |
+
e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window);
|
js/jquery/jquery-noconflict.js
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var $j = jQuery.noConflict();
|
2 |
+
|
3 |
+
function obj2str(o) {
|
4 |
+
var r = [];
|
5 |
+
if (typeof o == "string" || o == null) {
|
6 |
+
return o;
|
7 |
+
}
|
8 |
+
if (typeof o == "object") {
|
9 |
+
if (!o.sort) {
|
10 |
+
r[0] = "{";
|
11 |
+
for ( var i in o) {
|
12 |
+
r[r.length] = i;
|
13 |
+
r[r.length] = ":";
|
14 |
+
r[r.length] = obj2str(o[i]);
|
15 |
+
r[r.length] = ",";
|
16 |
+
}
|
17 |
+
r[r.length - 1] = "}";
|
18 |
+
} else {
|
19 |
+
r[0] = "[";
|
20 |
+
for ( var i = 0; i < o.length; i++) {
|
21 |
+
r[r.length] = obj2str(o[i]);
|
22 |
+
r[r.length] = ",";
|
23 |
+
}
|
24 |
+
r[r.length - 1] = "]";
|
25 |
+
}
|
26 |
+
return r.join("");
|
27 |
+
}
|
28 |
+
return o.toString();
|
29 |
+
}
|
js/jquery/jquery.ajaxmanager.js
ADDED
@@ -0,0 +1,342 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**!
|
2 |
+
* project-site: http://plugins.jquery.com/project/AjaxManager
|
3 |
+
* repository: http://github.com/aFarkas/Ajaxmanager
|
4 |
+
* @author Alexander Farkas
|
5 |
+
* @version 3.12
|
6 |
+
* Copyright 2010, Alexander Farkas
|
7 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
8 |
+
*/
|
9 |
+
|
10 |
+
(function($){
|
11 |
+
"use strict";
|
12 |
+
var managed = {},
|
13 |
+
cache = {}
|
14 |
+
;
|
15 |
+
$.manageAjax = (function(){
|
16 |
+
function create(name, opts){
|
17 |
+
managed[name] = new $.manageAjax._manager(name, opts);
|
18 |
+
return managed[name];
|
19 |
+
}
|
20 |
+
|
21 |
+
function destroy(name){
|
22 |
+
if(managed[name]){
|
23 |
+
managed[name].clear(true);
|
24 |
+
delete managed[name];
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
|
29 |
+
var publicFns = {
|
30 |
+
create: create,
|
31 |
+
destroy: destroy
|
32 |
+
};
|
33 |
+
|
34 |
+
return publicFns;
|
35 |
+
})();
|
36 |
+
|
37 |
+
$.manageAjax._manager = function(name, opts){
|
38 |
+
this.requests = {};
|
39 |
+
this.inProgress = 0;
|
40 |
+
this.name = name;
|
41 |
+
this.qName = name;
|
42 |
+
|
43 |
+
this.opts = $.extend({}, $.manageAjax.defaults, opts);
|
44 |
+
if(opts && opts.queue && opts.queue !== true && typeof opts.queue === 'string' && opts.queue !== 'clear'){
|
45 |
+
this.qName = opts.queue;
|
46 |
+
}
|
47 |
+
};
|
48 |
+
|
49 |
+
$.manageAjax._manager.prototype = {
|
50 |
+
add: function(url, o){
|
51 |
+
if(typeof url == 'object'){
|
52 |
+
o = url;
|
53 |
+
} else if(typeof url == 'string'){
|
54 |
+
o = $.extend(o || {}, {url: url});
|
55 |
+
}
|
56 |
+
o = $.extend({}, this.opts, o);
|
57 |
+
|
58 |
+
var origCom = o.complete || $.noop,
|
59 |
+
origSuc = o.success || $.noop,
|
60 |
+
beforeSend = o.beforeSend || $.noop,
|
61 |
+
origError = o.error || $.noop,
|
62 |
+
strData = (typeof o.data == 'string') ? o.data : $.param(o.data || {}),
|
63 |
+
xhrID = o.type + o.url + strData,
|
64 |
+
that = this,
|
65 |
+
ajaxFn = this._createAjax(xhrID, o, origSuc, origCom)
|
66 |
+
;
|
67 |
+
if(o.preventDoubleRequests && o.queueDuplicateRequests){
|
68 |
+
if(o.preventDoubleRequests){
|
69 |
+
o.queueDuplicateRequests = false;
|
70 |
+
}
|
71 |
+
setTimeout(function(){
|
72 |
+
throw("preventDoubleRequests and queueDuplicateRequests can't be both true");
|
73 |
+
}, 0);
|
74 |
+
}
|
75 |
+
if(this.requests[xhrID] && o.preventDoubleRequests){
|
76 |
+
return;
|
77 |
+
}
|
78 |
+
ajaxFn.xhrID = xhrID;
|
79 |
+
o.xhrID = xhrID;
|
80 |
+
|
81 |
+
o.beforeSend = function(xhr, opts){
|
82 |
+
var ret = beforeSend.call(this, xhr, opts);
|
83 |
+
if(ret === false){
|
84 |
+
that._removeXHR(xhrID);
|
85 |
+
}
|
86 |
+
xhr = null;
|
87 |
+
return ret;
|
88 |
+
};
|
89 |
+
o.complete = function(xhr, status){
|
90 |
+
that._complete.call(that, this, origCom, xhr, status, xhrID, o);
|
91 |
+
xhr = null;
|
92 |
+
};
|
93 |
+
|
94 |
+
o.success = function(data, status, xhr){
|
95 |
+
that._success.call(that, this, origSuc, data, status, xhr, o);
|
96 |
+
xhr = null;
|
97 |
+
};
|
98 |
+
|
99 |
+
//always add some error callback
|
100 |
+
o.error = function(ahr, status, errorStr){
|
101 |
+
var httpStatus = '',
|
102 |
+
content = ''
|
103 |
+
;
|
104 |
+
if(status !== 'timeout' && ahr){
|
105 |
+
httpStatus = ahr.status;
|
106 |
+
content = ahr.responseXML || ahr.responseText;
|
107 |
+
}
|
108 |
+
if(origError) {
|
109 |
+
origError.call(this, ahr, status, errorStr, o);
|
110 |
+
} else {
|
111 |
+
setTimeout(function(){
|
112 |
+
throw status + '| status: ' + httpStatus + ' | URL: ' + o.url + ' | data: '+ strData + ' | thrown: '+ errorStr + ' | response: '+ content;
|
113 |
+
}, 0);
|
114 |
+
}
|
115 |
+
ahr = null;
|
116 |
+
};
|
117 |
+
|
118 |
+
if(o.queue === 'clear'){
|
119 |
+
$(document).clearQueue(this.qName);
|
120 |
+
}
|
121 |
+
|
122 |
+
if(o.queue || (o.queueDuplicateRequests && this.requests[xhrID])){
|
123 |
+
$.queue(document, this.qName, ajaxFn);
|
124 |
+
if(this.inProgress < o.maxRequests && (!this.requests[xhrID] || !o.queueDuplicateRequests)){
|
125 |
+
$.dequeue(document, this.qName);
|
126 |
+
}
|
127 |
+
return xhrID;
|
128 |
+
}
|
129 |
+
return ajaxFn();
|
130 |
+
},
|
131 |
+
_createAjax: function(id, o, origSuc, origCom){
|
132 |
+
var that = this;
|
133 |
+
return function(){
|
134 |
+
if(o.beforeCreate.call(o.context || that, id, o) === false){return;}
|
135 |
+
that.inProgress++;
|
136 |
+
if(that.inProgress === 1){
|
137 |
+
$.event.trigger(that.name +'AjaxStart');
|
138 |
+
}
|
139 |
+
if(o.cacheResponse && cache[id]){
|
140 |
+
if(!cache[id].cacheTTL || cache[id].cacheTTL < 0 || ((new Date().getTime() - cache[id].timestamp) < cache[id].cacheTTL)){
|
141 |
+
that.requests[id] = {};
|
142 |
+
setTimeout(function(){
|
143 |
+
that._success.call(that, o.context || o, origSuc, cache[id]._successData, 'success', cache[id], o);
|
144 |
+
that._complete.call(that, o.context || o, origCom, cache[id], 'success', id, o);
|
145 |
+
}, 0);
|
146 |
+
} else {
|
147 |
+
delete cache[id];
|
148 |
+
}
|
149 |
+
}
|
150 |
+
if(!o.cacheResponse || !cache[id]) {
|
151 |
+
if (o.async) {
|
152 |
+
that.requests[id] = $.ajax(o);
|
153 |
+
} else {
|
154 |
+
$.ajax(o);
|
155 |
+
}
|
156 |
+
}
|
157 |
+
return id;
|
158 |
+
};
|
159 |
+
},
|
160 |
+
_removeXHR: function(xhrID){
|
161 |
+
if(this.opts.queue || this.opts.queueDuplicateRequests){
|
162 |
+
$.dequeue(document, this.qName);
|
163 |
+
}
|
164 |
+
this.inProgress--;
|
165 |
+
this.requests[xhrID] = null;
|
166 |
+
delete this.requests[xhrID];
|
167 |
+
},
|
168 |
+
clearCache: function () {
|
169 |
+
cache = {};
|
170 |
+
},
|
171 |
+
_isAbort: function(xhr, status, o){
|
172 |
+
if(!o.abortIsNoSuccess || (!xhr && !status)){
|
173 |
+
return false;
|
174 |
+
}
|
175 |
+
var ret = !!( ( !xhr || xhr.readyState === 0 || this.lastAbort === o.xhrID ) );
|
176 |
+
xhr = null;
|
177 |
+
return ret;
|
178 |
+
},
|
179 |
+
_complete: function(context, origFn, xhr, status, xhrID, o){
|
180 |
+
if(this._isAbort(xhr, status, o)){
|
181 |
+
status = 'abort';
|
182 |
+
o.abort.call(context, xhr, status, o);
|
183 |
+
}
|
184 |
+
origFn.call(context, xhr, status, o);
|
185 |
+
|
186 |
+
$.event.trigger(this.name +'AjaxComplete', [xhr, status, o]);
|
187 |
+
|
188 |
+
if(o.domCompleteTrigger){
|
189 |
+
$(o.domCompleteTrigger)
|
190 |
+
.trigger(this.name +'DOMComplete', [xhr, status, o])
|
191 |
+
.trigger('DOMComplete', [xhr, status, o])
|
192 |
+
;
|
193 |
+
}
|
194 |
+
|
195 |
+
this._removeXHR(xhrID);
|
196 |
+
if(!this.inProgress){
|
197 |
+
$.event.trigger(this.name +'AjaxStop');
|
198 |
+
}
|
199 |
+
xhr = null;
|
200 |
+
},
|
201 |
+
_success: function(context, origFn, data, status, xhr, o){
|
202 |
+
var that = this;
|
203 |
+
if(this._isAbort(xhr, status, o)){
|
204 |
+
xhr = null;
|
205 |
+
return;
|
206 |
+
}
|
207 |
+
if(o.abortOld){
|
208 |
+
$.each(this.requests, function(name){
|
209 |
+
if(name === o.xhrID){
|
210 |
+
return false;
|
211 |
+
}
|
212 |
+
that.abort(name);
|
213 |
+
});
|
214 |
+
}
|
215 |
+
if(o.cacheResponse && !cache[o.xhrID]){
|
216 |
+
if(!xhr){
|
217 |
+
xhr = {};
|
218 |
+
}
|
219 |
+
cache[o.xhrID] = {
|
220 |
+
status: xhr.status,
|
221 |
+
statusText: xhr.statusText,
|
222 |
+
responseText: xhr.responseText,
|
223 |
+
responseXML: xhr.responseXML,
|
224 |
+
_successData: data,
|
225 |
+
cacheTTL: o.cacheTTL,
|
226 |
+
timestamp: new Date().getTime()
|
227 |
+
};
|
228 |
+
if('getAllResponseHeaders' in xhr){
|
229 |
+
var responseHeaders = xhr.getAllResponseHeaders();
|
230 |
+
var parsedHeaders;
|
231 |
+
var parseHeaders = function(){
|
232 |
+
if(parsedHeaders){return;}
|
233 |
+
parsedHeaders = {};
|
234 |
+
$.each(responseHeaders.split("\n"), function(i, headerLine){
|
235 |
+
var delimiter = headerLine.indexOf(":");
|
236 |
+
parsedHeaders[headerLine.substr(0, delimiter)] = headerLine.substr(delimiter + 2);
|
237 |
+
});
|
238 |
+
};
|
239 |
+
$.extend(cache[o.xhrID], {
|
240 |
+
getAllResponseHeaders: function() {return responseHeaders;},
|
241 |
+
getResponseHeader: function(name) {
|
242 |
+
parseHeaders();
|
243 |
+
return (name in parsedHeaders) ? parsedHeaders[name] : null;
|
244 |
+
}
|
245 |
+
});
|
246 |
+
}
|
247 |
+
}
|
248 |
+
origFn.call(context, data, status, xhr, o);
|
249 |
+
$.event.trigger(this.name +'AjaxSuccess', [xhr, o, data]);
|
250 |
+
if(o.domSuccessTrigger){
|
251 |
+
$(o.domSuccessTrigger)
|
252 |
+
.trigger(this.name +'DOMSuccess', [data, o])
|
253 |
+
.trigger('DOMSuccess', [data, o])
|
254 |
+
;
|
255 |
+
}
|
256 |
+
xhr = null;
|
257 |
+
},
|
258 |
+
getData: function(id){
|
259 |
+
if( id ){
|
260 |
+
var ret = this.requests[id];
|
261 |
+
if(!ret && this.opts.queue) {
|
262 |
+
ret = $.grep($(document).queue(this.qName), function(fn, i){
|
263 |
+
return (fn.xhrID === id);
|
264 |
+
})[0];
|
265 |
+
}
|
266 |
+
return ret;
|
267 |
+
}
|
268 |
+
return {
|
269 |
+
requests: this.requests,
|
270 |
+
queue: (this.opts.queue) ? $(document).queue(this.qName) : [],
|
271 |
+
inProgress: this.inProgress
|
272 |
+
};
|
273 |
+
},
|
274 |
+
abort: function(id){
|
275 |
+
var xhr;
|
276 |
+
if(id){
|
277 |
+
xhr = this.getData(id);
|
278 |
+
|
279 |
+
if(xhr && xhr.abort){
|
280 |
+
this.lastAbort = id;
|
281 |
+
xhr.abort();
|
282 |
+
this.lastAbort = false;
|
283 |
+
} else {
|
284 |
+
$(document).queue(
|
285 |
+
this.qName, $.grep($(document).queue(this.qName), function(fn, i){
|
286 |
+
return (fn !== xhr);
|
287 |
+
})
|
288 |
+
);
|
289 |
+
}
|
290 |
+
xhr = null;
|
291 |
+
return;
|
292 |
+
}
|
293 |
+
|
294 |
+
var that = this,
|
295 |
+
ids = []
|
296 |
+
;
|
297 |
+
$.each(this.requests, function(id){
|
298 |
+
ids.push(id);
|
299 |
+
});
|
300 |
+
$.each(ids, function(i, id){
|
301 |
+
that.abort(id);
|
302 |
+
});
|
303 |
+
},
|
304 |
+
clear: function(shouldAbort){
|
305 |
+
$(document).clearQueue(this.qName);
|
306 |
+
if(shouldAbort){
|
307 |
+
this.abort();
|
308 |
+
}
|
309 |
+
}
|
310 |
+
};
|
311 |
+
$.manageAjax._manager.prototype.getXHR = $.manageAjax._manager.prototype.getData;
|
312 |
+
$.manageAjax.defaults = {
|
313 |
+
beforeCreate: $.noop,
|
314 |
+
abort: $.noop,
|
315 |
+
abortIsNoSuccess: true,
|
316 |
+
maxRequests: 1,
|
317 |
+
cacheResponse: false,
|
318 |
+
async: true,
|
319 |
+
domCompleteTrigger: false,
|
320 |
+
domSuccessTrigger: false,
|
321 |
+
preventDoubleRequests: true,
|
322 |
+
queueDuplicateRequests: false,
|
323 |
+
cacheTTL: -1,
|
324 |
+
queue: false // true, false, clear
|
325 |
+
};
|
326 |
+
|
327 |
+
$.each($.manageAjax._manager.prototype, function(n, fn){
|
328 |
+
if(n.indexOf('_') === 0 || !$.isFunction(fn)){return;}
|
329 |
+
$.manageAjax[n] = function(name, o){
|
330 |
+
if(!managed[name]){
|
331 |
+
if(n === 'add'){
|
332 |
+
$.manageAjax.create(name, o);
|
333 |
+
} else {
|
334 |
+
return;
|
335 |
+
}
|
336 |
+
}
|
337 |
+
var args = Array.prototype.slice.call(arguments, 1);
|
338 |
+
managed[name][n].apply(managed[name], args);
|
339 |
+
};
|
340 |
+
});
|
341 |
+
|
342 |
+
})(jQuery);
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Achang_Scene7</name>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>The scene7 extension help you to use adobe scene7 to customize product on magento</summary>
|
10 |
+
<description>Use adobe scene7 to customize product on magento</description>
|
11 |
+
<notes>fixed minor bugs</notes>
|
12 |
+
<authors><author><name>Minglong Li</name><user>Achang</user><email>magento@achang.com</email></author></authors>
|
13 |
+
<date>2013-02-22</date>
|
14 |
+
<time>09:30:32</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Achang"><dir name="Scene7"><dir name="Block"><dir name="Adminhtml"><dir name="Attribute"><dir name="Edit"><file name="Form.php" hash="0cfd1c3ff6bd52b00b12242909604778"/><dir name="Tab"><file name="Form.php" hash="99446331a12acc21724de747f18163af"/></dir><file name="Tabs.php" hash="87fead959412b8ce1d05b056dfeeb515"/></dir><file name="Edit.php" hash="e107102a5b2594fba91c7886f10617a9"/><file name="Grid.php" hash="0687c50249cc92653a08f27b9936e051"/></dir><file name="Attribute.php" hash="6a38770ff03f160f37c61b506edcfef9"/><dir name="Catalog"><dir name="Product"><dir name="Edit"><dir name="Tab"><dir name="Options"><file name="Option.php" hash="244d2fba678b224ce16b38c5efe48773"/><dir name="Type"><file name="Select.php" hash="284b22c980d960ddd7b8f1cc9cc26958"/></dir></dir></dir></dir></dir></dir></dir><dir name="Cart"><dir name="Item"><dir name="Renderer"><file name="Scene7.php" hash="63cf0b2559a36949b34a9b0977396931"/></dir></dir></dir><dir name="Product"><dir name="View"><dir name="Options"><dir name="Type"><file name="Scene7select.php" hash="85d561f8918981fe660aa01da9e59a4d"/><file name="Scene7text.php" hash="f7cef23ca8e706811ce8353617966f38"/></dir></dir><file name="Options.php" hash="a2ebf179a86f3fd189c86a6d612e1f88"/></dir></dir><dir name="Sales"><dir name="Order"><dir name="Item"><dir name="Renderer"><file name="Default.php" hash="bf329ff246316600ce635b480bd30d31"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="08b9cbe610b772975a4a1b2bff6bfed6"/></dir><dir name="Model"><file name="Attribute.php" hash="79aaaa6e60f0353cf4f96af40d33239b"/><dir name="Catalog"><dir name="Product"><dir name="Option"><dir name="Type"><file name="Default.php" hash="c0ba0b0b1210377bc6f838e0c1537d19"/><file name="Scene7select.php" hash="9f7553f85d61c7599276d38d45184e5a"/><file name="Scene7text.php" hash="379153b8c16ed74331e222462ccb2d19"/></dir><file name="Value.php" hash="91f6b10db89b7239688b4403d4e3a7d5"/></dir><file name="Option.php" hash="92fdc5afd2f0c5d5b2e774325b584a69"/></dir></dir><dir name="Product"><dir name="Price"><file name="Scene7.php" hash="ff859fb9c0e659748bf92c8e13f36fed"/></dir><dir name="Type"><file name="Scene7.php" hash="c33bd9467d3eeee9c16772faeb313bdb"/><file name="Scene7.php.bak" hash="e770fba5a6c706ed0952b8e52560676b"/></dir><file name="Type.php" hash="5b882be07042d426e4397c85d74ddf2e"/></dir><dir name="Resource"><dir name="Attribute"><file name="Collection.php" hash="bf0a77ff5760f5b8686be7fd58a8d36d"/></dir><file name="Attribute.php" hash="d5911d22e76d7b417b0df0c7251f0b45"/><dir name="Product"><dir name="Option"><file name="Collection.php" hash="6aff3cbe45c3464784e392eca4cdb5f1"/><dir name="Value"><file name="Collection.php" hash="e25ebd495f423e5eb5b29d7c3e142ef6"/></dir><file name="Value.php" hash="d2dd37123db70ec0b5f69d533bf689ff"/></dir><file name="Option.php" hash="9a1e9fbb9eb7f1b61aa2b6f326020888"/></dir></dir><file name="Scene7.php" hash="adf356111b494b99bbb10b50fc20e9e8"/><file name="Session.php" hash="07af498a0b6bec97489d25c527573a90"/><file name="Status.php" hash="637c14bf744b69428db62ab0b46c2895"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Product"><dir name="Options"><file name="Type.php" hash="31e9a3f4344252eed0c2ea319a52f315"/></dir></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AttributeController.php" hash="1d5c160531addfdc3cff643445abedfb"/></dir><file name="IndexController.php" hash="7eced4b5d501ea5c0ffaf38ea15355b6"/></dir><dir name="etc"><file name="adminhtml.xml" hash="6db9c7387328e81aa9a060e2dad65806"/><file name="config.xml" hash="05c7bfa8721eae7c161e9393d1980298"/><file name="system.xml" hash="664d8ebdba5eb342f014d6aeaf8a897b"/></dir><dir name="sql"><dir name="scenescene7_setup"><file name="mysql4-install-0.5.0.php" hash="7d83c9c87cbc1e2a38a2205cbd408f30"/><file name="mysql4-upgrade-0.5.0-0.5.1.php" hash="5da9c6284d6602fcb6dd7276c496a47e"/><file name="mysql4-upgrade-0.5.1-0.5.2.php" hash="632d3796758a3badbccbb157b77204c3"/><file name="mysql4-upgrade-0.5.2-0.5.3.php" hash="68f898fcf441df3dd21c41bb7590d1c9"/><file name="mysql4-upgrade-0.5.3-0.5.4.php" hash="b2698be2e9f804a9c74a15dcba0ecdde"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="achang_scene7.xml" hash="950ddb8cfc7ddbcc2f5d776ab72a3e76"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="achang_scene7.xml" hash="54468d3b0078194f0c99dd17b6e8826f"/></dir><dir name="template"><dir name="scene7"><dir name="catalog"><dir name="product"><dir name="view"><dir name="options"><dir name="type"><file name="scene7select.phtml" hash="31fd1b5413549e6971ba158a0708a463"/><file name="scene7text.phtml" hash="03ce79239f19fed0e7cd96d8a84891af"/></dir></dir><file name="options.phtml" hash="1750fb2749327e0782553356874dd1e4"/></dir><file name="view.phtml" hash="45799039bf5152155f1887e3903044db"/></dir></dir><dir name="checkout"><dir name="cart"><file name="scene7.phtml" hash="38614fb955f90267ca4ea4ab793eb627"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Achang_All.xml" hash="c10e0e81eb90ee404336cfefecdb184e"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="scene7.css" hash="2f02ca4a568dda4cf60c28a220c0dbdb"/></dir><dir name="images"><file name="image_loading.gif" hash="e6cd034ed522fddc58d3abdbc1ac7113"/></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="jquery"><file name="jquery-1.4.2.min.js" hash="65b352e1ba79f0e2a3b1e014bc2571af"/><file name="jquery-noconflict.js" hash="76be9aed2b47167807973fab63b22745"/><file name="jquery.ajaxmanager.js" hash="3930ff1672658ba7724451f37cc68528"/></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|
skin/frontend/default/default/css/scene7.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
span.image_loading{ width:80px; height:10px; margin:0; padding:0; background:url(../images/image_loading.gif) no-repeat}
|
skin/frontend/default/default/images/image_loading.gif
ADDED
Binary file
|