Version Notes
Flat rate shipping per product
Download this release
Release Info
Developer | Magebuzz |
Extension | Flat_Rate_ShippingPerProduct |
Version | 0.1.1 |
Comparing to | |
See all releases |
Version 0.1.1
- app/code/community/Magebuzz/Flatrateperproduct/Helper/Data.php +8 -0
- app/code/community/Magebuzz/Flatrateperproduct/Model/Carrier/Flatrateperproduct.php +57 -0
- app/code/community/Magebuzz/Flatrateperproduct/etc/config.xml +73 -0
- app/code/community/Magebuzz/Flatrateperproduct/etc/system.xml +88 -0
- app/code/community/Magebuzz/Flatrateperproduct/sql/flatrateperproduct_setup/mysql4-install-0.1.0.php +32 -0
- app/code/community/Magebuzz/Info/Block/System/Config/Extensions (2).php +75 -0
- app/code/community/Magebuzz/Info/Block/System/Config/Extensions.php +75 -0
- app/code/community/Magebuzz/Info/Block/System/Config/General.php +21 -0
- app/code/community/Magebuzz/Info/Helper/Data.php +4 -0
- app/code/community/Magebuzz/Info/Model/Feed.php +45 -0
- app/code/community/Magebuzz/Info/etc/adminhtml.xml +25 -0
- app/code/community/Magebuzz/Info/etc/config.xml +85 -0
- app/code/community/Magebuzz/Info/etc/system.xml +61 -0
- app/etc/modules/Magebuzz_Flatrateperproduct.xml +9 -0
- app/etc/modules/Magebuzz_Info.xml +9 -0
- app/locale/en_US/Magebuzz_Flatrateperproduct.csv +10 -0
- package.xml +18 -0
- skin/adminhtml/default/default/images/magebuzz/facebook.png +0 -0
- skin/adminhtml/default/default/images/magebuzz/ok.gif +0 -0
- skin/adminhtml/default/default/images/magebuzz/twitter.png +0 -0
- skin/adminhtml/default/default/images/magebuzz/update.gif +0 -0
app/code/community/Magebuzz/Flatrateperproduct/Helper/Data.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (c) 2013 www.magebuzz.com
|
4 |
+
*/
|
5 |
+
class Magebuzz_Flatrateperproduct_Helper_Data extends Mage_Core_Helper_Abstract
|
6 |
+
{
|
7 |
+
|
8 |
+
}
|
app/code/community/Magebuzz/Flatrateperproduct/Model/Carrier/Flatrateperproduct.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (c) 2013 www.magebuzz.com
|
4 |
+
*/
|
5 |
+
class Magebuzz_Flatrateperproduct_Model_Carrier_Flatrateperproduct
|
6 |
+
extends Mage_Shipping_Model_Carrier_Abstract
|
7 |
+
implements Mage_Shipping_Model_Carrier_Interface {
|
8 |
+
protected $_code = 'flatrateperproduct';
|
9 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
10 |
+
{
|
11 |
+
if (!$this->getConfigFlag('active')) {
|
12 |
+
return false;
|
13 |
+
}
|
14 |
+
$shippingPrice =0;
|
15 |
+
if ($request->getAllItems()) {
|
16 |
+
foreach ($request->getAllItems() as $item) {
|
17 |
+
$product = Mage::getModel('catalog/product')->load($item->getProductId());
|
18 |
+
if($product->getTypeId()=='configurable' || $product->getTypeId()=='bundle') {
|
19 |
+
continue;
|
20 |
+
}
|
21 |
+
$shipCost= $product->getShipCost();
|
22 |
+
if($shipCost==null || $shipCost==0){
|
23 |
+
$shippingPrice += $item->getQty() * $this->getConfigData('price');
|
24 |
+
}
|
25 |
+
else{
|
26 |
+
$shippingPrice += $item->getQty() * $shipCost;
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
30 |
+
$result = Mage::getModel('shipping/rate_result');
|
31 |
+
if ($shippingPrice !== false) {
|
32 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
33 |
+
$method->setCarrier('flatrateperproduct');
|
34 |
+
$method->setCarrierTitle($this->getConfigData('title'));
|
35 |
+
$method->setMethod('flatrateperproduct');
|
36 |
+
$method->setMethodTitle($this->getConfigData('name'));
|
37 |
+
$method->setPrice($shippingPrice);
|
38 |
+
$method->setCost($shippingPrice);
|
39 |
+
$result->append($method);
|
40 |
+
}
|
41 |
+
return $result;
|
42 |
+
}
|
43 |
+
public function getAllowedMethods()
|
44 |
+
{
|
45 |
+
return array('flatrateperproduct'=>$this->getConfigData('name'));
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
|
50 |
+
|
51 |
+
|
52 |
+
|
53 |
+
|
54 |
+
|
55 |
+
|
56 |
+
|
57 |
+
|
app/code/community/Magebuzz/Flatrateperproduct/etc/config.xml
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Magebuzz_Flatrateperproduct>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Magebuzz_Flatrateperproduct>
|
7 |
+
</modules>
|
8 |
+
<admin>
|
9 |
+
<translate>
|
10 |
+
<modules>
|
11 |
+
<Magebuzz_Flatrateperproduct>
|
12 |
+
<files>
|
13 |
+
<default>Magebuzz_Flatrateperproduct.csv</default>
|
14 |
+
</files>
|
15 |
+
</Magebuzz_Flatrateperproduct>
|
16 |
+
</modules>
|
17 |
+
</translate>
|
18 |
+
</admin>
|
19 |
+
<global>
|
20 |
+
<models>
|
21 |
+
<flatrateperproduct>
|
22 |
+
<class>Magebuzz_Flatrateperproduct_Model</class>
|
23 |
+
<resourceModel>flatrateperproduct_mysql4</resourceModel>
|
24 |
+
</flatrateperproduct>
|
25 |
+
<flatrateperproduct_mysql4>
|
26 |
+
<class>Magebuzz_Flatrateperproduct_Model_Mysql4</class>
|
27 |
+
<entities>
|
28 |
+
<flatrateperproduct>
|
29 |
+
<table>flatrateperproduct</table>
|
30 |
+
</flatrateperproduct>
|
31 |
+
</entities>
|
32 |
+
</flatrateperproduct_mysql4>
|
33 |
+
</models>
|
34 |
+
<resources>
|
35 |
+
<flatrateperproduct_setup>
|
36 |
+
<setup>
|
37 |
+
<module>Magebuzz_Flatrateperproduct</module>
|
38 |
+
<class>Mage_Eav_Model_Entity_Setup</class>
|
39 |
+
</setup>
|
40 |
+
<connection>
|
41 |
+
<use>core_setup</use>
|
42 |
+
</connection>
|
43 |
+
</flatrateperproduct_setup>
|
44 |
+
<flatrateperproduct_write>
|
45 |
+
<connection>
|
46 |
+
<use>core_write</use>
|
47 |
+
</connection>
|
48 |
+
</flatrateperproduct_write>
|
49 |
+
<flatrateperproduct_read>
|
50 |
+
<connection>
|
51 |
+
<use>core_read</use>
|
52 |
+
</connection>
|
53 |
+
</flatrateperproduct_read>
|
54 |
+
</resources>
|
55 |
+
<helpers>
|
56 |
+
<flatrateperproduct>
|
57 |
+
<class>Magebuzz_Flatrateperproduct_Helper</class>
|
58 |
+
</flatrateperproduct>
|
59 |
+
</helpers>
|
60 |
+
</global>
|
61 |
+
<default>
|
62 |
+
<carriers>
|
63 |
+
<flatrateperproduct>
|
64 |
+
<active>1</active>
|
65 |
+
<model>flatrateperproduct/carrier_flatrateperproduct</model>
|
66 |
+
<title>Carrier Title</title>
|
67 |
+
<name>Method Name</name>
|
68 |
+
<price>5.00</price>
|
69 |
+
<specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
|
70 |
+
</flatrateperproduct>
|
71 |
+
</carriers>
|
72 |
+
</default>
|
73 |
+
</config>
|
app/code/community/Magebuzz/Flatrateperproduct/etc/system.xml
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<carriers>
|
5 |
+
<groups>
|
6 |
+
<flatrateperproduct translate="label" module="flatrateperproduct">
|
7 |
+
<label>Flat rate per product</label>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>99</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 |
+
<active translate="label">
|
15 |
+
<label>Enabled</label>
|
16 |
+
<frontend_type>select</frontend_type>
|
17 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
18 |
+
<sort_order>1</sort_order>
|
19 |
+
<show_in_default>1</show_in_default>
|
20 |
+
<show_in_website>1</show_in_website>
|
21 |
+
<show_in_store>1</show_in_store>
|
22 |
+
</active>
|
23 |
+
<title translate="label">
|
24 |
+
<label>Title</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 |
+
</title>
|
31 |
+
<name translate="label">
|
32 |
+
<label>Method Name</label>
|
33 |
+
<frontend_type>text</frontend_type>
|
34 |
+
<sort_order>2</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
</name>
|
39 |
+
<price translate="label">
|
40 |
+
<label>Price</label>
|
41 |
+
<frontend_type>text</frontend_type>
|
42 |
+
<sort_order>3</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>0</show_in_store>
|
46 |
+
</price>
|
47 |
+
<specificerrmsg translate="label">
|
48 |
+
<label>Displayed Error Message</label>
|
49 |
+
<frontend_type>textarea</frontend_type>
|
50 |
+
<sort_order>4</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>1</show_in_store>
|
54 |
+
</specificerrmsg>
|
55 |
+
<sallowspecific translate="label">
|
56 |
+
<label>Ship to Applicable Countries</label>
|
57 |
+
<frontend_type>select</frontend_type>
|
58 |
+
<sort_order>90</sort_order>
|
59 |
+
<frontend_class>shipping-applicable-country</frontend_class>
|
60 |
+
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>1</show_in_website>
|
63 |
+
<show_in_store>0</show_in_store>
|
64 |
+
</sallowspecific>
|
65 |
+
<specificcountry translate="label">
|
66 |
+
<label>Ship to Specific Countries</label>
|
67 |
+
<frontend_type>multiselect</frontend_type>
|
68 |
+
<sort_order>91</sort_order>
|
69 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
70 |
+
<show_in_default>1</show_in_default>
|
71 |
+
<show_in_website>1</show_in_website>
|
72 |
+
<show_in_store>0</show_in_store>
|
73 |
+
<can_be_empty>1</can_be_empty>
|
74 |
+
</specificcountry>
|
75 |
+
<sort_order translate="label">
|
76 |
+
<label>Sort Order</label>
|
77 |
+
<frontend_type>text</frontend_type>
|
78 |
+
<sort_order>100</sort_order>
|
79 |
+
<show_in_default>1</show_in_default>
|
80 |
+
<show_in_website>1</show_in_website>
|
81 |
+
<show_in_store>0</show_in_store>
|
82 |
+
</sort_order>
|
83 |
+
</fields>
|
84 |
+
</flatrateperproduct>
|
85 |
+
</groups>
|
86 |
+
</carriers>
|
87 |
+
</sections>
|
88 |
+
</config>
|
app/code/community/Magebuzz/Flatrateperproduct/sql/flatrateperproduct_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->addAttribute('catalog_product', 'ship_cost', array(
|
8 |
+
'group' => 'General',
|
9 |
+
'type' => 'decimal',
|
10 |
+
'backend' => '',
|
11 |
+
'frontend' => '',
|
12 |
+
'label' => 'Ship cost',
|
13 |
+
'input' => 'text',
|
14 |
+
'class' => '',
|
15 |
+
'source' => '',
|
16 |
+
'is_global', Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
17 |
+
'visible' => true,
|
18 |
+
'required' => false,
|
19 |
+
'user_defined' => false,
|
20 |
+
'default' => '0',
|
21 |
+
'searchable' => false,
|
22 |
+
'filterable' => false,
|
23 |
+
'comparable' => false,
|
24 |
+
'visible_on_front' => false,
|
25 |
+
'unique' => false,
|
26 |
+
'apply_to' => 'simple,configurable,virtual,bundle,downloadable',
|
27 |
+
'is_configurable' => false,
|
28 |
+
'used_in_product_listing', '1'
|
29 |
+
));
|
30 |
+
$installer->updateAttribute('catalog_product', 'ship_cost', 'used_in_product_listing', '1');
|
31 |
+
|
32 |
+
$installer->endSetup();
|
app/code/community/Magebuzz/Info/Block/System/Config/Extensions (2).php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Magebuzz_Info_Block_System_Config_Extensions extends Mage_Adminhtml_Block_System_Config_Form_Fieldset {
|
3 |
+
public function render(Varien_Data_Form_Element_Abstract $element) {
|
4 |
+
$html = $this->_getHeaderHtml($element);
|
5 |
+
|
6 |
+
$modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
|
7 |
+
sort($modules);
|
8 |
+
|
9 |
+
foreach ($modules as $moduleName) {
|
10 |
+
if (strstr($moduleName, 'Magebuzz_') === false) {
|
11 |
+
continue;
|
12 |
+
}
|
13 |
+
if ($moduleName == 'Magebuzz_Info') {
|
14 |
+
continue;
|
15 |
+
}
|
16 |
+
$html.= $this->_getFieldHtml($element, $moduleName);
|
17 |
+
}
|
18 |
+
|
19 |
+
$html .= $this->_getFooterHtml($element);
|
20 |
+
return $html;
|
21 |
+
}
|
22 |
+
|
23 |
+
protected function _getFieldHtml($fieldset, $moduleCode) {
|
24 |
+
$currentVer = Mage::getConfig()->getModuleConfig($moduleCode)->version;
|
25 |
+
|
26 |
+
if (!$currentVer) {
|
27 |
+
return '';
|
28 |
+
}
|
29 |
+
$moduleName = substr($moduleCode, strpos($moduleCode, '_') + 1);
|
30 |
+
$allExtensions = unserialize(Mage::app()->loadCache('mb_extensions'));
|
31 |
+
$status = '<a target="_blank"><img src="'.$this->getSkinUrl('images/magebuzz/ok.gif').'" title="'.$this->__("Installed").'"/></a>';
|
32 |
+
|
33 |
+
if ($allExtensions && isset($allExtensions[$moduleCode])){
|
34 |
+
$ext = $allExtensions[$moduleCode];
|
35 |
+
$url = $ext['url'];
|
36 |
+
$name = $ext['name'];
|
37 |
+
$lastVer = $ext['version'];
|
38 |
+
|
39 |
+
$moduleName = '<a href="'.$url.'" target="_blank" title="'.$name.'">'.$name."</a>";
|
40 |
+
if ($this->_convertVersion($currentVer) < $this->_convertVersion($lastVer)) {
|
41 |
+
$status = '<a href="'.$url.'" target="_blank"><img src="'.$this->getSkinUrl('images/magebuzz/update.gif').'" alt="'.$this->__("Update available").'" title="'.$this->__("Update available").'"/></a>';
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
$moduleName = $status . ' ' . $moduleName;
|
46 |
+
|
47 |
+
$field = $fieldset->addField($moduleCode, 'label', array(
|
48 |
+
'name' => 'dummy',
|
49 |
+
'label' => $moduleName,
|
50 |
+
'value' => $currentVer,
|
51 |
+
))->setRenderer($this->_getFieldRenderer());
|
52 |
+
|
53 |
+
return $field->toHtml();
|
54 |
+
}
|
55 |
+
|
56 |
+
protected function _getFieldRenderer() {
|
57 |
+
if (empty($this->_fieldRenderer)) {
|
58 |
+
$this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
|
59 |
+
}
|
60 |
+
return $this->_fieldRenderer;
|
61 |
+
}
|
62 |
+
|
63 |
+
protected function _convertVersion($v) {
|
64 |
+
$digits = @explode(".", $v);
|
65 |
+
$version = 0;
|
66 |
+
if (is_array($digits)){
|
67 |
+
foreach ($digits as $k=>$v){
|
68 |
+
$version += ($v * pow(10, max(0, (3-$k))));
|
69 |
+
}
|
70 |
+
|
71 |
+
}
|
72 |
+
return $version;
|
73 |
+
}
|
74 |
+
|
75 |
+
}
|
app/code/community/Magebuzz/Info/Block/System/Config/Extensions.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Magebuzz_Info_Block_System_Config_Extensions extends Mage_Adminhtml_Block_System_Config_Form_Fieldset {
|
3 |
+
public function render(Varien_Data_Form_Element_Abstract $element) {
|
4 |
+
$html = $this->_getHeaderHtml($element);
|
5 |
+
|
6 |
+
$modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
|
7 |
+
sort($modules);
|
8 |
+
|
9 |
+
foreach ($modules as $moduleName) {
|
10 |
+
if (strstr($moduleName, 'Magebuzz_') === false) {
|
11 |
+
continue;
|
12 |
+
}
|
13 |
+
if ($moduleName == 'Magebuzz_Info') {
|
14 |
+
continue;
|
15 |
+
}
|
16 |
+
$html.= $this->_getFieldHtml($element, $moduleName);
|
17 |
+
}
|
18 |
+
|
19 |
+
$html .= $this->_getFooterHtml($element);
|
20 |
+
return $html;
|
21 |
+
}
|
22 |
+
|
23 |
+
protected function _getFieldHtml($fieldset, $moduleCode) {
|
24 |
+
$currentVer = Mage::getConfig()->getModuleConfig($moduleCode)->version;
|
25 |
+
|
26 |
+
if (!$currentVer) {
|
27 |
+
return '';
|
28 |
+
}
|
29 |
+
$moduleName = substr($moduleCode, strpos($moduleCode, '_') + 1);
|
30 |
+
$allExtensions = unserialize(Mage::app()->loadCache('mb_extensions'));
|
31 |
+
$status = '<a target="_blank"><img src="'.$this->getSkinUrl('images/magebuzz/ok.gif').'" title="'.$this->__("Installed").'"/></a>';
|
32 |
+
|
33 |
+
if ($allExtensions && isset($allExtensions[$moduleCode])){
|
34 |
+
$ext = $allExtensions[$moduleCode];
|
35 |
+
$url = $ext['url'];
|
36 |
+
$name = $ext['name'];
|
37 |
+
$lastVer = $ext['version'];
|
38 |
+
|
39 |
+
$moduleName = '<a href="'.$url.'" target="_blank" title="'.$name.'">'.$name."</a>";
|
40 |
+
if ($this->_convertVersion($currentVer) < $this->_convertVersion($lastVer)) {
|
41 |
+
$status = '<a href="'.$url.'" target="_blank"><img src="'.$this->getSkinUrl('images/magebuzz/update.gif').'" alt="'.$this->__("Update available").'" title="'.$this->__("Update available").'"/></a>';
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
$moduleName = $status . ' ' . $moduleName;
|
46 |
+
|
47 |
+
$field = $fieldset->addField($moduleCode, 'label', array(
|
48 |
+
'name' => 'dummy',
|
49 |
+
'label' => $moduleName,
|
50 |
+
'value' => $currentVer,
|
51 |
+
))->setRenderer($this->_getFieldRenderer());
|
52 |
+
|
53 |
+
return $field->toHtml();
|
54 |
+
}
|
55 |
+
|
56 |
+
protected function _getFieldRenderer() {
|
57 |
+
if (empty($this->_fieldRenderer)) {
|
58 |
+
$this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
|
59 |
+
}
|
60 |
+
return $this->_fieldRenderer;
|
61 |
+
}
|
62 |
+
|
63 |
+
protected function _convertVersion($v) {
|
64 |
+
$digits = @explode(".", $v);
|
65 |
+
$version = 0;
|
66 |
+
if (is_array($digits)){
|
67 |
+
foreach ($digits as $k=>$v){
|
68 |
+
$version += ($v * pow(10, max(0, (3-$k))));
|
69 |
+
}
|
70 |
+
|
71 |
+
}
|
72 |
+
return $version;
|
73 |
+
}
|
74 |
+
|
75 |
+
}
|
app/code/community/Magebuzz/Info/Block/System/Config/General.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Magebuzz_Info_Block_System_Config_General extends Mage_Adminhtml_Block_System_Config_Form_Fieldset {
|
3 |
+
public function render(Varien_Data_Form_Element_Abstract $element) {
|
4 |
+
$html = $this->_getHeaderHtml($element);
|
5 |
+
|
6 |
+
$html .= $this->_getInfo();
|
7 |
+
|
8 |
+
$html .= $this->_getFooterHtml($element);
|
9 |
+
return $html;
|
10 |
+
}
|
11 |
+
|
12 |
+
protected function _getInfo() {
|
13 |
+
$html = '<div class="support-info">';
|
14 |
+
$html .= '<h3>Support Policy</h3>';
|
15 |
+
$html .= '<p>We provide 6 months free support for all of our extensions and templates. We are not responsible for any bug or issue caused of your changes to our products. To report a bug, you can easily go to <a href="http://www.magebuzz.com/support/" title="Magebuzz Support" target="_blank">our Support Page</a>, email, call or submit a ticket.</p>';
|
16 |
+
$html .= '<h3>Read the blog</h3><p>The <a href="http://www.magebuzz.com/blog/" target="_blank">Magebuzz Blog</a> is updated regularly with Magento tutorials, Magebuzz new products, updates, promotions... Visit <a href="http://www.magebuzz.com/blog/" target="_blank">Magebuzz Blog</a> recently to be kept updated.</p>';
|
17 |
+
$html .= '<h3>Follow Us</h3><div class="magebuzz-follow"><ul><li style="float:left" class="facebook"><a href="http://www.facebook.com/MageBuzz" title="Facebook" target="_blank"><img src="' . $this->getSkinUrl('images/magebuzz/facebook.png') . '" alt="Facebook"/></a></li><li style="float:left" class="twitter"><a href="https://twitter.com/MageBuzz" title="Twitter" target="_blank"><img src="' . $this->getSkinUrl('images/magebuzz/twitter.png') . '" alt="Twitter"/></a></li></ul></div>';
|
18 |
+
$html .= '</div>';
|
19 |
+
return $html;
|
20 |
+
}
|
21 |
+
}
|
app/code/community/Magebuzz/Info/Helper/Data.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Magebuzz_Info_Helper_Data extends Mage_Core_Helper_Abstract {
|
3 |
+
|
4 |
+
}
|
app/code/community/Magebuzz/Info/Model/Feed.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Magebuzz_Info_Model_Feed extends Mage_AdminNotification_Model_Feed {
|
3 |
+
const URL_NEWS = 'http://www.magebuzz.com/feed_news.xml';
|
4 |
+
|
5 |
+
public function _construct() {
|
6 |
+
parent::_construct();
|
7 |
+
$this->_init('info/feed');
|
8 |
+
}
|
9 |
+
|
10 |
+
public function checkUpdate() {
|
11 |
+
if (!extension_loaded('curl')) {
|
12 |
+
return $this;
|
13 |
+
}
|
14 |
+
if (!Mage::getStoreConfig('info/notification/enable')) {
|
15 |
+
return $this;
|
16 |
+
}
|
17 |
+
$feedData = array();
|
18 |
+
$feedXml = $this->getFeedData();
|
19 |
+
|
20 |
+
if ($feedXml && $feedXml->channel && $feedXml->channel->item) {
|
21 |
+
foreach ($feedXml->channel->item as $item) {
|
22 |
+
$date = $this->getDate((string)$item->pubDate);
|
23 |
+
$feedData[] = array(
|
24 |
+
'severity' => 3,
|
25 |
+
'date_added' => $this->getDate($date),
|
26 |
+
'title' => (string)$item->title,
|
27 |
+
'description' => (string)$item->description,
|
28 |
+
'url' => (string)$item->link,
|
29 |
+
);
|
30 |
+
}
|
31 |
+
if ($feedData) {
|
32 |
+
Mage::getModel('adminnotification/inbox')->parse(array_reverse($feedData));
|
33 |
+
}
|
34 |
+
}
|
35 |
+
$this->setLastUpdate();
|
36 |
+
}
|
37 |
+
|
38 |
+
public function getFeedUrl() {
|
39 |
+
if (is_null($this->_feedUrl)) {
|
40 |
+
$this->_feedUrl = self::URL_NEWS;
|
41 |
+
}
|
42 |
+
//$query = '?s=' . urlencode(Mage::getStoreConfig('web/unsecure/base_url'));
|
43 |
+
return $this->_feedUrl;
|
44 |
+
}
|
45 |
+
}
|
app/code/community/Magebuzz/Info/etc/adminhtml.xml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<all>
|
6 |
+
<title>Allow Everything</title>
|
7 |
+
</all>
|
8 |
+
<admin>
|
9 |
+
<children>
|
10 |
+
<system>
|
11 |
+
<children>
|
12 |
+
<config>
|
13 |
+
<children>
|
14 |
+
<info>
|
15 |
+
<title>Magebuzz Info</title>
|
16 |
+
</info>
|
17 |
+
</children>
|
18 |
+
</config>
|
19 |
+
</children>
|
20 |
+
</system>
|
21 |
+
</children>
|
22 |
+
</admin>
|
23 |
+
</resources>
|
24 |
+
</acl>
|
25 |
+
</config>
|
app/code/community/Magebuzz/Info/etc/config.xml
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Magebuzz_Info>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Magebuzz_Info>
|
7 |
+
</modules>
|
8 |
+
<admin>
|
9 |
+
<routers>
|
10 |
+
<info>
|
11 |
+
<use>admin</use>
|
12 |
+
<args>
|
13 |
+
<module>Magebuzz_Info</module>
|
14 |
+
<frontName>info</frontName>
|
15 |
+
</args>
|
16 |
+
</info>
|
17 |
+
</routers>
|
18 |
+
</admin>
|
19 |
+
<adminhtml>
|
20 |
+
<events>
|
21 |
+
<controller_action_predispatch>
|
22 |
+
<observers>
|
23 |
+
<magebuzz_info_feed>
|
24 |
+
<type>singleton</type>
|
25 |
+
<class>info/feed</class>
|
26 |
+
<method>checkUpdate</method>
|
27 |
+
</magebuzz_info_feed>
|
28 |
+
</observers>
|
29 |
+
</controller_action_predispatch>
|
30 |
+
</events>
|
31 |
+
</adminhtml>
|
32 |
+
<global>
|
33 |
+
<models>
|
34 |
+
<info>
|
35 |
+
<class>Magebuzz_Info_Model</class>
|
36 |
+
<resourceModel>info_mysql4</resourceModel>
|
37 |
+
</info>
|
38 |
+
<info_mysql4>
|
39 |
+
<class>Magebuzz_Info_Model_Mysql4</class>
|
40 |
+
<entities>
|
41 |
+
<info>
|
42 |
+
<table>info</table>
|
43 |
+
</info>
|
44 |
+
</entities>
|
45 |
+
</info_mysql4>
|
46 |
+
</models>
|
47 |
+
<resources>
|
48 |
+
<info_setup>
|
49 |
+
<setup>
|
50 |
+
<module>Magebuzz_Info</module>
|
51 |
+
</setup>
|
52 |
+
<connection>
|
53 |
+
<use>core_setup</use>
|
54 |
+
</connection>
|
55 |
+
</info_setup>
|
56 |
+
<info_write>
|
57 |
+
<connection>
|
58 |
+
<use>core_write</use>
|
59 |
+
</connection>
|
60 |
+
</info_write>
|
61 |
+
<info_read>
|
62 |
+
<connection>
|
63 |
+
<use>core_read</use>
|
64 |
+
</connection>
|
65 |
+
</info_read>
|
66 |
+
</resources>
|
67 |
+
<blocks>
|
68 |
+
<info>
|
69 |
+
<class>Magebuzz_Info_Block</class>
|
70 |
+
</info>
|
71 |
+
</blocks>
|
72 |
+
<helpers>
|
73 |
+
<info>
|
74 |
+
<class>Magebuzz_Info_Helper</class>
|
75 |
+
</info>
|
76 |
+
</helpers>
|
77 |
+
</global>
|
78 |
+
<default>
|
79 |
+
<info>
|
80 |
+
<notification>
|
81 |
+
<enable>1</enable>
|
82 |
+
</notification>
|
83 |
+
</info>
|
84 |
+
</default>
|
85 |
+
</config>
|
app/code/community/Magebuzz/Info/etc/system.xml
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<magebuzz translate="label">
|
5 |
+
<label>MageBuzz Add-ons</label>
|
6 |
+
<sort_order>400</sort_order>
|
7 |
+
</magebuzz>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<info translate="label" module="info">
|
11 |
+
<class>separator-top</class>
|
12 |
+
<label>Info</label>
|
13 |
+
<tab>magebuzz</tab>
|
14 |
+
<frontend_type>text</frontend_type>
|
15 |
+
<sort_order>999</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>0</show_in_store>
|
19 |
+
<groups>
|
20 |
+
<general translate="label">
|
21 |
+
<label>Info</label>
|
22 |
+
<frontend_type>text</frontend_type>
|
23 |
+
<frontend_model>info/system_config_general</frontend_model>
|
24 |
+
<sort_order>1</sort_order>
|
25 |
+
<show_in_default>1</show_in_default>
|
26 |
+
<show_in_website>1</show_in_website>
|
27 |
+
<show_in_store>0</show_in_store>
|
28 |
+
</general>
|
29 |
+
<installed_extensions translate="label">
|
30 |
+
<label>Installed Magebuzz Extensions</label>
|
31 |
+
<frontend_type>text</frontend_type>
|
32 |
+
<frontend_model>info/system_config_extensions</frontend_model>
|
33 |
+
<sort_order>2</sort_order>
|
34 |
+
<show_in_default>1</show_in_default>
|
35 |
+
<show_in_website>1</show_in_website>
|
36 |
+
<show_in_store>0</show_in_store>
|
37 |
+
</installed_extensions>
|
38 |
+
<notification translate="label">
|
39 |
+
<label>Notification</label>
|
40 |
+
<frontend_type>text</frontend_type>
|
41 |
+
<comment><![CDATA[<p style="color:#EA7601">Select Yes to receive notification about new extensions, templates, updates or promotions and discounts from Magebuzz Store.</p>]]></comment>
|
42 |
+
<sort_order>3</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>0</show_in_store>
|
46 |
+
<fields>
|
47 |
+
<enable>
|
48 |
+
<label>Receive Notification about new product, update and promotions</label>
|
49 |
+
<sort_order>1</sort_order>
|
50 |
+
<show_in_default>1</show_in_default>
|
51 |
+
<show_in_website>1</show_in_website>
|
52 |
+
<show_in_store>0</show_in_store>
|
53 |
+
<frontend_type>select</frontend_type>
|
54 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
55 |
+
</enable>
|
56 |
+
</fields>
|
57 |
+
</notification>
|
58 |
+
</groups>
|
59 |
+
</info>
|
60 |
+
</sections>
|
61 |
+
</config>
|
app/etc/modules/Magebuzz_Flatrateperproduct.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Magebuzz_Flatrateperproduct>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Magebuzz_Flatrateperproduct>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/etc/modules/Magebuzz_Info.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Magebuzz_Info>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Magebuzz_Info>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/locale/en_US/Magebuzz_Flatrateperproduct.csv
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"Flat rate per product","Flat rate per product"
|
2 |
+
"Ship to Specific Countries","Ship to Specific Countries"
|
3 |
+
"Enabled","Enabled"
|
4 |
+
"Title","Title"
|
5 |
+
"Method Name","Method Name"
|
6 |
+
"Price","Price"
|
7 |
+
"Displayed Error Message","Displayed Error Message"
|
8 |
+
"Ship to Applicable Countries","Ship to Applicable Countries"
|
9 |
+
"Ship to Specific Countries","Ship to Specific Countries"
|
10 |
+
"Sort Order","Sort Order"
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Flat_Rate_ShippingPerProduct</name>
|
4 |
+
<version>0.1.1</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>Flat rate shipping per product</summary>
|
10 |
+
<description>Flat rate shipping per product</description>
|
11 |
+
<notes>Flat rate shipping per product</notes>
|
12 |
+
<authors><author><name>Magebuzz</name><user>magebuzz</user><email>magebuzz@gmail.com</email></author></authors>
|
13 |
+
<date>2014-07-23</date>
|
14 |
+
<time>04:24:52</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Magebuzz"><dir name="Flatrateperproduct"><dir name="Helper"><file name="Data.php" hash="87b9589caad03158078b4a8d88dfcfa5"/></dir><dir name="Model"><dir name="Carrier"><file name="Flatrateperproduct.php" hash="5e022804bbdc67396caec0ba039c44ef"/></dir></dir><dir name="etc"><file name="config.xml" hash="7b8a8a9bcab49f59bf240586046c996e"/><file name="system.xml" hash="e18ea1bbff02ac9e8addeeea66b759e1"/></dir><dir name="sql"><dir name="flatrateperproduct_setup"><file name="mysql4-install-0.1.0.php" hash="8b73c78ac10e750dc5bdbb4f8908da00"/></dir></dir></dir><dir name="Info"><dir name="Block"><dir name="System"><dir name="Config"><file name="Extensions (2).php" hash="aa5773e8b5dc6a33b9d4cc1154fbb69d"/><file name="Extensions.php" hash="aa5773e8b5dc6a33b9d4cc1154fbb69d"/><file name="General.php" hash="2cbe45ec38e2fc090141d0df421bed6e"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="7582d16054340a767e7ed5190e71b0ad"/></dir><dir name="Model"><file name="Feed.php" hash="aa72a9d25541f123978c8598af191274"/></dir><dir name="etc"><file name="adminhtml.xml" hash="4f60efb5ce51a052113a0e895c925fbc"/><file name="config.xml" hash="bc04f45fa0580e0f26a611e14fc2ca74"/><file name="system.xml" hash="ea315b0f9ca775ce9d11e373ba50d6d2"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magebuzz_Flatrateperproduct.xml" hash="d69dc9403e6cabdec1396575b334d24e"/><file name="Magebuzz_Info.xml" hash="81abb2ad3ff3428ae5b3b7c5aa04b937"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Magebuzz_Flatrateperproduct.csv" hash="a1dc577fa53f95a1918abbd339a58260"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="magebuzz"><file name="facebook.png" hash="d6b1bea3a11c7cf5374e2937d731e315"/><file name="ok.gif" hash="a38bc2ee6e116e39c6e2e3013ee50f5e"/><file name="twitter.png" hash="9b6278124eaa0b2c19a2253bd844bbb4"/><file name="update.gif" hash="8342e11f7739fcfa25134707f0536ed6"/></dir></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|
skin/adminhtml/default/default/images/magebuzz/facebook.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/magebuzz/ok.gif
ADDED
Binary file
|
skin/adminhtml/default/default/images/magebuzz/twitter.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/magebuzz/update.gif
ADDED
Binary file
|