lr_callprice - Version 0.1.0

Version Notes

Hides the price and the add to cart button for specific products and replaces it with a Call For Price Button. This feature is applied to Product Details page , Product List page (Categroy page),Search result page.

Download this release

Release Info

Developer Mitesh Prajapati
Extension lr_callprice
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

Files changed (43) hide show
  1. app/code/local/LR/CallPrice/Block/Adminhtml/Request.php +13 -0
  2. app/code/local/LR/CallPrice/Block/Adminhtml/Request/Edit.php +44 -0
  3. app/code/local/LR/CallPrice/Block/Adminhtml/Request/Edit/Form.php +74 -0
  4. app/code/local/LR/CallPrice/Block/Adminhtml/Request/Edit/Tab/Form.php +20 -0
  5. app/code/local/LR/CallPrice/Block/Adminhtml/Request/Edit/Tabs.php +21 -0
  6. app/code/local/LR/CallPrice/Block/Adminhtml/Request/Grid.php +142 -0
  7. app/code/local/LR/CallPrice/Block/Adminhtml/System/Config/Date.php +22 -0
  8. app/code/local/LR/CallPrice/Block/Form.php +128 -0
  9. app/code/local/LR/CallPrice/Helper/Data.php +128 -0
  10. app/code/local/LR/CallPrice/Model/Request.php +8 -0
  11. app/code/local/LR/CallPrice/Model/Resource/Request.php +9 -0
  12. app/code/local/LR/CallPrice/Model/Resource/Request/Collection.php +9 -0
  13. app/code/local/LR/CallPrice/controllers/Adminhtml/CallPricebackendController.php +10 -0
  14. app/code/local/LR/CallPrice/controllers/Adminhtml/RequestController.php +150 -0
  15. app/code/local/LR/CallPrice/controllers/FormController.php +76 -0
  16. app/code/local/LR/CallPrice/data/lr_callprice_setup/data-install-0.1.0.php +29 -0
  17. app/code/local/LR/CallPrice/data/lr_callprice_setup/data-upgrade-0.1.0-0.2.0.php +28 -0
  18. app/code/local/LR/CallPrice/data/lr_callprice_setup/data-upgrade-0.2.0-0.3.0.php +12 -0
  19. app/code/local/LR/CallPrice/etc/adminhtml.xml +37 -0
  20. app/code/local/LR/CallPrice/etc/config.xml +124 -0
  21. app/code/local/LR/CallPrice/etc/system.xml +106 -0
  22. app/code/local/LR/CallPrice/sql/lr_callprice_setup/install-0.1.0.php +42 -0
  23. app/design/adminhtml/default/default/layout/lr_callprice.xml +14 -0
  24. app/design/frontend/base/default/layout/lr_callprice.xml +112 -0
  25. app/design/frontend/base/default/template/lr/callprice/callforprice.phtml +35 -0
  26. app/design/frontend/base/default/template/lr/callprice/callforprice_form.phtml +68 -0
  27. app/design/frontend/base/default/template/lr/callprice/catalog/product/list.phtml +155 -0
  28. app/design/frontend/base/default/template/lr/callprice/catalog/product/view/type/default.phtml +38 -0
  29. app/etc/modules/LR_CallPrice.xml +10 -0
  30. app/locale/en_GB/LR_CallPrice.csv +23 -0
  31. app/locale/en_US/LR_CallPrice.csv +23 -0
  32. app/locale/en_US/template/email/call_for_price.html +12 -0
  33. package.xml +97 -0
  34. skin/frontend/base/default/css/lr_callprice/callprice.css +3 -0
  35. skin/frontend/base/default/css/lr_callprice/jquery.fancybox-buttons.css +96 -0
  36. skin/frontend/base/default/css/lr_callprice/jquery.fancybox-thumbs.css +54 -0
  37. skin/frontend/base/default/css/lr_callprice/jquery.fancybox.css +249 -0
  38. skin/frontend/base/default/images/lr_callprice/blank.gif +0 -0
  39. skin/frontend/base/default/images/lr_callprice/fancybox_buttons.png +0 -0
  40. skin/frontend/base/default/images/lr_callprice/fancybox_loading.gif +0 -0
  41. skin/frontend/base/default/images/lr_callprice/fancybox_overlay.png +0 -0
  42. skin/frontend/base/default/images/lr_callprice/fancybox_sprite.png +0 -0
  43. skin/frontend/base/default/js/lr_callprice/callprice.js +54 -0
app/code/local/LR/CallPrice/Block/Adminhtml/Request.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LR_CallPrice_Block_Adminhtml_Request extends Mage_Adminhtml_Block_Widget_Grid_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ $this->_controller = "adminhtml_request";
8
+ $this->_blockGroup = "lr_callprice";
9
+ $this->_headerText = $this->__("Request Manager");
10
+ parent::__construct();
11
+ $this->_removeButton("add", "label", $this->__("Delete Item"));
12
+ }
13
+ }
app/code/local/LR/CallPrice/Block/Adminhtml/Request/Edit.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LR_CallPrice_Block_Adminhtml_Request_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+
8
+ parent::__construct();
9
+ $this->_objectId = "id";
10
+ $this->_blockGroup = "lr_callprice";
11
+ $this->_controller = "adminhtml_request";
12
+ $this->_updateButton("save", "label", Mage::helper("lr_callprice")->__("Save Item"));
13
+ $this->_removeButton("delete", "label", Mage::helper("lr_callprice")->__("Delete Item"));
14
+
15
+ $this->_addButton("saveandcontinue", array(
16
+ "label" => Mage::helper("lr_callprice")->__("Save And Continue Edit"),
17
+ "onclick" => "saveAndContinueEdit()",
18
+ "class" => "save",
19
+ ), -100);
20
+
21
+
22
+
23
+ $this->_formScripts[] = "
24
+
25
+ function saveAndContinueEdit(){
26
+ editForm.submit($('edit_form').action+'back/edit/');
27
+ }
28
+ ";
29
+ }
30
+
31
+ public function getHeaderText()
32
+ {
33
+ if( Mage::registry("request_data") && Mage::registry("request_data")->getId() ){
34
+
35
+ return Mage::helper("lr_callprice")->__("Edit Request '%s'", $this->htmlEscape(Mage::registry("request_data")->getId()));
36
+
37
+ }
38
+ else{
39
+
40
+ return Mage::helper("lr_callprice")->__("Add Request");
41
+
42
+ }
43
+ }
44
+ }
app/code/local/LR/CallPrice/Block/Adminhtml/Request/Edit/Form.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class LR_CallPrice_Block_Adminhtml_Request_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+ if (Mage::registry('request_data')) {
7
+ $data = Mage::registry('request_data')->getData();
8
+ } else {
9
+ $data = array();
10
+ }
11
+
12
+ $form = new Varien_Data_Form(array(
13
+ "id" => "edit_form",
14
+ "action" => $this->getUrl("*/*/save", array("id" => $this->getRequest()->getParam("id"))),
15
+ "method" => "post",
16
+ "enctype" => "multipart/form-data",
17
+ )
18
+ );
19
+ $form->setUseContainer(true);
20
+ $this->setForm($form);
21
+
22
+ $fieldset = $form->addFieldset('request_data', array(
23
+ 'legend' => Mage::helper('lr_callprice')->__('Call For Price Request Information')
24
+ ));
25
+
26
+ $fieldset->addField('customer_name', 'text', array(
27
+ 'label' => Mage::helper('lr_callprice')->__('Customer Name'),
28
+ 'class' => '',
29
+ 'required' => false,
30
+ 'name' => 'customer_name',
31
+ 'note' => Mage::helper('lr_callprice')->__('Customer name.'),
32
+ ));
33
+
34
+ $fieldset->addField('customer_email', 'text', array(
35
+ 'label' => Mage::helper('lr_callprice')->__('Customer Email'),
36
+ 'class' => '',
37
+ 'required' => false,
38
+ 'name' => 'customer_email',
39
+ ));
40
+
41
+ $fieldset->addField('customer_telephone', 'text', array(
42
+ 'label' => Mage::helper('lr_callprice')->__('Telephone'),
43
+ 'class' => '',
44
+ 'required' => false,
45
+ 'name' => 'customer_telephone',
46
+ ));
47
+
48
+ $fieldset->addField('product_name', 'textarea', array(
49
+ 'label' => Mage::helper('lr_callprice')->__('Request Details'),
50
+ 'class' => '',
51
+ 'required' => false,
52
+ 'name' => 'product_name',
53
+ ));
54
+
55
+ $fieldset->addField('status', 'select', array(
56
+ 'label' => Mage::helper('lr_callprice')->__('Status'),
57
+ 'name' => 'status',
58
+ 'values' => array(
59
+ array(
60
+ 'value' => 1,
61
+ 'label' => Mage::helper('lr_callprice')->__('New'),
62
+ ),
63
+ array(
64
+ 'value' => 2,
65
+ 'label' => Mage::helper('lr_callprice')->__('Complete'),
66
+ ),
67
+ ),
68
+ ));
69
+
70
+ $form->setValues($data);
71
+
72
+ return parent::_prepareForm();
73
+ }
74
+ }
app/code/local/LR/CallPrice/Block/Adminhtml/Request/Edit/Tab/Form.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class LR_CallPrice_Block_Adminhtml_Request_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+
10
+ if (Mage::getSingleton("adminhtml/session")->getRequestData())
11
+ {
12
+ $form->setValues(Mage::getSingleton("adminhtml/session")->getRequestData());
13
+ Mage::getSingleton("adminhtml/session")->setRequestData(null);
14
+ }
15
+ elseif(Mage::registry("request_data")) {
16
+ $form->setValues(Mage::registry("request_data")->getData());
17
+ }
18
+ return parent::_prepareForm();
19
+ }
20
+ }
app/code/local/LR/CallPrice/Block/Adminhtml/Request/Edit/Tabs.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class LR_CallPrice_Block_Adminhtml_Request_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setId("request_tabs");
8
+ $this->setDestElementId("edit_form");
9
+ $this->setTitle(Mage::helper("lr_callprice")->__("Request Information"));
10
+ }
11
+ protected function _beforeToHtml()
12
+ {
13
+ $this->addTab("form_section", array(
14
+ "label" => Mage::helper("lr_callprice")->__("Request Information"),
15
+ "title" => Mage::helper("lr_callprice")->__("Request Information"),
16
+ "content" => $this->getLayout()->createBlock("lr_callprice/adminhtml_request_edit_tab_form")->toHtml(),
17
+ ));
18
+ return parent::_beforeToHtml();
19
+ }
20
+
21
+ }
app/code/local/LR/CallPrice/Block/Adminhtml/Request/Grid.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LR_CallPrice_Block_Adminhtml_Request_Grid extends Mage_Adminhtml_Block_Widget_Grid {
4
+
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId("requestGrid");
9
+ $this->setDefaultSort("id");
10
+ $this->setDefaultDir("ASC");
11
+ $this->setSaveParametersInSession(true);
12
+ }
13
+
14
+ protected function _prepareMassaction()
15
+ {
16
+ $this->setMassactionIdField('id');
17
+ $this->getMassactionBlock()->setFormFieldName('id');
18
+
19
+ $statuses = array(
20
+ array(
21
+ 'value' => 1,
22
+ 'label' => $this->__('New'),
23
+ ),
24
+ array(
25
+ 'value' => 2,
26
+ 'label' => $this->__('Complete'),
27
+ ),
28
+ );
29
+ array_unshift($statuses, array('label' => '', 'value' => ''));
30
+ $this->getMassactionBlock()->addItem('status', array(
31
+ 'label' => $this->__('Change status'),
32
+ 'url' => $this->getUrl('*/*/massStatusUpdate', array('_current' => true)),
33
+ 'additional' => array(
34
+ 'visibility' => array(
35
+ 'name' => 'status',
36
+ 'type' => 'select',
37
+ 'class' => 'required-entry',
38
+ 'label' => $this->__('Status'),
39
+ 'values' => $statuses
40
+ )
41
+ )
42
+ ));
43
+ return $this;
44
+ }
45
+
46
+ protected function _prepareCollection()
47
+ {
48
+ $collection = Mage::getModel("lr_callprice/request")->getCollection();
49
+ $this->setCollection($collection);
50
+ return parent::_prepareCollection();
51
+ }
52
+
53
+ protected function _prepareColumns()
54
+ {
55
+ $this->addColumn("id", array(
56
+ "header" => $this->__("ID"),
57
+ "align" => "right",
58
+ "width" => "30px",
59
+ "type" => "number",
60
+ "index" => "id",
61
+ ));
62
+
63
+ $this->addColumn("customer_name", array(
64
+ "header" => $this->__("Customer Name"),
65
+ "align" => "right",
66
+ "width" => "50px",
67
+ "type" => "varchar",
68
+ "index" => "customer_name",
69
+ ));
70
+ $this->addColumn("customer_email", array(
71
+ "header" => $this->__("Customer Email"),
72
+ "align" => "right",
73
+ "width" => "50px",
74
+ "type" => "varchar",
75
+ "index" => "customer_email",
76
+ ));
77
+ $this->addColumn("customer_telephone", array(
78
+ "header" => $this->__("Customer Telephone"),
79
+ "align" => "right",
80
+ "width" => "50px",
81
+ "type" => "varchar",
82
+ "index" => "customer_telephone",
83
+ ));
84
+
85
+ $this->addColumn("product_id", array(
86
+ "header" => $this->__("Product Id"),
87
+ "align" => "right",
88
+ "width" => "50px",
89
+ "type" => "varchar",
90
+ "index" => "product_id",
91
+ ));
92
+
93
+ $this->addColumn("product_name", array(
94
+ "header" => $this->__("Request Details"),
95
+ "align" => "right",
96
+ "width" => "50px",
97
+ "type" => "varchar",
98
+ "index" => "product_name",
99
+ ));
100
+
101
+ $this->addColumn('status', array(
102
+ 'header' => $this->__('Status'),
103
+ 'align' => 'right',
104
+ 'width' => '50px',
105
+ 'index' => 'status',
106
+ 'type' => 'options',
107
+ 'options' => array(
108
+ 1 => 'New',
109
+ 2 => 'Complete',
110
+ ),
111
+ ));
112
+
113
+ $this->addColumn('view',
114
+ array(
115
+ 'header' => $this->__('Action'),
116
+ 'width' => '50px',
117
+ 'type' => 'action',
118
+ 'getter' => 'getId',
119
+ 'actions' => array(
120
+ array(
121
+ 'caption' => $this->__('View'),
122
+ 'url' => array(
123
+ 'base' => 'adminhtml/request/edit',
124
+ 'params' => array('store' => $this->getRequest()->getParam('store'))
125
+ ),
126
+ 'field' => 'id'
127
+ )
128
+ ),
129
+ 'filter' => false,
130
+ 'sortable' => false,
131
+ 'index' => 'stores',
132
+ ));
133
+ return parent::_prepareColumns();
134
+ }
135
+
136
+ public function getRowUrl($row)
137
+ {
138
+ return $this->getUrl("*/*/edit", array("id" => $row->getId()));
139
+ }
140
+
141
+
142
+ }
app/code/local/LR/CallPrice/Block/Adminhtml/System/Config/Date.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class LR_CallPrice_Block_Adminhtml_System_Config_Date extends Mage_Adminhtml_Block_System_Config_Form_Field{
3
+
4
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
5
+ {
6
+ $date = new Varien_Data_Form_Element_Date;
7
+ $format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
8
+
9
+ $data = array(
10
+ 'name' => $element->getName(),
11
+ 'html_id' => $element->getId(),
12
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
13
+ );
14
+ $date->setData($data);
15
+ $date->setValue($element->getValue(), $format);
16
+ $date->setFormat(Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT));
17
+ $date->setForm($element->getForm());
18
+
19
+ return $date->getElementHtml();
20
+ }
21
+ }
22
+ ?>
app/code/local/LR/CallPrice/Block/Form.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class LR_CallPrice_Block_Form extends Mage_Core_Block_Template
3
+ {
4
+ public function getFormAction()
5
+ {
6
+ return Mage::getUrl('callprice/form/submit');
7
+ }
8
+
9
+ public function customerLoggedIn()
10
+ {
11
+ return Mage::getSingleton('customer/session')->isLoggedIn();
12
+ }
13
+ public function buttonLabel()
14
+ {
15
+ $label = Mage::getStoreConfig('catalog/call_for_price/call_for_price_button_text');
16
+
17
+ return $label;
18
+ }
19
+ public function getProductId()
20
+ {
21
+ return $product_id = $this->getRequest()->getPost('product');
22
+ }
23
+ public function option_details()
24
+ {
25
+
26
+ $product_id = $this->getRequest()->getPost('product');
27
+ $product_model = Mage::getModel('catalog/product')->load($product_id);
28
+ $product_type = $product_model->getTypeId();
29
+ $option_details = $this->__('Product Name')." = ";
30
+ $option_details.=$product_model->getName();
31
+ $option_details.="\n";
32
+ switch ($product_type) {
33
+ case "configurable":
34
+ $super_attribute = $this->getRequest()->getPost('super_attribute');
35
+ if($super_attribute!="")
36
+ {
37
+ foreach($super_attribute as $att=>$option_id)
38
+ {
39
+ // Load attribute code
40
+ $attribute_data = Mage::getModel('catalog/resource_eav_attribute')->load($att); // $att is the ID of the attribute.
41
+ $option_details.= $attribute_data->getData('frontend_label');
42
+ $option_details.=" = ";
43
+ $option_col = Mage::getResourceModel( 'eav/entity_attribute_option_collection')
44
+ ->setAttributeFilter($att)
45
+ ->setStoreFilter()
46
+ ->setPositionOrder( 'DESC' );
47
+
48
+ foreach ($option_col AS $option ) {
49
+ if($option->getOptionId()==$option_id)
50
+ {
51
+ $option_details.= $option->getValue();
52
+ }
53
+ }
54
+ $option_details.="\n";
55
+ }
56
+ }
57
+ break;
58
+ case "bundle":
59
+ $bundle_options = $this->getRequest()->getPost('bundle_option');
60
+ // Following code is to simplify array
61
+ foreach($bundle_options as $key=>$bundle_option)
62
+ {
63
+ if(is_array($bundle_option))
64
+ {
65
+ foreach($bundle_option as $k => $v)
66
+ {
67
+ if(strpos($v,',')>-1)
68
+ {
69
+ $mdata = explode(",",$v);
70
+ $bundle_options[$key] = $mdata;
71
+ }
72
+
73
+ }
74
+ }
75
+ }
76
+ // Ends
77
+ $bundled_product = $product_model;
78
+ $selectionCollection = $bundled_product->getTypeInstance(true)->getSelectionsCollection(
79
+ $bundled_product->getTypeInstance(true)->getOptionsIds($bundled_product), $bundled_product
80
+ );
81
+ $bundled_items = array();
82
+ foreach($selectionCollection as $option)
83
+ {
84
+ $simple_product = Mage::getModel('catalog/product')->load($option->product_id);
85
+ //$option->getSelectionId() = value of selected items
86
+ $bundled_items[$option->getSelectionId()] = $simple_product->getName();
87
+ }
88
+ $optionsCollection = $bundled_product->getTypeInstance(true)->getOptionsCollection($bundled_product);
89
+ $optionCollection =array();
90
+ foreach($optionsCollection as $oc)
91
+ {
92
+ $optionCollection[$oc->getOptionId()]=$oc->getDefaultTitle();
93
+ }
94
+ // Code to get Data array in format : case => Apick
95
+ $data =array();
96
+ $m_bundle_option = array();
97
+ foreach($bundle_options as $key=>$bundle_option)
98
+ {
99
+ if(is_array($bundle_option))
100
+ {
101
+ foreach($bundle_option as $k => $v)
102
+ {
103
+ $sdata[$k] = $bundled_items[$v];
104
+ }
105
+ $data[$optionCollection[$key]]= implode(" , ",$sdata);
106
+ }
107
+ else
108
+ {
109
+ $data[$optionCollection[$key]] = $bundled_items[$bundle_option];
110
+ }
111
+ }
112
+ foreach($data as $k =>$v)
113
+ {
114
+ $option_details.=$k;
115
+ $option_details.=" = ";
116
+ $option_details.=$v;
117
+ $option_details.="\n";
118
+ }
119
+
120
+ break;
121
+
122
+ }
123
+
124
+ return $option_details;
125
+ }
126
+
127
+
128
+ }
app/code/local/LR/CallPrice/Helper/Data.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class LR_CallPrice_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ public function loadformurl()
5
+ {
6
+ $loadformurl = Mage::getUrl('callprice/form/loadform');
7
+ return $loadformurl;
8
+ }
9
+
10
+ public function submitformurl()
11
+ {
12
+ $submitformurl = Mage::getUrl('callprice/form/submit');
13
+ return $submitformurl;
14
+ }
15
+
16
+ public function getButtonTitle()
17
+ {
18
+ return Mage::getStoreConfig('catalog/call_for_price/call_for_price_button_text');
19
+ }
20
+
21
+ //check which customer group for which we will show call for price button
22
+ public function allowedCustomerGroup()
23
+ {
24
+
25
+ return Mage::getStoreConfig('catalog/call_for_price/customer_groups');
26
+ }
27
+
28
+ public function getCurrentCustomerGroup()
29
+ {
30
+ $login = Mage::getSingleton( 'customer/session' )->isLoggedIn(); //Check if User is Logged In
31
+ if($login)
32
+ {
33
+ $groupId = Mage::getSingleton('customer/session')->getCustomerGroupId(); //Get Customers Group ID
34
+ return $groupId;
35
+ }
36
+ }
37
+
38
+ public function getSpecificDateRange()
39
+ {
40
+ return Mage::getStoreConfig('catalog/call_for_price/specific_date_range');
41
+ }
42
+ public function getFromDate()
43
+ {
44
+ return Mage::getStoreConfig('catalog/call_for_price/from_date');
45
+ }
46
+ public function getToDate()
47
+ {
48
+ return Mage::getStoreConfig('catalog/call_for_price/to_date');
49
+ }
50
+
51
+ public function getDateToShowButton()
52
+ {
53
+ //Get From To date
54
+ if($this->getSpecificDateRange()==1)
55
+ {
56
+ $fromDate = date('m/d/Y',strtotime($this->getFromDate()));
57
+ $toDate = date('m/d/Y',strtotime($this->getToDate()));
58
+ $todayDate = date('m/d/Y');
59
+ if(strtotime($todayDate)>=strtotime($fromDate) && strtotime($todayDate)<=strtotime($toDate))
60
+ {
61
+ return 1;
62
+ }
63
+ }
64
+ }
65
+
66
+ public function showCallForPriceButton($_product)
67
+ {
68
+ $callpriceflag = 0;
69
+ $callpriceflagparent = 0;
70
+ $callforprice =0;
71
+
72
+ $allowed_customer_groups =array();
73
+ $customer_groups = $this->allowedCustomerGroup(); // Check customer Group
74
+ if($customer_groups!="")
75
+ {
76
+ $allowed_customer_groups = explode(',',$customer_groups);
77
+ }
78
+
79
+ $c_group = $this->getCurrentCustomerGroup(); // current customer group id
80
+
81
+ if(count($allowed_customer_groups)>0)
82
+ {
83
+ if(in_array($c_group,$allowed_customer_groups))
84
+ {
85
+ $showCallForPriceButton =1;
86
+ return $showCallForPriceButton;
87
+ }
88
+ else
89
+ {
90
+ $showCallForPriceButton =0;
91
+
92
+ }
93
+ }
94
+
95
+ $buttonDate = $this->getDateToShowButton();
96
+
97
+ if($buttonDate==1)
98
+ {
99
+ $showCallForPriceButton =1;
100
+ return $showCallForPriceButton;
101
+ }
102
+
103
+ $currentCategory = Mage::registry('current_category'); // check for current category
104
+ if($currentCategory)
105
+ {
106
+ $cat = Mage::getModel('catalog/category')->load($currentCategory->getId());
107
+ $callpriceflag = $cat->getCallForPriceActive();
108
+
109
+ if($cat->getParentCategory())
110
+ {
111
+ $callpriceflagparent = $cat->getParentCategory()->getCallForPriceActive();
112
+ }
113
+ }
114
+
115
+ $callforprice = $_product->getCallForPriceActive(); // Check for product
116
+
117
+
118
+
119
+ if($callforprice==1||$callpriceflagparent==1||$callpriceflag==1)
120
+ {
121
+ $showCallForPriceButton =1;
122
+ }
123
+ return $showCallForPriceButton;
124
+ }
125
+
126
+
127
+ }
128
+
app/code/local/LR/CallPrice/Model/Request.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LR_CallPrice_Model_Request extends Mage_Core_Model_Abstract {
4
+
5
+ protected function _construct() {
6
+ $this->_init("lr_callprice/request");
7
+ }
8
+ }
app/code/local/LR/CallPrice/Model/Resource/Request.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LR_CallPrice_Model_Resource_Request extends Mage_Core_Model_Resource_Db_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ $this->_init("lr_callprice/request", "id");
8
+ }
9
+ }
app/code/local/LR/CallPrice/Model/Resource/Request/Collection.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LR_CallPrice_Model_Resource_Request_Collection
4
+ extends Mage_Core_Model_Resource_Db_Collection_Abstract {
5
+
6
+ public function _construct() {
7
+ $this->_init("lr_callprice/request");
8
+ }
9
+ }
app/code/local/LR/CallPrice/controllers/Adminhtml/CallPricebackendController.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class LR_CallPrice_Adminhtml_CallPricebackendController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ $this->loadLayout();
7
+ $this->_title($this->__("Backend Page Title"));
8
+ $this->renderLayout();
9
+ }
10
+ }
app/code/local/LR/CallPrice/controllers/Adminhtml/RequestController.php ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LR_CallPrice_Adminhtml_RequestController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ protected function _initAction()
6
+ {
7
+ $this->loadLayout()->_setActiveMenu("lr_callprice/request")->_addBreadcrumb(Mage::helper("adminhtml")->__("Request Manager"),Mage::helper("adminhtml")->__("Request Manager"));
8
+ return $this;
9
+ }
10
+ public function indexAction()
11
+ {
12
+ $this->_title($this->__("CallPrice"));
13
+ $this->_title($this->__("Manager Request"));
14
+
15
+ $this->_initAction();
16
+ $this->renderLayout();
17
+ }
18
+ public function editAction()
19
+ {
20
+ $this->_title($this->__("CallPrice"));
21
+ $this->_title($this->__("Request"));
22
+ $this->_title($this->__("Edit Item"));
23
+
24
+ $id = $this->getRequest()->getParam("id");
25
+ $model = Mage::getModel("lr_callprice/request")->load($id);
26
+ if ($model->getId()) {
27
+ Mage::register("request_data", $model);
28
+ $this->loadLayout();
29
+ $this->_setActiveMenu("lr_callprice/request");
30
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Request Manager"), Mage::helper("adminhtml")->__("Request Manager"));
31
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Request Description"), Mage::helper("adminhtml")->__("Request Description"));
32
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
33
+ $this->_addContent($this->getLayout()->createBlock("lr_callprice/adminhtml_request_edit"))->_addLeft($this->getLayout()->createBlock("lr_callprice/adminhtml_request_edit_tabs"));
34
+ $this->renderLayout();
35
+ }
36
+ else {
37
+ Mage::getSingleton("adminhtml/session")->addError(Mage::helper("lr_callprice")->__("Item does not exist."));
38
+ $this->_redirect("*/*/");
39
+ }
40
+ }
41
+
42
+ public function newAction()
43
+ {
44
+
45
+ $this->_title($this->__("CallPrice"));
46
+ $this->_title($this->__("Request"));
47
+ $this->_title($this->__("New Item"));
48
+
49
+ $id = $this->getRequest()->getParam("id");
50
+ $model = Mage::getModel("lr_callprice/request")->load($id);
51
+
52
+ $data = Mage::getSingleton("adminhtml/session")->getFormData(true);
53
+ if (!empty($data)) {
54
+ $model->setData($data);
55
+ }
56
+
57
+ Mage::register("request_data", $model);
58
+
59
+ $this->loadLayout();
60
+ $this->_setActiveMenu("lr_callprice/request");
61
+
62
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
63
+
64
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Request Manager"), Mage::helper("adminhtml")->__("Request Manager"));
65
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Request Description"), Mage::helper("adminhtml")->__("Request Description"));
66
+
67
+
68
+ $this->_addContent($this->getLayout()->createBlock("lr_callprice/adminhtml_request_edit"))->_addLeft($this->getLayout()->createBlock("lr_callprice/adminhtml_request_edit_tabs"));
69
+
70
+ $this->renderLayout();
71
+
72
+ }
73
+ public function saveAction()
74
+ {
75
+ $post_data=$this->getRequest()->getPost();
76
+ if ($post_data) {
77
+ try {
78
+ $model = Mage::getModel("lr_callprice/request")
79
+ ->addData($post_data)
80
+ ->setId($this->getRequest()->getParam("id"))
81
+ ->save();
82
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Request was successfully saved"));
83
+ Mage::getSingleton("adminhtml/session")->setRequestData(false);
84
+ if ($this->getRequest()->getParam("back")) {
85
+ $this->_redirect("*/*/edit", array("id" => $model->getId()));
86
+ return;
87
+ }
88
+ $this->_redirect("*/*/");
89
+ return;
90
+ }
91
+ catch (Exception $e) {
92
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
93
+ Mage::getSingleton("adminhtml/session")->setRequestData($this->getRequest()->getPost());
94
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
95
+ return;
96
+ }
97
+
98
+ }
99
+ $this->_redirect("*/*/");
100
+ }
101
+
102
+
103
+
104
+ public function deleteAction()
105
+ {
106
+ if( $this->getRequest()->getParam("id") > 0 ) {
107
+ try {
108
+ $model = Mage::getModel("lr_callprice/request");
109
+ $model->setId($this->getRequest()->getParam("id"))->delete();
110
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item was successfully deleted"));
111
+ $this->_redirect("*/*/");
112
+ }
113
+ catch (Exception $e) {
114
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
115
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
116
+ }
117
+ }
118
+ $this->_redirect("*/*/");
119
+ }
120
+
121
+ public function massStatusUpdateAction()
122
+ {
123
+ $requestIds = $this->getRequest()->getParam('id'); // $this->getMassactionBlock()->setFormFieldName('tax_id'); from Mage_Adminhtml_Block_Tax_Rate_Grid
124
+ if(!is_array($requestIds)) {
125
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('lr_callprice')->__('Please select status.'));
126
+ } else {
127
+ try {
128
+ $model = Mage::getModel("lr_callprice/request");
129
+ foreach ($requestIds as $requestId) {
130
+ $model->load($requestId);
131
+ if ($model->getId()) {
132
+ $getstatus = $this->getRequest()->getParam("status");
133
+ $model->setStatus($getstatus);
134
+ $model->save();
135
+ }
136
+ }
137
+ Mage::getSingleton('adminhtml/session')->addSuccess(
138
+ Mage::helper('lr_callprice')->__(
139
+ 'Total of %d record(s) were updated.', count($requestIds)
140
+ )
141
+ );
142
+ } catch (Exception $e) {
143
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
144
+ }
145
+ }
146
+ $this->_redirect('*/*/');
147
+ }
148
+
149
+
150
+ }
app/code/local/LR/CallPrice/controllers/FormController.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class LR_CallPrice_FormController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function loadformAction()
5
+ {
6
+ /*$this->loadLayout();
7
+ $this->renderLayout();*/
8
+ $success = true;
9
+ $request_form = $this->getLayout()->createBlock('lr_callprice/form','callforprice.form')->setTemplate('lr/callprice/callforprice_form.phtml')->toHtml();
10
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array('success' => $success,'request_form' => $request_form)));
11
+ }
12
+ protected function _sendEmailTo()
13
+ {
14
+ return Mage::getStoreConfig('catalog/call_for_price/send_email_to');
15
+ }
16
+ protected function _emailSender()
17
+ {
18
+ return Mage::getStoreConfig('catalog/call_for_price/email_sender');
19
+ }
20
+ protected function _sendEmailTemplate()
21
+ {
22
+ return Mage::getStoreConfig('catalog/call_for_price/email_template');
23
+ }
24
+
25
+
26
+ public function submitAction()
27
+ {
28
+
29
+ if ($this->getRequest()->getPost())
30
+ {
31
+ $cp = Mage::getModel('lr_callprice/request');
32
+ $name = $this->getRequest()->getPost('name');
33
+ $email = $this->getRequest()->getPost('email');
34
+ $telephone = $this->getRequest()->getPost('telephone');
35
+ $product_id = $this->getRequest()->getPost('product_id');
36
+ $cp->setCustomerName($name)
37
+ ->setCustomerEmail($email)
38
+ ->setCustomerTelephone($telephone)
39
+ ->setStatus(1) // Set Status to New
40
+ ->setProductId($product_id);
41
+
42
+ $details = $this->getRequest()->getPost('details');
43
+ $cp->setProductName($details);
44
+ try
45
+ {
46
+ $cp->save();
47
+
48
+ /* Send email to Admin */
49
+ $templateId = $this->_sendEmailTemplate();
50
+ $emailTemplate = Mage::getModel('core/email_template')
51
+ ->load($templateId);
52
+
53
+ //Create an array of variables to assign to template
54
+ $data = array();
55
+ $data['name'] = $name;
56
+ $data['email'] = $email;
57
+ $data['telephone'] = $telephone;
58
+ $data['details']= $details;
59
+ $data['status']= "New";
60
+ // $processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables);
61
+ $emailTemplate->send($this->_sendEmailTo(),$this->_emailSender(), $data);
62
+
63
+ $success =true;
64
+ $message = $this->__('Your request is accepted.');
65
+ }
66
+ catch (Exception $e)
67
+ {
68
+ $success =false;
69
+ $message = $this->__('Your Request is Not Sent.');
70
+ }
71
+
72
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array('success' => $success, 'message' => $message,)));
73
+ }
74
+ }
75
+ }
76
+ ?>
app/code/local/LR/CallPrice/data/lr_callprice_setup/data-install-0.1.0.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+
4
+ $installer->startSetup();
5
+
6
+ $installer->addAttribute('catalog_product', 'call_for_price_active', array(
7
+ 'group' => 'Prices',
8
+ 'type' => 'int',
9
+ 'backend' => '',
10
+ 'frontend' => '',
11
+ 'label' => 'Call For Price',
12
+ 'input' => 'select',
13
+ 'class' => '',
14
+ 'source' => 'eav/entity_attribute_source_boolean',
15
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
16
+ 'visible' => true,
17
+ 'required' => false,
18
+ 'user_defined' => false,
19
+ 'default' => 'No',
20
+ 'searchable' => false,
21
+ 'filterable' => false,
22
+ 'comparable' => false,
23
+ 'visible_on_front' => false,
24
+ 'unique' => false,
25
+ 'apply_to' => '',
26
+ 'is_configurable' => false
27
+ ));
28
+
29
+ $installer->endSetup();
app/code/local/LR/CallPrice/data/lr_callprice_setup/data-upgrade-0.1.0-0.2.0.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+
4
+ $installer->startSetup();
5
+
6
+ $installer->addAttribute("catalog_category", "call_for_price_active", array(
7
+ "type" => "int",
8
+ "backend" => "",
9
+ "frontend" => "",
10
+ "label" => "Call For Price",
11
+ "input" => "select",
12
+ "class" => "",
13
+ "source" => "eav/entity_attribute_source_boolean",
14
+ "global" => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
15
+ "visible" => true,
16
+ "required" => false,
17
+ "user_defined" => false,
18
+ "default" => "No",
19
+ "searchable" => false,
20
+ "filterable" => false,
21
+ "comparable" => false,
22
+ "visible_on_front" => false,
23
+ "unique" => false,
24
+ "note" => ""
25
+
26
+ ));
27
+
28
+ $installer->endSetup();
app/code/local/LR/CallPrice/data/lr_callprice_setup/data-upgrade-0.2.0-0.3.0.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+
4
+ $installer->startSetup();
5
+
6
+ $idAttributeOldSelect = $this->getAttribute('catalog_product', 'call_for_price_active', 'attribute_id');
7
+ $installer->updateAttribute('catalog_product', $idAttributeOldSelect, array(
8
+ 'is_visible_on_front'=> true,
9
+ 'used_in_product_listing' => true
10
+ ));
11
+
12
+ $installer->endSetup();
app/code/local/LR/CallPrice/etc/adminhtml.xml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <callprice module="lr_callprice" translate="title" >
5
+ <title>Call For Price</title>
6
+ <sort_order>100</sort_order>
7
+ <children>
8
+ <request module="lr_callprice" translate="title" >
9
+ <title>Manage Request</title>
10
+ <sort_order>0</sort_order>
11
+ <action>adminhtml/request</action>
12
+ </request>
13
+ </children>
14
+ </callprice>
15
+ </menu>
16
+ <acl>
17
+ <resources>
18
+ <admin>
19
+ <children>
20
+ <lr_callprice translate="title" module="lr_callprice">
21
+ <title>CallPrice</title>
22
+ <sort_order>1000</sort_order>
23
+ <children>
24
+ <callpricebackend translate="title">
25
+ <title>Backend Page Title</title>
26
+ </callpricebackend>
27
+ <request translate="title">
28
+ <title>Manage Request</title>
29
+ <sort_order>0</sort_order>
30
+ </request>
31
+ </children>
32
+ </lr_callprice>
33
+ </children>
34
+ </admin>
35
+ </resources>
36
+ </acl>
37
+ </config>
app/code/local/LR/CallPrice/etc/config.xml ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <LR_CallPrice>
5
+ <version>0.3.0</version>
6
+ </LR_CallPrice>
7
+ </modules>
8
+
9
+ <global>
10
+ <blocks>
11
+ <lr_callprice>
12
+ <class>LR_CallPrice_Block</class>
13
+ </lr_callprice>
14
+ </blocks>
15
+ <helpers>
16
+ <lr_callprice>
17
+ <class>LR_CallPrice_Helper</class>
18
+ </lr_callprice>
19
+ </helpers>
20
+ <models>
21
+ <lr_callprice>
22
+ <class>LR_CallPrice_Model</class>
23
+ <resourceModel>lr_callprice_resource</resourceModel>
24
+ </lr_callprice>
25
+ <lr_callprice_resource>
26
+ <class>LR_CallPrice_Model_Resource</class>
27
+ <entities>
28
+ <request>
29
+ <table>lr_callprice_request</table>
30
+ </request>
31
+ </entities>
32
+ </lr_callprice_resource>
33
+ </models>
34
+ <resources>
35
+ <lr_callprice_setup>
36
+ <setup>
37
+ <module>LR_CallPrice</module>
38
+ <class>Mage_Eav_Model_Entity_Setup</class>
39
+ </setup>
40
+ <connection>
41
+ <use>core_setup</use>
42
+ </connection>
43
+ </lr_callprice_setup>
44
+ <lr_callprice_write>
45
+ <connection>
46
+ <use>core_write</use>
47
+ </connection>
48
+ </lr_callprice_write>
49
+ <lr_callprice_read>
50
+ <connection>
51
+ <use>core_read</use>
52
+ </connection>
53
+ </lr_callprice_read>
54
+ </resources>
55
+ <template>
56
+ <email>
57
+ <callprice_email_template module="lr_callprice">
58
+ <label>Call For Price</label>
59
+ <file>call_for_price.html</file>
60
+ <type>html</type>
61
+ </callprice_email_template>
62
+ </email>
63
+ </template>
64
+ </global>
65
+
66
+ <frontend>
67
+ <routers>
68
+ <LR_CallPrice>
69
+ <use>standard</use>
70
+ <args>
71
+ <module>LR_CallPrice</module>
72
+ <frontName>callprice</frontName>
73
+ </args>
74
+ </LR_CallPrice>
75
+ </routers>
76
+ <layout>
77
+ <updates>
78
+ <lr_callprice>
79
+ <file>lr_callprice.xml</file>
80
+ </lr_callprice>
81
+ </updates>
82
+ </layout>
83
+ <translate>
84
+ <modules>
85
+ <LR_CallPrice>
86
+ <files>
87
+ <default>LR_CallPrice.csv</default>
88
+ </files>
89
+ </LR_CallPrice>
90
+ </modules>
91
+ </translate>
92
+ </frontend>
93
+
94
+ <admin>
95
+ <routers>
96
+ <adminhtml>
97
+ <args>
98
+ <modules>
99
+ <lr_callprice after="Mage_Adminhtml">LR_CallPrice_Adminhtml</lr_callprice>
100
+ </modules>
101
+ </args>
102
+ </adminhtml>
103
+ </routers>
104
+ </admin>
105
+
106
+ <adminhtml>
107
+ <layout>
108
+ <updates>
109
+ <lr_callprice>
110
+ <file>lr_callprice.xml</file>
111
+ </lr_callprice>
112
+ </updates>
113
+ </layout>
114
+ <translate>
115
+ <modules>
116
+ <LR_CallPrice>
117
+ <files>
118
+ <default>LR_CallPrice.csv</default>
119
+ </files>
120
+ </LR_CallPrice>
121
+ </modules>
122
+ </translate>
123
+ </adminhtml>
124
+ </config>
app/code/local/LR/CallPrice/etc/system.xml ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <catalog translate="label" module="lr_callprice">
5
+ <groups>
6
+ <call_for_price translate="label">
7
+ <label>Call For Price</label>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>0</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <fields>
14
+ <call_for_price_button_text translate="label">
15
+ <label>Call For Price Button Text</label>
16
+ <frontend_type>text</frontend_type>
17
+ <sort_order>1</sort_order>
18
+ <show_in_default>1</show_in_default>
19
+ <show_in_website>1</show_in_website>
20
+ <show_in_store>1</show_in_store>
21
+ <comment>This is the text to be displayed in the Call For Price button</comment>
22
+ </call_for_price_button_text>
23
+ <send_email_to translate="label">
24
+ <label>Send Email To</label>
25
+ <frontend_type>text</frontend_type>
26
+ <sort_order>2</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ <comment>The email address to which the price request email will be sent</comment>
31
+ </send_email_to>
32
+ <email_sender translate="label">
33
+ <label>Email Sender</label>
34
+ <frontend_type>select</frontend_type>
35
+ <source_model>adminhtml/system_config_source_email_identity</source_model>
36
+ <sort_order>3</sort_order>
37
+ <show_in_default>1</show_in_default>
38
+ <show_in_website>1</show_in_website>
39
+ <show_in_store>1</show_in_store>
40
+ <comment>Email Sender</comment>
41
+ </email_sender>
42
+ <email_template translate="label">
43
+ <label>Email Template</label>
44
+ <frontend_type>select</frontend_type>
45
+ <source_model>adminhtml/system_config_source_email_template</source_model>
46
+ <sort_order>4</sort_order>
47
+ <show_in_default>1</show_in_default>
48
+ <show_in_website>1</show_in_website>
49
+ <show_in_store>1</show_in_store>
50
+ <comment>Choose Email Template</comment>
51
+ </email_template>
52
+ <customer_groups translate="label">
53
+ <label>Customer Groups</label>
54
+ <frontend_type>multiselect</frontend_type>
55
+ <source_model>adminhtml/system_config_source_customer_group</source_model>
56
+ <sort_order>5</sort_order>
57
+ <show_in_default>1</show_in_default>
58
+ <show_in_website>1</show_in_website>
59
+ <show_in_store>1</show_in_store>
60
+ <comment>customer groups to which the Call For Price functionality will be applied</comment>
61
+ </customer_groups>
62
+ <specific_date_range translate="label">
63
+ <label>Show on Specific Date Range</label>
64
+ <frontend_type>select</frontend_type>
65
+ <source_model>adminhtml/system_config_source_yesno</source_model>
66
+ <sort_order>6</sort_order>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>1</show_in_website>
69
+ <show_in_store>1</show_in_store>
70
+ <comment>If set to yes, the Call For Price Buttons will only be available in the front-end
71
+ during a particular date range. If set to No, the functionality will always be
72
+ available.
73
+ </comment>
74
+ </specific_date_range>
75
+ <from_date translate="label">
76
+ <label>From Date</label>
77
+ <frontend_type>text</frontend_type>
78
+ <frontend_model>lr_callprice/adminhtml_system_config_date</frontend_model>
79
+ <sort_order>7</sort_order>
80
+ <show_in_default>1</show_in_default>
81
+ <show_in_website>1</show_in_website>
82
+ <show_in_store>1</show_in_store>
83
+ <depends>
84
+ <specific_date_range>1</specific_date_range>
85
+ </depends>
86
+ <comment>From Date</comment>
87
+ </from_date>
88
+ <to_date translate="label">
89
+ <label>To Date</label>
90
+ <frontend_type>text</frontend_type>
91
+ <frontend_model>lr_callprice/adminhtml_system_config_date</frontend_model>
92
+ <sort_order>8</sort_order>
93
+ <show_in_default>1</show_in_default>
94
+ <show_in_website>1</show_in_website>
95
+ <show_in_store>1</show_in_store>
96
+ <depends>
97
+ <specific_date_range>1</specific_date_range>
98
+ </depends>
99
+ <comment>To Date</comment>
100
+ </to_date>
101
+ </fields>
102
+ </call_for_price>
103
+ </groups>
104
+ </catalog>
105
+ </sections>
106
+ </config>
app/code/local/LR/CallPrice/sql/lr_callprice_setup/install-0.1.0.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+
4
+ $installer->startSetup();
5
+
6
+ $installer->getConnection()->dropTable($installer->getTable('lr_callprice/request'));
7
+
8
+ $table = $installer->getConnection()
9
+ ->newTable($installer->getTable('lr_callprice/request'))
10
+ ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
11
+ 'identity' => true,
12
+ 'unsigned' => true,
13
+ 'nullable' => false,
14
+ 'primary' => true
15
+ ), 'ID')
16
+ ->addColumn('customer_name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
17
+ 'nullable' => false
18
+ ), 'Name')
19
+ ->addColumn('customer_email', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
20
+ 'nullable' => false
21
+ ), 'Email')
22
+ ->addColumn('customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
23
+ 'unsigned' => true,
24
+ 'nullable' => false
25
+ ), 'Customer ID')
26
+ ->addColumn('customer_telephone', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
27
+ 'nullable' => false
28
+ ), 'Customer Telephone')
29
+ ->addColumn('product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
30
+ 'unsigned' => true,
31
+ 'nullable' => false
32
+ ), 'Product ID')
33
+ ->addColumn('product_name', Varien_Db_Ddl_Table::TYPE_TEXT,null, array(
34
+ 'nullable' => false
35
+ ), 'Product Name')
36
+ ->addColumn('status', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
37
+ 'nullable' => false
38
+ ), 'Status');
39
+
40
+ $installer->getConnection()->createTable($table);
41
+
42
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/lr_callprice.xml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <adminhtml_callpricebackend_index>
4
+ <reference name="content">
5
+ <block type="lr_callprice/adminhtml_callpricebackend" name="callpricebackend" template="lr/callprice/callpricebackend.phtml"/>
6
+ </reference>
7
+ </adminhtml_callpricebackend_index>
8
+
9
+ <adminhtml_request_index>
10
+ <reference name="content">
11
+ <block type="lr_callprice/adminhtml_request" name="request" />
12
+ </reference>
13
+ </adminhtml_request_index>
14
+ </layout>
app/design/frontend/base/default/layout/lr_callprice.xml ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+
4
+ <!--
5
+ Default layout, loads most of the pages
6
+ -->
7
+ <default>
8
+ <reference name="head">
9
+ <action method="addItem"><type>skin_js</type><name>js/lr_callprice/callprice.js</name></action>
10
+ <action method="addJs"><script>lr_callprice/jquery-1.9.0.min.js</script></action>
11
+ <action method="addJs"><script>lr_callprice/jquery.fancybox.js</script></action>
12
+ <action method="addJs"><script>lr_callprice/jquery.fancybox.pack.js</script></action>
13
+ <action method="addJs"><script>lr_callprice/jquery.mousewheel-3.0.6.pack.js</script></action>
14
+ <action method="addJs"><script>lr_callprice/jquery.noconflict.js</script></action>
15
+ <action method="addCss"><stylesheet>css/lr_callprice/callprice.css</stylesheet></action>
16
+ <action method="addCss"><stylesheet>css/lr_callprice/jquery.fancybox.css</stylesheet></action>
17
+ </reference>
18
+ </default>
19
+
20
+
21
+ <catalog_product_view>
22
+ <reference name="product.info">
23
+ <block type="catalog/product_view" name="product.info.addtocart" as="addtocart" template="lr/callprice/callforprice.phtml"/>
24
+ </reference>
25
+ <reference name="product.info.options.wrapper.bottom">
26
+ <block type="catalog/product_view" name="product.info.addtocart" as="addtocart" template="lr/callprice/callforprice.phtml"/>
27
+ </reference>
28
+ </catalog_product_view>
29
+
30
+ <catalog_category_default translate="label">
31
+ <reference name="category.products">
32
+ <block type="catalog/product_list" name="product_list" template="lr/callprice/catalog/product/list.phtml">
33
+ <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
34
+ <block type="page/html_pager" name="product_list_toolbar_pager"/>
35
+ </block>
36
+ <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
37
+ <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
38
+ <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
39
+ <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
40
+ <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
41
+ <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
42
+ </block>
43
+ </reference>
44
+ </catalog_category_default>
45
+
46
+ <catalog_category_layered>
47
+ <reference name="category.products">
48
+ <block type="catalog/product_list" name="product_list" template="lr/callprice/catalog/product/list.phtml">
49
+ <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
50
+ <block type="page/html_pager" name="product_list_toolbar_pager"/>
51
+ </block>
52
+ <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
53
+ <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
54
+ <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
55
+ <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
56
+ <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
57
+ <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
58
+ </block>
59
+ </reference>
60
+ </catalog_category_layered>
61
+
62
+ <catalogsearch_result_index>
63
+ <reference name="search.result">
64
+ <block type="catalog/product_list" name="search_result_list" template="lr/callprice/catalog/product/list.phtml">
65
+ <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
66
+ <block type="page/html_pager" name="product_list_toolbar_pager"/>
67
+ </block>
68
+ <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
69
+ <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
70
+ <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
71
+ <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
72
+ <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
73
+ <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
74
+ </block>
75
+ <action method="setListOrders"/>
76
+ <action method="setListModes"/>
77
+ <action method="setListCollection"/>
78
+ </reference>
79
+ </catalogsearch_result_index>
80
+
81
+ <PRODUCT_TYPE_simple translate="label" module="catalog">
82
+ <label>Catalog Product View (Simple)</label>
83
+ <reference name="product.info">
84
+ <block type="catalog/product_view_type_simple" name="product.info.simple" as="product_type_data" template="lr/callprice/catalog/product/view/type/default.phtml">
85
+ <block type="core/text_list" name="product.info.simple.extra" as="product_type_data_extra" translate="label">
86
+ <label>Product Extra Info</label>
87
+ </block>
88
+ </block>
89
+ </reference>
90
+ </PRODUCT_TYPE_simple>
91
+ <PRODUCT_TYPE_configurable translate="label" module="catalog">
92
+ <label>Catalog Product View (Configurable)</label>
93
+ <reference name="product.info">
94
+ <block type="catalog/product_view_type_configurable" name="product.info.configurable" as="product_type_data" template="lr/callprice/catalog/product/view/type/default.phtml">
95
+ <block type="core/text_list" name="product.info.configurable.extra" as="product_type_data_extra" translate="label">
96
+ <label>Product Extra Info</label>
97
+ </block>
98
+ </block>
99
+ </reference>
100
+ </PRODUCT_TYPE_configurable>
101
+ <PRODUCT_TYPE_virtual translate="label" module="catalog">
102
+ <label>Catalog Product View (Virtual)</label>
103
+ <reference name="product.info">
104
+ <block type="catalog/product_view_type_virtual" name="product.info.virtual" as="product_type_data" template="lr/callprice/catalog/product/view/type/default.phtml">
105
+ <block type="core/text_list" name="product.info.virtual.extra" as="product_type_data_extra" translate="label">
106
+ <label>Product Extra Info</label>
107
+ </block>
108
+ </block>
109
+ </reference>
110
+ </PRODUCT_TYPE_virtual>
111
+
112
+ </layout>
app/design/frontend/base/default/template/lr/callprice/callforprice.phtml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_product = $this->getProduct(); ?>
2
+
3
+ <?php $loadformurl = $this->helper('lr_callprice')->loadformurl();?>
4
+ <?php // Get customer Group
5
+
6
+ ?>
7
+ <?php if($this->helper("lr_callprice")->showCallForPriceButton($_product)==1):?>
8
+ <?php $buttonTitle = Mage::getStoreConfig('catalog/call_for_price/call_for_price_button_text'); ?>
9
+ <?php if($_product->isSaleable()): ?>
10
+ <div class="add-to-cart">
11
+ <button type="button" title="<?php echo $buttonTitle ?>" id="callforprice_btn_<?php echo $_product->getId()?>" onClick="if(productAddToCartForm.validator && productAddToCartForm.validator.validate()){loadCallForPriceForm('<?php echo $loadformurl ?>')}" class="button btn-cart"><span><span><?php echo $buttonTitle ?></span></span></button>
12
+ </div>
13
+ <?php endif; ?>
14
+ <!-- Replace Price -->
15
+ <!-- <script type="text/javascript">
16
+ //$$('div.price-box .price')[0].innerHTML="NA";
17
+ // $$('div.price-box .price')[1].innerHTML="NA";
18
+ $$('div.price-box').invoke('setStyle', { display: 'none' });
19
+ </script>-->
20
+ <?php else:?>
21
+ <?php $buttonTitle = $this->__('Add to Cart'); ?>
22
+ <?php if($_product->isSaleable()): ?>
23
+ <div class="add-to-cart">
24
+ <?php if(!$_product->isGrouped()): ?>
25
+ <label for="qty"><?php echo $this->__('Qty:') ?></label>
26
+ <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
27
+ <?php endif; ?>
28
+ <button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>
29
+ <?php echo $this->getChildHtml('', true, true) ?>
30
+ </div>
31
+ <?php endif; ?>
32
+ <?php endif; ?>
33
+
34
+
35
+
app/design/frontend/base/default/template/lr/callprice/callforprice_form.phtml ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ (c) Copyright 2012 X.commerce, Inc.
4
+
5
+ All rights reserved. No part of this code shall be reproduced,
6
+ stored in a retrieval system, or transmitted by any means,
7
+ electronic, mechanical, photocopying, recording, or otherwise,
8
+ without written permission from X.commerce, Inc. 04-15-2012
9
+
10
+ Please be aware that this code is not production ready.
11
+ It is distributed to serve as an educational example, but in
12
+ some cases error checking or something similar might have been
13
+ neglected.
14
+ */
15
+ ?>
16
+ <?php $submiturl = $this->helper('lr_callprice')->submitformurl();?>
17
+ <?php $customer_id = Mage::getSingleton('customer/session')->getCustomer()->getId();
18
+ if($customer_id!="")
19
+ {
20
+ $customerData = Mage::getModel('customer/customer')->load($customer_id);
21
+
22
+ }
23
+ ?>
24
+ <div class="callprice_request_form">
25
+ <form action="<?php echo $this->getFormAction() ?>" name="cp_form" id="cp_form" method="post">
26
+ <div class="fieldset">
27
+
28
+ <ul class="form-list">
29
+ <li class="fields">
30
+ <div class="field">
31
+ <label class="required" for="name"><em>*</em><?php echo $this->__('Name') ?></label>
32
+ <div class="input-box">
33
+ <input id="name" name="name" type="text" class="input-text required-entry" value="<?php echo Mage::getSingleton('customer/session')->getCustomer()->getName() ?>"/>
34
+ </div>
35
+ </div>
36
+ <div class="field">
37
+ <label class="required" for="email"><em>*</em><?php echo $this->__('Email') ?></label>
38
+ <div class="input-box">
39
+ <input id="email" name="email" type="text" class="input-text required-entry validate-email" value="<?php echo Mage::getSingleton('customer/session')->getCustomer()->getEmail() ?>"/>
40
+ </div>
41
+ </div>
42
+ </li>
43
+ <li>
44
+ <label class="required" for="telephone"><em>*</em><?php echo $this->__('Telephone') ?></label>
45
+ <div class="input-box">
46
+ <input id="telephone" name="telephone" type="text" class="input-text required-entry " value="<?php echo Mage::getSingleton('customer/session')->getCustomer()->getTelephone() ?>"/>
47
+ </div>
48
+ </li>
49
+ <li class="wide">
50
+ <label class="required" for="comment"><em>*</em><?php echo $this->__('Request Details') ?></label>
51
+ <div class="input-box">
52
+ <textarea rows="3" cols="5" class="required-entry input-text" title="details" id="details" name="details"><?php echo $this->option_details() ?></textarea>
53
+ </div>
54
+ <div class="request_details_message"><?php echo $this->__('Note: Please include as much details and relevant options about the item to help us match your request with an accurate price.'); ?></div>
55
+ </li>
56
+ </ul>
57
+ <div>
58
+ <button type="button" class="button" onclick="if(dataForm.validator && dataForm.validator.validate()){submitcallforpriceform(this.form,'<?php echo $submiturl?>');}"><span><?php echo $this->__('Submit') ?></span></button>
59
+ </div>
60
+ </div>
61
+ <input type="hidden" name="product_id" value="<?php echo $this->getProductId(); ?>"/>
62
+ </form>
63
+ </div>
64
+ <script type="text/javascript">
65
+ //<![CDATA[
66
+ var dataForm = new VarienForm('cp_form', true);
67
+ //]]>
68
+ </script>
app/design/frontend/base/default/template/lr/callprice/catalog/product/list.phtml ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2012 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
28
+ /**
29
+ * Product list template
30
+ *
31
+ * @see Mage_Catalog_Block_Product_List
32
+ */
33
+ $loadformurl = $this->helper('lr_callprice')->loadformurl();
34
+ ?>
35
+ <?php
36
+ $_productCollection=$this->getLoadedProductCollection();
37
+ $_helper = $this->helper('catalog/output');
38
+ ?>
39
+ <?php if(!$_productCollection->count()): ?>
40
+ <p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
41
+ <?php else: ?>
42
+ <div class="category-products">
43
+ <?php echo $this->getToolbarHtml() ?>
44
+ <?php // List mode ?>
45
+ <?php if($this->getMode()!='grid'): ?>
46
+ <?php $_iterator = 0; ?>
47
+ <ol class="products-list" id="products-list">
48
+ <?php foreach ($_productCollection as $_product): ?>
49
+ <li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
50
+ <?php // Product Image ?>
51
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
52
+ <?php // Product description ?>
53
+ <div class="product-shop">
54
+ <div class="f-fix">
55
+ <?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
56
+ <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2>
57
+ <?php if($_product->getRatingSummary()): ?>
58
+ <?php echo $this->getReviewsSummaryHtml($_product) ?>
59
+ <?php endif; ?>
60
+ <?php if($this->helper("lr_callprice")->showCallForPriceButton($_product)==1):?>
61
+ <?php
62
+ // Dont show Price
63
+ $showCallForPriceButton = 1;
64
+ ?>
65
+ <?php else:?>
66
+ <?php echo $this->getPriceHtml($_product, true) ?>
67
+ <?php endif; ?>
68
+ <?php if($_product->isSaleable()): ?>
69
+ <?php if($showCallForPriceButton==1):?>
70
+ <?php $buttonTitle = $this->helper("lr_callprice")->getButtonTitle(); ?>
71
+ <p><button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="setLocation('<?php echo $_product->getProductUrl() ?>')"><span><span><?php echo $buttonTitle ?></span></span></button></p>
72
+ <?php else:?>
73
+
74
+ <p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
75
+ <?php endif; ?>
76
+ <?php else: ?>
77
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
78
+ <?php endif; ?>
79
+
80
+ <div class="desc std">
81
+ <?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
82
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>" class="link-learn"><?php echo $this->__('Learn More') ?></a>
83
+ </div>
84
+ <ul class="add-to-links">
85
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
86
+ <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
87
+ <?php endif; ?>
88
+ <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
89
+ <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
90
+ <?php endif; ?>
91
+ </ul>
92
+ </div>
93
+ </div>
94
+ </li>
95
+ <?php endforeach; ?>
96
+ </ol>
97
+ <script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
98
+
99
+ <?php else: ?>
100
+
101
+ <?php // Grid Mode ?>
102
+
103
+ <?php $_collectionSize = $_productCollection->count() ?>
104
+ <?php $_columnCount = $this->getColumnCount(); ?>
105
+ <?php $i=0; foreach ($_productCollection as $_product): ?>
106
+ <?php if ($i++%$_columnCount==0): ?>
107
+ <ul class="products-grid">
108
+ <?php endif ?>
109
+ <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
110
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
111
+ <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
112
+ <?php if($_product->getRatingSummary()): ?>
113
+ <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
114
+ <?php endif; ?>
115
+ <?php if($this->helper("lr_callprice")->showCallForPriceButton($_product)==1):?>
116
+ <?php
117
+ // Dont show Price
118
+ $showCallForPriceButton = 1;
119
+ ?>
120
+ <?php else:?>
121
+ <?php echo $this->getPriceHtml($_product, true) ?>
122
+ <?php endif; ?>
123
+ <div class="actions">
124
+ <?php if($_product->isSaleable()): ?>
125
+ <?php if($showCallForPriceButton==1):?>
126
+ <?php $buttonTitle = $this->helper("lr_callprice")->getButtonTitle(); ?>
127
+ <p><button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onClick="setLocation('<?php echo $_product->getProductUrl() ?>')"><span><span><?php echo $buttonTitle ?></span></span></button></p>
128
+ <?php else:?>
129
+ <p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
130
+ <?php endif; ?>
131
+ <?php else: ?>
132
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
133
+ <?php endif; ?>
134
+ <ul class="add-to-links">
135
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
136
+ <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
137
+ <?php endif; ?>
138
+ <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
139
+ <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
140
+ <?php endif; ?>
141
+ </ul>
142
+ </div>
143
+ </li>
144
+ <?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
145
+ </ul>
146
+ <?php endif ?>
147
+ <?php endforeach ?>
148
+ <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
149
+ <?php endif; ?>
150
+
151
+ <div class="toolbar-bottom">
152
+ <?php echo $this->getToolbarHtml() ?>
153
+ </div>
154
+ </div>
155
+ <?php endif; ?>
app/design/frontend/base/default/template/lr/callprice/catalog/product/view/type/default.phtml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2012 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_Abstract */?>
28
+ <?php $_product = $this->getProduct() ?>
29
+
30
+ <?php if ($_product->isAvailable()): ?>
31
+ <p class="availability in-stock"><?php echo $this->__('Availability:') ?> <span><?php echo $this->__('In stock') ?></span></p>
32
+ <?php else: ?>
33
+ <p class="availability out-of-stock"><?php echo $this->__('Availability:') ?> <span><?php echo $this->__('Out of stock') ?></span></p>
34
+ <?php endif; ?>
35
+ <?php echo $this->getChildHtml('product_type_data_extra') ?>
36
+ <?php if($this->helper("lr_callprice")->showCallForPriceButton($_product)!=1):?>
37
+ <?php echo $this->getPriceHtml($_product) ?>
38
+ <?php endif; ?>
app/etc/modules/LR_CallPrice.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <LR_CallPrice>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ <version>0.1.0</version>
8
+ </LR_CallPrice>
9
+ </modules>
10
+ </config>
app/locale/en_GB/LR_CallPrice.csv ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Call For Price","Call For Price"
2
+ "Product Name","Product Name"
3
+ "Your request is accepted.","Your request is accepted."
4
+ "Your Request is Not Sent.","Your Request is Not Sent."
5
+ "Name","Name"
6
+ "Email","Email"
7
+ "Telephone","Telephone"
8
+ "Request Details","Request Details"
9
+ "Request Manager","Request Manager"
10
+ "Delete Item","Delete Item"
11
+ "New","New"
12
+ "Complete","Complete"
13
+ "Change status","Change status"
14
+ "Status","Status"
15
+ "ID","ID"
16
+ "Customer Name","Customer Name"
17
+ "Customer Email","Customer Email"
18
+ "Customer Telephone","Customer Telephone"
19
+ "Product Id","Product Id"
20
+ "Action","Action"
21
+ "View","View"
22
+ "Request Information","Request Information"
23
+ "Call For Price Request Information","Call For Price Request Information"
app/locale/en_US/LR_CallPrice.csv ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Call For Price","Call For Price"
2
+ "Product Name","Product Name"
3
+ "Your request is accepted.","Your request is accepted."
4
+ "Your Request is Not Sent.","Your Request is Not Sent."
5
+ "Name","Name"
6
+ "Email","Email"
7
+ "Telephone","Telephone"
8
+ "Request Details","Request Details"
9
+ "Request Manager","Request Manager"
10
+ "Delete Item","Delete Item"
11
+ "New","New"
12
+ "Complete","Complete"
13
+ "Change status","Change status"
14
+ "Status","Status"
15
+ "ID","ID"
16
+ "Customer Name","Customer Name"
17
+ "Customer Email","Customer Email"
18
+ "Customer Telephone","Customer Telephone"
19
+ "Product Id","Product Id"
20
+ "Action","Action"
21
+ "View","View"
22
+ "Request Information","Request Information"
23
+ "Call For Price Request Information","Call For Price Request Information"
app/locale/en_US/template/email/call_for_price.html ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject Call for Price Request@-->
2
+ <!--@vars
3
+ {"var data.name":"Sender Name",
4
+ "var data.email":"Sender Email",
5
+ "var data.telephone":"Sender Telephone",
6
+ "var data.details":"Details"}
7
+ @-->
8
+ Name: {{var data.name}}
9
+ E-mail: {{var data.email}}
10
+ Telephone: {{var data.telephone}}
11
+
12
+ Request Details: {{var data.details}}
package.xml ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>lr_callprice</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>This extension hides the price and the add to cart button for specific products and replaces it with a &#xD;
10
+ Call For Price Button. This feature is applied to Product Details page , Product List page (Categroy page),&#xD;
11
+ Search result page.</summary>
12
+ <description>1. This extension hides the price and the add to cart button for specific products and replaces it with a &#xD;
13
+ Call For Price Button. This feature is applied to Product Details page , Product List page (Categroy page),&#xD;
14
+ Search result page. The above functionality can be set both at Product Level and Category Level. In the case&#xD;
15
+ of categories, all the products in that category will show the Call For Price Button. The above functionality&#xD;
16
+ may also be set to target specific Customer Groups. Also we can enable call for price feature for specific time&#xD;
17
+ period set in admin under module's configuration.&#xD;
18
+ &#xD;
19
+ 2. The extension uses Jquery/Fancy Box.&#xD;
20
+ &#xD;
21
+ 3. This extension support Simple Products, Configurable Products, Bundle Products, Virtual Products.&#xD;
22
+ &#xD;
23
+ 4. This extension Created call_for_price_active attribute for both Product and Category. With Default value set to NO.&#xD;
24
+ Also one custom email template is added named : Call For Price which will be used for sending email to admin.&#xD;
25
+ &#xD;
26
+ 5. The extension creates 1 database table&#xD;
27
+ - lr_callprice_request &#xD;
28
+ &#xD;
29
+ 6. This does not override any Core classes.&#xD;
30
+ &#xD;
31
+ 7. The extension overrides the catalog/product/view/addtocart.phtml template for Product View page. The template change is done through&#xD;
32
+ layout XML, where the callprice/callforprice.phtml template is set to the product info block.&#xD;
33
+ &#xD;
34
+ The extension overrides the catalog/product/list.phtml template for Product List page. The template change is done through&#xD;
35
+ layout XML, where the callprice/catalog/product/list.phtml template is set to the Product List block.&#xD;
36
+ &#xD;
37
+ This extension uses callprice/callforprice_form.phtml template file for Request Form when we click on Call For Price button on product view page.&#xD;
38
+ &#xD;
39
+ Frontend&#xD;
40
+ -----------------------------------------------------------------------------------------------------------&#xD;
41
+ &#xD;
42
+ 1. When Call For Price is enabled for specific product than will not see price for that product and also add to cart button will be replaced by&#xD;
43
+ Call For Price button.&#xD;
44
+ &#xD;
45
+ If Call For Price is enabled for specific categroy than will have all products of that categroy shows Call For Price Button.&#xD;
46
+ &#xD;
47
+ If Call for price is enabled for specific Customer Group , than when customer login and belogs to that Group will see Call For Price button&#xD;
48
+ Instead of Add to Cart and will not be able to see Price.&#xD;
49
+ &#xD;
50
+ If Call for Price is enabled for specific Date Range From - To than will have Call For Price Button visible instead of Add to cart for all products.&#xD;
51
+ &#xD;
52
+ 2. Clicking on Call For Price button will open Call for Price Request form in Popup with fields Name , Email ,Telephone and Request Details.&#xD;
53
+ All fields are Mandatory. And Auto Fill like customer is loggin than his Name , Email and Telephone will be pre filled.&#xD;
54
+ The Request Details field will have pre filled Product name , and selected product options in text format. &#xD;
55
+ Like &#xD;
56
+ Product name = Test&#xD;
57
+ Shirt Size = Small&#xD;
58
+ Color = Red &#xD;
59
+ &#xD;
60
+ This form has Validation feature.&#xD;
61
+ When we submit this form , it will save data to DB table and send email to Admin.&#xD;
62
+ &#xD;
63
+ &#xD;
64
+ Backend&#xD;
65
+ -----------------------------------------------------------------------------------------------------------&#xD;
66
+ &#xD;
67
+ 1. All Call For Price Request can be viewed in the backend by visiting CallPrice -&gt; Manage Request Menu&#xD;
68
+ &#xD;
69
+ 2. A Request view is available by clicking on a particular Request. Admin can change status of that request either Complete.&#xD;
70
+ &#xD;
71
+ &#xD;
72
+ System Configurations&#xD;
73
+ -----------------------------------------------------------------------------------------------------------&#xD;
74
+ &#xD;
75
+ 1. Set Call for Price Module configuration.&#xD;
76
+ &#xD;
77
+ System -&gt; Configuration -&gt; Catalog -&gt; Catalog -&gt; Call for Price&#xD;
78
+ &#xD;
79
+ We have following Fields.&#xD;
80
+ - Call For Price Button Text : This is the text to be displayed in the Call For Price button&#xD;
81
+ - Send Email To : The email address to which the price request email will be sent&#xD;
82
+ - Email Sender : Email Sender&#xD;
83
+ - Email Template : choose email template&#xD;
84
+ - Customer Groups : customer groups to which the Call For Price functionality will be applied&#xD;
85
+ - Show on Specific Date Range : If set to yes, the Call For Price Buttons will only be available in the front-end during a &#xD;
86
+ particular date range. If set to No, the functionality will always be available.&#xD;
87
+ - From Date : From Date&#xD;
88
+ - To Date : To Date&#xD;
89
+ </description>
90
+ <notes>Hides the price and the add to cart button for specific products and replaces it with a Call For Price Button. This feature is applied to Product Details page , Product List page (Categroy page),Search result page.</notes>
91
+ <authors><author><name>Mitesh Prajapati</name><user>Mitesh</user><email>sales@logicrays.com</email></author></authors>
92
+ <date>2014-04-11</date>
93
+ <time>06:46:31</time>
94
+ <contents><target name="magelocal"><dir name="LR"><dir name="CallPrice"><dir name="Block"><dir name="Adminhtml"><dir name="Request"><dir name="Edit"><file name="Form.php" hash="ca80be2858019a611a1381d3816ed6c2"/><dir name="Tab"><file name="Form.php" hash="567302731fd079696b37f6b7c167beca"/></dir><file name="Tabs.php" hash="b0579c8c81083948cfbecf63afa9455a"/></dir><file name="Edit.php" hash="6c48a184991cc43106ca0edecec5a235"/><file name="Grid.php" hash="924aff6a7f2944788d37404f2fd309e9"/></dir><file name="Request.php" hash="461952cac3ab74e08b90fa08c845f745"/><dir name="System"><dir name="Config"><file name="Date.php" hash="4d354f46dffb766e83469d0135418893"/></dir></dir></dir><file name="Form.php" hash="1b6f7e179db700b5cb9da47c1caadc32"/></dir><dir name="Helper"><file name="Data.php" hash="28d17ac030b4a92fe7ad4cc18507d4b1"/></dir><dir name="Model"><file name="Request.php" hash="254a51ae63b09f3f61a2539bca18ca3b"/><dir name="Resource"><dir name="Request"><file name="Collection.php" hash="58ee4a7c9304974ba2bcbbde98f26dab"/></dir><file name="Request.php" hash="a482ac4af4fee1d140cc9786e6a971f0"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CallPricebackendController.php" hash="a60d1324b62058e47663cad47b3ac08a"/><file name="RequestController.php" hash="260d44142f9a4398573b9f006318e686"/></dir><file name="FormController.php" hash="22051ae31dafc8296bed882bedc71b5f"/></dir><dir name="data"><dir name="lr_callprice_setup"><file name="data-install-0.1.0.php" hash="1406b66a5d915b55bd193c3954655077"/><file name="data-upgrade-0.1.0-0.2.0.php" hash="05d312bb2ca503ad26cc3071b3690f37"/><file name="data-upgrade-0.2.0-0.3.0.php" hash="786f5c280bc73001adb4d069f9588930"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="c6b450426da599ecad781c397d1a3f08"/><file name="config.xml" hash="845055b50bb226a31fc2de42d4ee0c2f"/><file name="system.xml" hash="20db39141d163ef775b1110a1df0c710"/></dir><dir name="sql"><dir name="lr_callprice_setup"><file name="install-0.1.0.php" hash="829f90276d1521ae6c3e3e5027ce5cf6"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="lr_callprice.xml" hash="17d955767f903389cdfa1a8a1c31bbb5"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="lr_callprice.xml" hash="1f52df397d1c8a099b3d0767ab475b45"/></dir><dir name="template"><dir name="lr"><dir name="callprice"><file name="callforprice.phtml" hash="b8c90c0cdac8aa88ad395c3fa3c7e84d"/><file name="callforprice_form.phtml" hash="9c78a95d392743586ef253470eca9955"/><dir name="catalog"><dir name="product"><file name="list.phtml" hash="99cb216a38a2c56cbdb8a68dd6846bb6"/><dir name="view"><dir name="type"><file name="default.phtml" hash="51f450b4fd067e1e08d746c02085c177"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="LR_CallPrice.xml" hash="2597a5e343a49d3e4dc782c9f8b0f271"/></dir></target><target name="magelocale"><dir name="en_GB"><file name="LR_CallPrice.csv" hash="b08e805951e0a40cc171180b4e03d1eb"/></dir><dir name="en_US"><file name="LR_CallPrice.csv" hash="49144994748e14c53ecc74ad41c5a217"/><dir name="template"><dir name="email"><file name="call_for_price.html" hash="ccd00c420102967a5834716cf15d2191"/></dir></dir></dir></target><target name="mage"><dir name="js"><file name="lr_callprice" hash=""/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="lr_callprice"><file name="callprice.css" hash="b464caa44e3d8c4b5af67adf711b98d6"/><file name="jquery.fancybox-buttons.css" hash="741e2da2561d3b82fb87be3b6a5520ec"/><file name="jquery.fancybox-thumbs.css" hash="84a2c1e5c79aeaf87c0ba0732bc861b3"/><file name="jquery.fancybox.css" hash="8ba5ca1cb14564b434f0382731584b90"/></dir></dir><dir name="images"><dir name="lr_callprice"><file name="blank.gif" hash="325472601571f31e1bf00674c368d335"/><file name="fancybox_buttons.png" hash="b448080f8615e664b7788c7003803b59"/><file name="fancybox_loading.gif" hash="c6f1ad4957e50b83bb27691df8bc3f41"/><file name="fancybox_overlay.png" hash="77aeaa52715b898b73c74d68c630330e"/><file name="fancybox_sprite.png" hash="783d4031fe50c3d83c960911e1fbc705"/></dir></dir><dir name="js"><dir name="lr_callprice"><file name="callprice.js" hash="dea088181b7273eb376f4e6a39324bb1"/></dir></dir></dir></dir></dir></target></contents>
95
+ <compatible/>
96
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
97
+ </package>
skin/frontend/base/default/css/lr_callprice/callprice.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ .callprice_request_form .fieldset{padding: 22px 25px 12px 33px;background:none;border: none;margin:0;}
2
+ .callprice_request_form .form-list .input-box{width:145px !important;}
3
+ .request_details_message{font-size: 12px;font-weight: bold;text-align: left;width: 535px;}
skin/frontend/base/default/css/lr_callprice/jquery.fancybox-buttons.css ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #fancybox-buttons {
2
+ position: fixed;
3
+ left: 0;
4
+ width: 100%;
5
+ z-index: 8050;
6
+ }
7
+
8
+ #fancybox-buttons.top {
9
+ top: 10px;
10
+ }
11
+
12
+ #fancybox-buttons.bottom {
13
+ bottom: 10px;
14
+ }
15
+
16
+ #fancybox-buttons ul {
17
+ display: block;
18
+ width: 166px;
19
+ height: 30px;
20
+ margin: 0 auto;
21
+ padding: 0;
22
+ list-style: none;
23
+ border: 1px solid #111;
24
+ border-radius: 3px;
25
+ -webkit-box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
26
+ -moz-box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
27
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
28
+ background: rgb(50,50,50);
29
+ background: -moz-linear-gradient(top, rgb(68,68,68) 0%, rgb(52,52,52) 50%, rgb(41,41,41) 50%, rgb(51,51,51) 100%);
30
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgb(68,68,68)), color-stop(50%,rgb(52,52,52)), color-stop(50%,rgb(41,41,41)), color-stop(100%,rgb(51,51,51)));
31
+ background: -webkit-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%);
32
+ background: -o-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%);
33
+ background: -ms-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%);
34
+ background: linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%);
35
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#444444', endColorstr='#222222',GradientType=0 );
36
+ }
37
+
38
+ #fancybox-buttons ul li {
39
+ float: left;
40
+ margin: 0;
41
+ padding: 0;
42
+ }
43
+
44
+ #fancybox-buttons a {
45
+ display: block;
46
+ width: 30px;
47
+ height: 30px;
48
+ text-indent: -9999px;
49
+ background-image: url('fancybox_buttons.png');
50
+ background-repeat: no-repeat;
51
+ outline: none;
52
+ opacity: 0.8;
53
+ }
54
+
55
+ #fancybox-buttons a:hover {
56
+ opacity: 1;
57
+ }
58
+
59
+ #fancybox-buttons a.btnPrev {
60
+ background-position: 5px 0;
61
+ }
62
+
63
+ #fancybox-buttons a.btnNext {
64
+ background-position: -33px 0;
65
+ border-right: 1px solid #3e3e3e;
66
+ }
67
+
68
+ #fancybox-buttons a.btnPlay {
69
+ background-position: 0 -30px;
70
+ }
71
+
72
+ #fancybox-buttons a.btnPlayOn {
73
+ background-position: -30px -30px;
74
+ }
75
+
76
+ #fancybox-buttons a.btnToggle {
77
+ background-position: 3px -60px;
78
+ border-left: 1px solid #111;
79
+ border-right: 1px solid #3e3e3e;
80
+ width: 35px
81
+ }
82
+
83
+ #fancybox-buttons a.btnToggleOn {
84
+ background-position: -27px -60px;
85
+ }
86
+
87
+ #fancybox-buttons a.btnClose {
88
+ border-left: 1px solid #111;
89
+ width: 35px;
90
+ background-position: -56px 0px;
91
+ }
92
+
93
+ #fancybox-buttons a.btnDisabled {
94
+ opacity : 0.4;
95
+ cursor: default;
96
+ }
skin/frontend/base/default/css/lr_callprice/jquery.fancybox-thumbs.css ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #fancybox-thumbs {
2
+ position: fixed;
3
+ left: 0;
4
+ width: 100%;
5
+ overflow: hidden;
6
+ z-index: 8050;
7
+ }
8
+
9
+ #fancybox-thumbs.bottom {
10
+ bottom: 2px;
11
+ }
12
+
13
+ #fancybox-thumbs.top {
14
+ top: 2px;
15
+ }
16
+
17
+ #fancybox-thumbs ul {
18
+ position: relative;
19
+ list-style: none;
20
+ margin: 0;
21
+ padding: 0;
22
+ }
23
+
24
+ #fancybox-thumbs ul li {
25
+ float: left;
26
+ padding: 1px;
27
+ opacity: 0.5;
28
+ }
29
+
30
+ #fancybox-thumbs ul li.active {
31
+ opacity: 0.75;
32
+ padding: 0;
33
+ border: 1px solid #fff;
34
+ }
35
+
36
+ #fancybox-thumbs ul li:hover {
37
+ opacity: 1;
38
+ }
39
+
40
+ #fancybox-thumbs ul li a {
41
+ display: block;
42
+ position: relative;
43
+ overflow: hidden;
44
+ border: 1px solid #222;
45
+ background: #111;
46
+ outline: none;
47
+ }
48
+
49
+ #fancybox-thumbs ul li img {
50
+ display: block;
51
+ position: relative;
52
+ border: 0;
53
+ padding: 0;
54
+ }
skin/frontend/base/default/css/lr_callprice/jquery.fancybox.css ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! fancyBox v2.1.4 fancyapps.com | fancyapps.com/fancybox/#license */
2
+ .fancybox-wrap,
3
+ .fancybox-skin,
4
+ .fancybox-outer,
5
+ .fancybox-inner,
6
+ .fancybox-image,
7
+ .fancybox-wrap iframe,
8
+ .fancybox-wrap object,
9
+ .fancybox-nav,
10
+ .fancybox-nav span,
11
+ .fancybox-tmp
12
+ {
13
+ padding: 0;
14
+ margin: 0;
15
+ border: 0;
16
+ outline: none;
17
+ vertical-align: top;
18
+ }
19
+
20
+ .fancybox-wrap {
21
+ position: absolute;
22
+ top: 0;
23
+ left: 0;
24
+ z-index: 8020;
25
+ }
26
+
27
+ .fancybox-skin {
28
+ position: relative;
29
+ background: #f9f9f9;
30
+ color: #444;
31
+ text-shadow: none;
32
+ -webkit-border-radius: 4px;
33
+ -moz-border-radius: 4px;
34
+ border-radius: 4px;
35
+ }
36
+
37
+ .fancybox-opened {
38
+ z-index: 8030;
39
+ }
40
+
41
+ .fancybox-opened .fancybox-skin {
42
+ -webkit-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
43
+ -moz-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
44
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
45
+ }
46
+
47
+ .fancybox-outer, .fancybox-inner {
48
+ position: relative;
49
+ }
50
+
51
+ .fancybox-inner {
52
+ overflow: hidden;
53
+ }
54
+
55
+ .fancybox-type-iframe .fancybox-inner {
56
+ -webkit-overflow-scrolling: touch;
57
+ }
58
+
59
+ .fancybox-error {
60
+ color: #444;
61
+ font: 14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif;
62
+ margin: 0;
63
+ padding: 15px;
64
+ white-space: nowrap;
65
+ }
66
+
67
+ .fancybox-image, .fancybox-iframe {
68
+ display: block;
69
+ width: 100%;
70
+ height: 100%;
71
+ }
72
+
73
+ .fancybox-image {
74
+ max-width: 100%;
75
+ max-height: 100%;
76
+ }
77
+
78
+ #fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span {
79
+ background-image: url('../../images/lr_callprice/fancybox_sprite.png');
80
+ }
81
+
82
+ #fancybox-loading {
83
+ position: fixed;
84
+ top: 50%;
85
+ left: 50%;
86
+ margin-top: -22px;
87
+ margin-left: -22px;
88
+ background-position: 0 -108px;
89
+ opacity: 0.8;
90
+ cursor: pointer;
91
+ z-index: 8060;
92
+ }
93
+
94
+ #fancybox-loading div {
95
+ width: 44px;
96
+ height: 44px;
97
+ background: url('../../images/lr_callprice/fancybox_loading.gif') center center no-repeat;
98
+ }
99
+
100
+ .fancybox-close {
101
+ position: absolute;
102
+ top: -18px;
103
+ right: -18px;
104
+ width: 36px;
105
+ height: 36px;
106
+ cursor: pointer;
107
+ z-index: 8040;
108
+ }
109
+
110
+ .fancybox-nav {
111
+ position: absolute;
112
+ top: 0;
113
+ width: 40%;
114
+ height: 100%;
115
+ cursor: pointer;
116
+ text-decoration: none;
117
+ background: transparent url('../../images/lr_callprice/blank.gif'); /* helps IE */
118
+ -webkit-tap-highlight-color: rgba(0,0,0,0);
119
+ z-index: 8040;
120
+ }
121
+
122
+ .fancybox-prev {
123
+ left: 0;
124
+ }
125
+
126
+ .fancybox-next {
127
+ right: 0;
128
+ }
129
+
130
+ .fancybox-nav span {
131
+ position: absolute;
132
+ top: 50%;
133
+ width: 36px;
134
+ height: 34px;
135
+ margin-top: -18px;
136
+ cursor: pointer;
137
+ z-index: 8040;
138
+ visibility: hidden;
139
+ }
140
+
141
+ .fancybox-prev span {
142
+ left: 10px;
143
+ background-position: 0 -36px;
144
+ }
145
+
146
+ .fancybox-next span {
147
+ right: 10px;
148
+ background-position: 0 -72px;
149
+ }
150
+
151
+ .fancybox-nav:hover span {
152
+ visibility: visible;
153
+ }
154
+
155
+ .fancybox-tmp {
156
+ position: absolute;
157
+ top: -99999px;
158
+ left: -99999px;
159
+ visibility: hidden;
160
+ max-width: 99999px;
161
+ max-height: 99999px;
162
+ overflow: visible !important;
163
+ }
164
+
165
+ /* Overlay helper */
166
+
167
+ .fancybox-lock {
168
+ overflow: hidden;
169
+ }
170
+
171
+ .fancybox-overlay {
172
+ position: absolute;
173
+ top: 0;
174
+ left: 0;
175
+ overflow: hidden;
176
+ display: none;
177
+ z-index: 8010;
178
+ background: url('../../images/lr_callprice/fancybox_overlay.png');
179
+ }
180
+
181
+ .fancybox-overlay-fixed {
182
+ position: fixed;
183
+ bottom: 0;
184
+ right: 0;
185
+ }
186
+
187
+ .fancybox-lock .fancybox-overlay {
188
+ overflow: auto;
189
+ overflow-y: scroll;
190
+ }
191
+
192
+ /* Title helper */
193
+
194
+ .fancybox-title {
195
+ visibility: hidden;
196
+ font: normal 13px/20px "Helvetica Neue",Helvetica,Arial,sans-serif;
197
+ position: relative;
198
+ text-shadow: none;
199
+ z-index: 8050;
200
+ }
201
+
202
+ .fancybox-opened .fancybox-title {
203
+ visibility: visible;
204
+ }
205
+
206
+ .fancybox-title-float-wrap {
207
+ position: absolute;
208
+ bottom: 0;
209
+ right: 50%;
210
+ margin-bottom: -35px;
211
+ z-index: 8050;
212
+ text-align: center;
213
+ }
214
+
215
+ .fancybox-title-float-wrap .child {
216
+ display: inline-block;
217
+ margin-right: -100%;
218
+ padding: 2px 20px;
219
+ background: transparent; /* Fallback for web browsers that doesn't support RGBa */
220
+ background: rgba(0, 0, 0, 0.8);
221
+ -webkit-border-radius: 15px;
222
+ -moz-border-radius: 15px;
223
+ border-radius: 15px;
224
+ text-shadow: 0 1px 2px #222;
225
+ color: #FFF;
226
+ font-weight: bold;
227
+ line-height: 24px;
228
+ white-space: nowrap;
229
+ }
230
+
231
+ .fancybox-title-outside-wrap {
232
+ position: relative;
233
+ margin-top: 10px;
234
+ color: #fff;
235
+ }
236
+
237
+ .fancybox-title-inside-wrap {
238
+ padding-top: 10px;
239
+ }
240
+
241
+ .fancybox-title-over-wrap {
242
+ position: absolute;
243
+ bottom: 0;
244
+ left: 0;
245
+ color: #fff;
246
+ padding: 10px;
247
+ background: #000;
248
+ background: rgba(0, 0, 0, .8);
249
+ }
skin/frontend/base/default/images/lr_callprice/blank.gif ADDED
Binary file
skin/frontend/base/default/images/lr_callprice/fancybox_buttons.png ADDED
Binary file
skin/frontend/base/default/images/lr_callprice/fancybox_loading.gif ADDED
Binary file
skin/frontend/base/default/images/lr_callprice/fancybox_overlay.png ADDED
Binary file
skin/frontend/base/default/images/lr_callprice/fancybox_sprite.png ADDED
Binary file
skin/frontend/base/default/js/lr_callprice/callprice.js ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Event.observe(window, 'load', function() {
2
+ var iDiv = document.createElement('div');
3
+ iDiv.id = 'output-div';
4
+ iDiv.className = 'output-div';
5
+ document.getElementsByClassName('footer-container')[0].appendChild(iDiv);
6
+
7
+ });
8
+ function loadCallForPriceForm(reloadurl)
9
+ {
10
+
11
+ new Ajax.Request(reloadurl, {
12
+ method: 'post',
13
+ parameters: Form.serialize($('product_addtocart_form')),
14
+ onSuccess: function(transport) {
15
+ /*$('output-div').innerHTML = "";
16
+ $('output-div').innerHTML = transport.responseText;
17
+ $('output-div').addClassName('output-div');*/
18
+ var json = transport.responseText.evalJSON();
19
+ var displayString = json.message;
20
+ if(json.success) {
21
+ jQuery('body').append('<div id="output-div"></div>');
22
+ jQuery('#output-div').html('');
23
+ jQuery('#output-div').html(json.request_form);
24
+ jQuery.fancybox({
25
+ type: 'ajax',
26
+ width:400,
27
+ height:300,
28
+ fitToView: false,
29
+ content: jQuery('#output-div'),
30
+ modal: false
31
+ });
32
+ }
33
+ }
34
+ });
35
+ }
36
+
37
+ function submitcallforpriceform(f,submiturl){
38
+ new Ajax.Request(submiturl, {
39
+ method: 'post',
40
+ parameters:Form.serialize($('cp_form')),
41
+ onSuccess: function(transport) {
42
+ var json = transport.responseText.evalJSON();
43
+ var displayString = json.message;
44
+ if(json.success) {
45
+ jQuery('#messages_product_view').html('<ul class="messages"><li class="success-msg"><ul><li><span>'+displayString+'</span></li></ul></li></ul>');
46
+ jQuery.fancybox.close();
47
+ }
48
+ else
49
+ {
50
+ jQuery('#messages_product_view').html('<ul class="messages"><li class="error-msg"><ul><li><span>'+displayString+'</span></li></ul></li></ul>');
51
+ }
52
+ }
53
+ });
54
+ }