Version Notes
Added missing module configuration in package.
Download this release
Release Info
Developer | Matthias Kerstner |
Extension | BothInteract_ConfigurableProductVariantsImageAssignment |
Version | 1.5.0 |
Comparing to | |
See all releases |
Code changes from version 1.3.0 to 1.5.0
- app/code/community/BothInteract/ConfigurableProductVariantsImageAssignment/Model/Observer.php +13 -6
- app/code/community/BothInteract/ConfigurableProductVariantsImageAssignment/Model/System/Config/Source/View.php +6 -1
- app/code/community/BothInteract/ConfigurableProductVariantsImageAssignment/etc/config.xml +1 -1
- app/etc/modules/BothInteract_ConfigurableProductVariantsImageAssignment.xml +10 -0
- package.xml +5 -5
- shell/set_required_images_for_configurable_product_variants.php +1 -1
app/code/community/BothInteract/ConfigurableProductVariantsImageAssignment/Model/Observer.php
CHANGED
@@ -20,11 +20,14 @@
|
|
20 |
* @see self::$LOG_FILE.
|
21 |
*
|
22 |
* @author Matthias Kerstner <matthias@both-interact.com>
|
23 |
-
* @version 1.
|
24 |
* @copyright (c) 2015, Both Interact GmbH
|
25 |
*/
|
26 |
class BothInteract_ConfigurableProductVariantsImageAssignment_Model_Observer {
|
27 |
|
|
|
|
|
|
|
28 |
/** @var string placeholder text if no image is set */
|
29 |
private static $IMAGE_NO_SELECTION = 'no_selection';
|
30 |
|
@@ -43,11 +46,12 @@ class BothInteract_ConfigurableProductVariantsImageAssignment_Model_Observer {
|
|
43 |
*/
|
44 |
private function logToFile($msg) {
|
45 |
Mage::log($msg, null, Mage::getStoreConfig(
|
46 |
-
|
|
|
47 |
}
|
48 |
|
49 |
/**
|
50 |
-
*
|
51 |
* @return array
|
52 |
*/
|
53 |
private function valueToImageType($value) {
|
@@ -215,7 +219,8 @@ class BothInteract_ConfigurableProductVariantsImageAssignment_Model_Observer {
|
|
215 |
*/
|
216 |
$childProduct->addImageToMediaGallery($parentProductBaseImagePath, $requiredChildProductImageTypes, false, false);
|
217 |
|
218 |
-
if (Mage::getStoreConfig(
|
|
|
219 |
$this->logToFile('************************************');
|
220 |
$this->logToFile('SIMULATION: Not saving child product '
|
221 |
. $childProduct->getId());
|
@@ -312,7 +317,8 @@ class BothInteract_ConfigurableProductVariantsImageAssignment_Model_Observer {
|
|
312 |
*/
|
313 |
public function catalog_product_save_after(Varien_Event_Observer $observer) {
|
314 |
try {
|
315 |
-
if (!Mage::getStoreConfig(
|
|
|
316 |
$this->logToFile('Extension INACTIVE - Quitting...');
|
317 |
return;
|
318 |
}
|
@@ -349,7 +355,8 @@ class BothInteract_ConfigurableProductVariantsImageAssignment_Model_Observer {
|
|
349 |
* Options are taken from system config source view.
|
350 |
*/
|
351 |
$requiredChildProductImageTypes = array();
|
352 |
-
$requiredChildProductImageTypeValues = explode(',', Mage::getStoreConfig(
|
|
|
353 |
|
354 |
foreach ($requiredChildProductImageTypeValues as $requiredChildProductImageTypeValue) {
|
355 |
$val = $this->valueToImageType($requiredChildProductImageTypeValue);
|
20 |
* @see self::$LOG_FILE.
|
21 |
*
|
22 |
* @author Matthias Kerstner <matthias@both-interact.com>
|
23 |
+
* @version 1.5.0
|
24 |
* @copyright (c) 2015, Both Interact GmbH
|
25 |
*/
|
26 |
class BothInteract_ConfigurableProductVariantsImageAssignment_Model_Observer {
|
27 |
|
28 |
+
/** @var string module namespace */
|
29 |
+
private static $_MODULE_NAMESPACE = 'bothinteract_configurableproductvariantsimageassignment';
|
30 |
+
|
31 |
/** @var string placeholder text if no image is set */
|
32 |
private static $IMAGE_NO_SELECTION = 'no_selection';
|
33 |
|
46 |
*/
|
47 |
private function logToFile($msg) {
|
48 |
Mage::log($msg, null, Mage::getStoreConfig(
|
49 |
+
self::$_MODULE_NAMESPACE
|
50 |
+
. '/general/log_file', Mage::app()->getStore()));
|
51 |
}
|
52 |
|
53 |
/**
|
54 |
+
* Converts source view value to internal image type.
|
55 |
* @return array
|
56 |
*/
|
57 |
private function valueToImageType($value) {
|
219 |
*/
|
220 |
$childProduct->addImageToMediaGallery($parentProductBaseImagePath, $requiredChildProductImageTypes, false, false);
|
221 |
|
222 |
+
if (Mage::getStoreConfig(self::$_MODULE_NAMESPACE
|
223 |
+
. '/general/is_simulation')) {
|
224 |
$this->logToFile('************************************');
|
225 |
$this->logToFile('SIMULATION: Not saving child product '
|
226 |
. $childProduct->getId());
|
317 |
*/
|
318 |
public function catalog_product_save_after(Varien_Event_Observer $observer) {
|
319 |
try {
|
320 |
+
if (!Mage::getStoreConfig(self::$_MODULE_NAMESPACE
|
321 |
+
. '/general/is_active', Mage::app()->getStore())) {
|
322 |
$this->logToFile('Extension INACTIVE - Quitting...');
|
323 |
return;
|
324 |
}
|
355 |
* Options are taken from system config source view.
|
356 |
*/
|
357 |
$requiredChildProductImageTypes = array();
|
358 |
+
$requiredChildProductImageTypeValues = explode(',', Mage::getStoreConfig(self::$_MODULE_NAMESPACE
|
359 |
+
. '/general/required_image_types', Mage::app()->getStore()));
|
360 |
|
361 |
foreach ($requiredChildProductImageTypeValues as $requiredChildProductImageTypeValue) {
|
362 |
$val = $this->valueToImageType($requiredChildProductImageTypeValue);
|
app/code/community/BothInteract/ConfigurableProductVariantsImageAssignment/Model/System/Config/Source/View.php
CHANGED
@@ -2,13 +2,18 @@
|
|
2 |
|
3 |
/**
|
4 |
* @author Matthias Kerstner <matthias@both-interact.com>
|
5 |
-
* @version 1.
|
6 |
* @copyright (c) 2015, Both Interact GmbH
|
7 |
*/
|
8 |
class BothInteract_ConfigurableProductVariantsImageAssignment_Model_System_Config_Source_View {
|
9 |
|
|
|
10 |
public static $VALUE_IMAGE_TYPE_BASE_IMAGE = 0;
|
|
|
|
|
11 |
public static $VALUE_IMAGE_TYPE_SMALL_IMAGE = 1;
|
|
|
|
|
12 |
public static $VALUE_IMAGE_TYPE_THUMBNAIL = 2;
|
13 |
|
14 |
/**
|
2 |
|
3 |
/**
|
4 |
* @author Matthias Kerstner <matthias@both-interact.com>
|
5 |
+
* @version 1.5.0
|
6 |
* @copyright (c) 2015, Both Interact GmbH
|
7 |
*/
|
8 |
class BothInteract_ConfigurableProductVariantsImageAssignment_Model_System_Config_Source_View {
|
9 |
|
10 |
+
/** @var string base image type */
|
11 |
public static $VALUE_IMAGE_TYPE_BASE_IMAGE = 0;
|
12 |
+
|
13 |
+
/** @var string small image type */
|
14 |
public static $VALUE_IMAGE_TYPE_SMALL_IMAGE = 1;
|
15 |
+
|
16 |
+
/** @var string thumbnail image type */
|
17 |
public static $VALUE_IMAGE_TYPE_THUMBNAIL = 2;
|
18 |
|
19 |
/**
|
app/code/community/BothInteract/ConfigurableProductVariantsImageAssignment/etc/config.xml
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
<modules>
|
6 |
<BothInteract_ConfigurableProductVariantsImageAssignment>
|
7 |
-
<version>1.
|
8 |
</BothInteract_ConfigurableProductVariantsImageAssignment>
|
9 |
</modules>
|
10 |
|
4 |
|
5 |
<modules>
|
6 |
<BothInteract_ConfigurableProductVariantsImageAssignment>
|
7 |
+
<version>1.5.0</version>
|
8 |
</BothInteract_ConfigurableProductVariantsImageAssignment>
|
9 |
</modules>
|
10 |
|
app/etc/modules/BothInteract_ConfigurableProductVariantsImageAssignment.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<modules>
|
5 |
+
<BothInteract_ConfigurableProductVariantsImageAssignment>
|
6 |
+
<active>true</active>
|
7 |
+
<codePool>community</codePool>
|
8 |
+
</BothInteract_ConfigurableProductVariantsImageAssignment>
|
9 |
+
</modules>
|
10 |
+
</config>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>BothInteract_ConfigurableProductVariantsImageAssignment</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/mit-license.php">MIT License (MITL)</license>
|
7 |
<channel>community</channel>
|
@@ -37,11 +37,11 @@
|
|
37 |
<p>So you have the option to easily track events handled by this extension and check for possible problems.</p>
|
38 |

|
39 |
</description>
|
40 |
-
<notes>Added missing
|
41 |
<authors><author><name>Matthias Kerstner</name><user>mkbothinteract</user><email>matthias@both-interact.com</email></author></authors>
|
42 |
-
<date>2015-
|
43 |
-
<time>
|
44 |
-
<contents><target name="magecommunity"><dir name="BothInteract"><dir name="ConfigurableProductVariantsImageAssignment"><dir name="Model"><file name="Observer.php" hash="
|
45 |
<compatible/>
|
46 |
<dependencies><required><php><min>5.3.0</min><max>5.6.6</max></php></required></dependencies>
|
47 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>BothInteract_ConfigurableProductVariantsImageAssignment</name>
|
4 |
+
<version>1.5.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/mit-license.php">MIT License (MITL)</license>
|
7 |
<channel>community</channel>
|
37 |
<p>So you have the option to easily track events handled by this extension and check for possible problems.</p>
|
38 |

|
39 |
</description>
|
40 |
+
<notes>Added missing module configuration in package.</notes>
|
41 |
<authors><author><name>Matthias Kerstner</name><user>mkbothinteract</user><email>matthias@both-interact.com</email></author></authors>
|
42 |
+
<date>2015-08-20</date>
|
43 |
+
<time>06:51:32</time>
|
44 |
+
<contents><target name="magecommunity"><dir name="BothInteract"><dir name="ConfigurableProductVariantsImageAssignment"><dir name="Model"><file name="Observer.php" hash="42c35b2fa0d909a3f602d52950ce059f"/><dir name="System"><dir name="Config"><dir name="Source"><file name="View.php" hash="5a85509ff257fed1a95748578ea80df5"/></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="b5e70b701986609040908c0b033aa88a"/><file name="system.xml" hash="cbc673f91bccab614b9a6e653f38b3a4"/><file name="adminhtml.xml" hash="17ff98ec54bdda6275f8024ee5d5d39f"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="BothInteract_ConfigurableProductVariantsImageAssignment.xml" hash="d38ef35b9d75fee8e4832a1659a82391"/></dir></target><target name="mage"><dir name="shell"><file name="set_required_images_for_configurable_product_variants.php" hash="9ded677df94bf421440ec8d46b8414c7"/></dir></target><target name="magelocale"><dir name="en_US"><file name="BothInteract_ConfigurableProductVariantsImageAssignment.csv" hash=""/></dir><dir name="de_DE"><file name="BothInteract_ConfigurableProductVariantsImageAssignment.csv" hash=""/></dir></target></contents>
|
45 |
<compatible/>
|
46 |
<dependencies><required><php><min>5.3.0</min><max>5.6.6</max></php></required></dependencies>
|
47 |
</package>
|
shell/set_required_images_for_configurable_product_variants.php
CHANGED
@@ -4,7 +4,7 @@ require_once 'abstract.php';
|
|
4 |
|
5 |
/**
|
6 |
* @author Matthias Kerstner <matthias@both-interact.com>
|
7 |
-
* @version 1.
|
8 |
* @copyright (c) 2015, Both Interact GmbH
|
9 |
*/
|
10 |
class Mage_Shell_Set_Required_Images_For_Configurable_Product_Variants extends Mage_Shell_Abstract {
|
4 |
|
5 |
/**
|
6 |
* @author Matthias Kerstner <matthias@both-interact.com>
|
7 |
+
* @version 1.5.0
|
8 |
* @copyright (c) 2015, Both Interact GmbH
|
9 |
*/
|
10 |
class Mage_Shell_Set_Required_Images_For_Configurable_Product_Variants extends Mage_Shell_Abstract {
|