Version Notes
Fix a little bit for following Niland requirement.
Shop By Brand
I have missed adminhtml/ ... /brand.xml
Extend brand's image functionality
Download this release
Release Info
Developer | Magento Core Team |
Extension | Shop_By_Brand_Vilpjsc |
Version | 2.0.4 |
Comparing to | |
See all releases |
Code changes from version 2.0.3 to 2.0.4
- app/code/local/Vilpjsc/Brand/.DS_Store +0 -0
- app/code/local/Vilpjsc/Brand/Helper/Data.php +39 -37
- app/code/local/Vilpjsc/Brand/controllers/.DS_Store +0 -0
- app/code/local/Vilpjsc/Brand/etc/config.xml +1 -1
- app/code/local/Vilpjsc/Brand/sql/.DS_Store +0 -0
- app/code/local/Vilpjsc/Brand/sql/brand_setup/mysql4-upgrade-1.0.0-2.0.4.php +9 -0
- package.xml +6 -5
app/code/local/Vilpjsc/Brand/.DS_Store
CHANGED
Binary file
|
app/code/local/Vilpjsc/Brand/Helper/Data.php
CHANGED
@@ -32,7 +32,8 @@ class Vilpjsc_Brand_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
32 |
}
|
33 |
|
34 |
public function deleteBrandImage($brand) {
|
35 |
-
|
|
|
36 |
$length = strlen($subFolder);
|
37 |
|
38 |
$path = Mage::getBaseDir('media') . DS . 'brand' . DS;
|
@@ -42,37 +43,38 @@ class Vilpjsc_Brand_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
42 |
$firstFolder = $subFolder[0] . DS . $subFolder[1];
|
43 |
}
|
44 |
foreach ($this->getbrandConfig() as $size) {
|
45 |
-
if (file_exists($path . $firstFolder . DS . $brand->getId().$
|
46 |
-
file_exists($path . $firstFolder . DS . $brand->getId().$
|
47 |
-
unlink($path . $firstFolder . DS . $brand->getId().$
|
48 |
-
unlink($path . $firstFolder . DS . $brand->getId().$
|
49 |
-
} else if (file_exists($path . $firstFolder . DS . $brand->getId().$
|
50 |
-
file_exists($path . $firstFolder . DS . $brand->getId().$
|
51 |
-
unlink($path . $firstFolder . DS . $brand->getId().$
|
52 |
-
unlink($path . $firstFolder . DS . $brand->getId().$
|
53 |
-
} else if (file_exists($path . $firstFolder . DS . $brand->getId().$
|
54 |
-
file_exists($path . $firstFolder . DS . $brand->getId().$
|
55 |
-
unlink($path . $firstFolder . DS . $brand->getId().$
|
56 |
-
unlink($path . $firstFolder . DS . $brand->getId().$
|
57 |
-
} else if (file_exists($path . $firstFolder . DS . $brand->getId().$
|
58 |
-
file_exists($path . $firstFolder . DS . $brand->getId().$
|
59 |
-
unlink($path . $firstFolder . DS . $brand->getId().$
|
60 |
-
unlink($path . $firstFolder . DS . $brand->getId().$
|
61 |
-
} else if(file_exists($path . $firstFolder . DS . $brand->getId().$
|
62 |
-
file_exists($path . $firstFolder . DS . $brand->getId().$
|
63 |
-
unlink($path . $firstFolder . DS . $brand->getId().$
|
64 |
-
unlink($path . $firstFolder . DS . $brand->getId().$
|
65 |
}
|
66 |
}
|
67 |
}
|
68 |
|
69 |
public function getBrandImage($brand, $size = "small") {
|
70 |
$config = $this->getbrandConfig();
|
|
|
71 |
// there are 3sizes: small, medium, large
|
72 |
$size = $config[$size];
|
73 |
$w = $size['width'];
|
74 |
$h = $size['height'];
|
75 |
-
$subFolder = (string) $brand->getId() . $
|
76 |
$length = strlen($subFolder);
|
77 |
|
78 |
$path = Mage::getBaseDir('media') . DS . 'brand' . DS;
|
@@ -82,26 +84,26 @@ class Vilpjsc_Brand_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
82 |
$firstFolder = $subFolder[0] . DS . $subFolder[1];
|
83 |
}
|
84 |
$url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA)
|
85 |
-
. 'brand' . DS . $firstFolder . DS . $brand->getId().$
|
86 |
-
if (file_exists($path . $firstFolder . DS . $brand->getId() .$
|
87 |
-
$original = $path . $firstFolder . DS . $brand->getId() .$
|
88 |
-
$cropImage = $path . $firstFolder . DS . $brand->getId() .$
|
89 |
$image = $url . '_' . $w . '_' . $h . '.jpg';
|
90 |
-
} else if (file_exists($path . $firstFolder . DS . $brand->getId() .$
|
91 |
-
$original = $path . $firstFolder . DS . $brand->getId() .$
|
92 |
-
$cropImage = $path . $firstFolder . DS . $brand->getId() .$
|
93 |
$image = $url . '_' . $w . '_' . $h . '.png';
|
94 |
-
} else if (file_exists($path . $firstFolder . DS . $brand->getId() .$
|
95 |
-
$original = $path . $firstFolder . DS . $brand->getId() .$
|
96 |
-
$cropImage = $path . $firstFolder . DS . $brand->getId() .$
|
97 |
$image = $url . '_' . $w . '_' . $h . '.jpeg';
|
98 |
-
} else if (file_exists($path . $firstFolder . DS . $brand->getId() .$
|
99 |
-
$original = $path . $firstFolder . DS . $brand->getId() .$
|
100 |
-
$cropImage = $path . $firstFolder . DS . $brand->getId() .$
|
101 |
$image = $url . '_' . $w . '_' . $h . '.bmp';
|
102 |
} else {
|
103 |
-
$original = $path . $firstFolder . DS . $brand->getId() .$
|
104 |
-
$cropImage = $path . $firstFolder . DS . $brand->getId() .$
|
105 |
$image = $url . '_' . $w . '_' . $h . '.gif';
|
106 |
}
|
107 |
|
32 |
}
|
33 |
|
34 |
public function deleteBrandImage($brand) {
|
35 |
+
$title = strtolower($brand->getTitle());
|
36 |
+
$subFolder = strtolower((string) $brand->getId() . $title);
|
37 |
$length = strlen($subFolder);
|
38 |
|
39 |
$path = Mage::getBaseDir('media') . DS . 'brand' . DS;
|
43 |
$firstFolder = $subFolder[0] . DS . $subFolder[1];
|
44 |
}
|
45 |
foreach ($this->getbrandConfig() as $size) {
|
46 |
+
if (file_exists($path . $firstFolder . DS . $brand->getId().$title . '_' . $size['width'] . '_' . $size['height'] . '.jpg') ||
|
47 |
+
file_exists($path . $firstFolder . DS . $brand->getId().$title . '.jpg')) {
|
48 |
+
unlink($path . $firstFolder . DS . $brand->getId().$title . '_' . $size['width'] . '_' . $size['height'] . '.jpg');
|
49 |
+
unlink($path . $firstFolder . DS . $brand->getId().$title . '.jpg');
|
50 |
+
} else if (file_exists($path . $firstFolder . DS . $brand->getId().$title . '_' . $size['width'] . '_' . $size['height'] . '.png') ||
|
51 |
+
file_exists($path . $firstFolder . DS . $brand->getId().$title . '.png')) {
|
52 |
+
unlink($path . $firstFolder . DS . $brand->getId().$title . '_' . $size['width'] . '_' . $size['height'] . '.png');
|
53 |
+
unlink($path . $firstFolder . DS . $brand->getId().$title . '.png');
|
54 |
+
} else if (file_exists($path . $firstFolder . DS . $brand->getId().$title . '_' . $size['width'] . '_' . $size['height'] . '.jpeg') ||
|
55 |
+
file_exists($path . $firstFolder . DS . $brand->getId().$title . '.jpeg')) {
|
56 |
+
unlink($path . $firstFolder . DS . $brand->getId().$title . '_' . $size['width'] . '_' . $size['height'] . '.jpeg');
|
57 |
+
unlink($path . $firstFolder . DS . $brand->getId().$title . '.jpeg');
|
58 |
+
} else if (file_exists($path . $firstFolder . DS . $brand->getId().$title . '_' . $size['width'] . '_' . $size['height'] . '.bmp') ||
|
59 |
+
file_exists($path . $firstFolder . DS . $brand->getId().$title . '.bmp')) {
|
60 |
+
unlink($path . $firstFolder . DS . $brand->getId().$title . '_' . $size['width'] . '_' . $size['height'] . '.bmp');
|
61 |
+
unlink($path . $firstFolder . DS . $brand->getId().$title . '.bmp');
|
62 |
+
} else if(file_exists($path . $firstFolder . DS . $brand->getId().$title . '_' . $size['width'] . '_' . $size['height'] . '.gif') ||
|
63 |
+
file_exists($path . $firstFolder . DS . $brand->getId().$title . '.gif')){
|
64 |
+
unlink($path . $firstFolder . DS . $brand->getId().$title . '_' . $size['width'] . '_' . $size['height'] . '.gif');
|
65 |
+
unlink($path . $firstFolder . DS . $brand->getId().$title . '.gif');
|
66 |
}
|
67 |
}
|
68 |
}
|
69 |
|
70 |
public function getBrandImage($brand, $size = "small") {
|
71 |
$config = $this->getbrandConfig();
|
72 |
+
$title = strtolower($brand->getTitle());
|
73 |
// there are 3sizes: small, medium, large
|
74 |
$size = $config[$size];
|
75 |
$w = $size['width'];
|
76 |
$h = $size['height'];
|
77 |
+
$subFolder = (string) $brand->getId() . $title;
|
78 |
$length = strlen($subFolder);
|
79 |
|
80 |
$path = Mage::getBaseDir('media') . DS . 'brand' . DS;
|
84 |
$firstFolder = $subFolder[0] . DS . $subFolder[1];
|
85 |
}
|
86 |
$url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA)
|
87 |
+
. 'brand' . DS . $firstFolder . DS . $brand->getId().$title;
|
88 |
+
if (file_exists($path . $firstFolder . DS . $brand->getId() .$title. '.jpg')) {
|
89 |
+
$original = $path . $firstFolder . DS . $brand->getId() .$title. '.jpg';
|
90 |
+
$cropImage = $path . $firstFolder . DS . $brand->getId() .$title. '_' . $w . '_' . $h . '.jpg';
|
91 |
$image = $url . '_' . $w . '_' . $h . '.jpg';
|
92 |
+
} else if (file_exists($path . $firstFolder . DS . $brand->getId() .$title. '.png')) {
|
93 |
+
$original = $path . $firstFolder . DS . $brand->getId() .$title. '.png';
|
94 |
+
$cropImage = $path . $firstFolder . DS . $brand->getId() .$title. '_' . $w . '_' . $h . '.png';
|
95 |
$image = $url . '_' . $w . '_' . $h . '.png';
|
96 |
+
} else if (file_exists($path . $firstFolder . DS . $brand->getId() .$title. '.jpeg')) {
|
97 |
+
$original = $path . $firstFolder . DS . $brand->getId() .$title. '.jpeg';
|
98 |
+
$cropImage = $path . $firstFolder . DS . $brand->getId() .$title. '_' . $w . '_' . $h . '.jpeg';
|
99 |
$image = $url . '_' . $w . '_' . $h . '.jpeg';
|
100 |
+
} else if (file_exists($path . $firstFolder . DS . $brand->getId() .$title. '.bmp')) {
|
101 |
+
$original = $path . $firstFolder . DS . $brand->getId() .$title. '.bmp';
|
102 |
+
$cropImage = $path . $firstFolder . DS . $brand->getId() .$title. '_' . $w . '_' . $h . '.bmp';
|
103 |
$image = $url . '_' . $w . '_' . $h . '.bmp';
|
104 |
} else {
|
105 |
+
$original = $path . $firstFolder . DS . $brand->getId() .$title. '.gif';
|
106 |
+
$cropImage = $path . $firstFolder . DS . $brand->getId() .$title. '_' . $w . '_' . $h . '.gif';
|
107 |
$image = $url . '_' . $w . '_' . $h . '.gif';
|
108 |
}
|
109 |
|
app/code/local/Vilpjsc/Brand/controllers/.DS_Store
ADDED
Binary file
|
app/code/local/Vilpjsc/Brand/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Vilpjsc_Brand>
|
5 |
-
<version>2.0.
|
6 |
</Vilpjsc_Brand>
|
7 |
</modules>
|
8 |
<frontend>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Vilpjsc_Brand>
|
5 |
+
<version>2.0.4</version>
|
6 |
</Vilpjsc_Brand>
|
7 |
</modules>
|
8 |
<frontend>
|
app/code/local/Vilpjsc/Brand/sql/.DS_Store
ADDED
Binary file
|
app/code/local/Vilpjsc/Brand/sql/brand_setup/mysql4-upgrade-1.0.0-2.0.4.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
|
4 |
+
$installer->startSetup();
|
5 |
+
|
6 |
+
$installer->run("
|
7 |
+
-- DROP TABLE IF EXISTS {$this->getTable('brand')};
|
8 |
+
ALTER TABLE `{$this->getTable('brand')}`, DROP COLUMN `filename` ;");
|
9 |
+
$installer->endSetup();
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Shop_By_Brand_Vilpjsc</name>
|
4 |
-
<version>2.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/academic.php">Academic Free License (AFL)</license>
|
7 |
<channel>community</channel>
|
@@ -15,13 +15,14 @@
|
|
15 |
<p>Attach image for each brand name</p>
|
16 |
<p>Associate a brand name within a Category.</p>
|
17 |
<p><a href="http://www.e-commercemagento.com/plugin-extension/shop-by-brand-magento-extension/index.html">Follow this page to Config Shop By Brand Extension</a></p></description>
|
18 |
-
<notes>
|
|
|
19 |
I have missed adminhtml/ ... /brand.xml
|
20 |
Extend brand's image functionality</notes>
|
21 |
<authors><author><name>Paul Aan</name><user>auto-converted</user><email>weburnittv@gmail.com</email></author></authors>
|
22 |
-
<date>2011-12-
|
23 |
-
<time>
|
24 |
-
<contents><target name="magelocal"><dir name="Vilpjsc"><dir name="Brand"><dir name="Block"><dir name="Adminhtml"><dir name="Brand"><dir name="Edit"><dir name="Tab"><file name="Form.php" hash="a8ce7cfb49658d5bf7186569d8ec5af9"/></dir><file name="Form.php" hash="a2adb56e3ea97277088547f9b71e9af1"/><file name="Tabs.php" hash="5efb6e595d30536afa2d4a8e38d35a8b"/></dir><dir name="Grid"><dir name="Renderer"><file name="Arrange.php" hash="dbdd6573e2105280d4e7687e157bbe9c"/><file name="Image.php" hash="721de9b9eccac541737dc7a06af95aa3"/></dir></dir><file name="Edit.php" hash="e6c096481d92ef18527ea092998f8216"/><file name="Grid.php" hash="08175adf3f1ba357eda777025d286ed7"/></dir><dir name="Tab"><dir name="Brand"><dir name="Renderer"><file name="Checkbox.php" hash="ab7596bb0dd186a1699c226b16dba076"/></dir></dir><file name="Brand.php" hash="db3db45c7f6142d6cfaa5e7533dbacb3"/></dir><file name="Brand.php" hash="bfd7a47137600b79aecc1852686b4a0e"/><file name="Tabs.php" hash="6c5674b87f2e32270d61a8f6289cb76e"/></dir><file name="Brand.php" hash="fcb1a83eff532365ea9f28bb38e663dd"/><file name="Brandinfo.php" hash="8b8224ae319a54e6a325e94b2e6ed3ba"/><file name="Category.php" hash="17f16d62d590017988c69dc7794ce32e"/><file name="Onbrand.php" hash="8b27b34637ffccde837c3c651baa14f6"/></dir><dir name="Helper"><file name="Data.php" hash="
|
25 |
<compatible/>
|
26 |
<dependencies/>
|
27 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Shop_By_Brand_Vilpjsc</name>
|
4 |
+
<version>2.0.4</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/academic.php">Academic Free License (AFL)</license>
|
7 |
<channel>community</channel>
|
15 |
<p>Attach image for each brand name</p>
|
16 |
<p>Associate a brand name within a Category.</p>
|
17 |
<p><a href="http://www.e-commercemagento.com/plugin-extension/shop-by-brand-magento-extension/index.html">Follow this page to Config Shop By Brand Extension</a></p></description>
|
18 |
+
<notes>Fix a little bit for following Niland requirement.
|
19 |
+
Shop By Brand
|
20 |
I have missed adminhtml/ ... /brand.xml
|
21 |
Extend brand's image functionality</notes>
|
22 |
<authors><author><name>Paul Aan</name><user>auto-converted</user><email>weburnittv@gmail.com</email></author></authors>
|
23 |
+
<date>2011-12-05</date>
|
24 |
+
<time>02:54:16</time>
|
25 |
+
<contents><target name="magelocal"><dir name="Vilpjsc"><dir name="Brand"><dir name="Block"><dir name="Adminhtml"><dir name="Brand"><dir name="Edit"><dir name="Tab"><file name="Form.php" hash="a8ce7cfb49658d5bf7186569d8ec5af9"/></dir><file name="Form.php" hash="a2adb56e3ea97277088547f9b71e9af1"/><file name="Tabs.php" hash="5efb6e595d30536afa2d4a8e38d35a8b"/></dir><dir name="Grid"><dir name="Renderer"><file name="Arrange.php" hash="dbdd6573e2105280d4e7687e157bbe9c"/><file name="Image.php" hash="721de9b9eccac541737dc7a06af95aa3"/></dir></dir><file name="Edit.php" hash="e6c096481d92ef18527ea092998f8216"/><file name="Grid.php" hash="08175adf3f1ba357eda777025d286ed7"/></dir><dir name="Tab"><dir name="Brand"><dir name="Renderer"><file name="Checkbox.php" hash="ab7596bb0dd186a1699c226b16dba076"/></dir></dir><file name="Brand.php" hash="db3db45c7f6142d6cfaa5e7533dbacb3"/></dir><file name="Brand.php" hash="bfd7a47137600b79aecc1852686b4a0e"/><file name="Tabs.php" hash="6c5674b87f2e32270d61a8f6289cb76e"/></dir><file name="Brand.php" hash="fcb1a83eff532365ea9f28bb38e663dd"/><file name="Brandinfo.php" hash="8b8224ae319a54e6a325e94b2e6ed3ba"/><file name="Category.php" hash="17f16d62d590017988c69dc7794ce32e"/><file name="Onbrand.php" hash="8b27b34637ffccde837c3c651baa14f6"/></dir><dir name="Helper"><file name="Data.php" hash="4759f8584cf1e8ccf55574866c3f835b"/><file name=".DS_Store" hash="ab8ec9291ca4885b3d88edf43f8a944e"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Brand"><file name="Collection.php" hash="aed1882a2deccfb34441a0b9c42b1443"/></dir><dir name="Category"><file name="Collection.php" hash="b6aea9d190da1c4726f26f4838e0c8a7"/></dir><file name="Brand.php" hash="a2cf81cba953ea515aad52163ff43401"/><file name="Category.php" hash="6804ea56d6c6b611eace7ca665021777"/></dir><file name="Brand.php" hash="dc03130d2682828d2d42690be5e877e5"/><file name="Category.php" hash="b8d7adf55972e7293e790c0d17a58eb1"/><file name="Categoryname.php" hash="e1b5f216aa1b1796014dec708e33c100"/><file name="Observer.php" hash="a3c2e8c5e9362b17d0a2df638c6ae2cd"/><file name="Resizeimage.php" hash="9b739d1a01db35e8a35cd6fa64f4d828"/><file name="Status.php" hash="1c359ecd7c1e8e72e884191cca302f72"/><file name=".DS_Store" hash="ffef2a55252096a56314309248b1c0b7"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="BrandController.php" hash="c4d2683712f150d6ee3b935cad757c55"/></dir><file name="IndexController.php" hash="f864d56b2d7ad45269856f51861e71b0"/><file name=".DS_Store" hash="fa4269680258aa00a374544186da6239"/></dir><dir name="etc"><file name="adminhtml.xml" hash="61a47aa522b8a7924768303d6c3335ec"/><file name="config.xml" hash="a043852b23263c662d94ead0f7789d1e"/><file name="system.xml" hash="00838597f517361acd1b87282b2ef98a"/></dir><dir name="sql"><dir name="brand_setup"><file name="mysql4-install-0.1.0.php" hash="ee1222e509f6b5f9f157ff5aeca07e79"/><file name="mysql4-upgrade-0.1.0-1.0.0.php" hash="1ceb98efe6b52ff256dd68805082b85e"/><file name="mysql4-upgrade-1.0.0-2.0.4.php" hash="86c4a6784c347b53a21c891ecd9a1669"/></dir><file name=".DS_Store" hash="3eca990d1624ddcbee950228ebb126c6"/></dir><file name=".DS_Store" hash="9ddc5c919f26c2f8e6db4cded3d4b143"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Vilpjsc_Brand.xml" hash="8b0112a53ff9d27603d014530b0b5e6a"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="brand"><file name="brand_info.phtml" hash="fba5be7f4aa39040ff240e70d3445683"/><file name="categorybrand.phtml" hash="205a3c4e27db817b5d2760e376b31f35"/><file name="index.phtml" hash="2cb6c3f07a3d3c0e6c00db2b7e99b3a8"/></dir></dir><dir name="layout"><file name="brand.xml" hash="7d2421a2a311421adc2963f4411f6029"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="brand.xml" hash="b4411f55825b5675752bcdebbe761443"/></dir></dir></dir></dir></target></contents>
|
26 |
<compatible/>
|
27 |
<dependencies/>
|
28 |
</package>
|