Skip to content

Commit

Permalink
v2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tzyganu committed Mar 23, 2015
1 parent da4b99f commit 8b94f62
Show file tree
Hide file tree
Showing 9 changed files with 196 additions and 168 deletions.
43 changes: 26 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
Easylife Switcher
========

Configurable products switcher v2.1.1

This is a Magento extension that allows you to change the configurable products dropdowns to labels, colors or images.
It also allows you to set default configurations, keep the selected options when changing an option from above.
You can also change the product image or entire media block when the congiruable option is changed and display the simple product image or media block.
For a full list of features with screenshots included check the [Features list] (https://github.com/tzyganu/Switcher/wiki/features) and the [Configuration](https://github.com/tzyganu/Switcher/wiki/configuration) section.

Please visit the [wiki](https://github.com/tzyganu/Switcher/wiki) for a full description.

Extension is compatible with CE versions 1.7 and after.
The CE 1.9.1 version already comes with a configurable swatches extension.
If you use this extension and disable the core configurable swatches it works without an issue.
If you have both of them enabled, this extension shamelessly hides the elements generated by the core module.
It still seams to work, but test carefully specially if you use a custom theme.
Easylife Switcher
========

Configurable products switcher v2.2.0

Notice
----------

Most probably version 2.2.0 is going to be the last version of this module (unless someone finds a flagrant bug).
Magento already has a color swatch module included in the core starting with version 1.9.1 Use that one.

What it does
-------

This is a Magento extension that allows you to change the configurable products dropdowns to labels, colors or images.
It also allows you to set default configurations, keep the selected options when changing an option from above.
You can also change the product image or entire media block when the congiruable option is changed and display the simple product image or media block.
For a full list of features with screenshots included check the [Features list] (https://github.com/tzyganu/Switcher/wiki/features) and the [Configuration](https://github.com/tzyganu/Switcher/wiki/configuration) section.

Please visit the [wiki](https://github.com/tzyganu/Switcher/wiki) for a full description.

Extension is compatible with CE versions 1.7 and after.
The CE 1.9.1 version already comes with a configurable swatches extension.
If you use this extension and disable the core configurable swatches it works without an issue.
If you have both of them enabled, this extension shamelessly hides the elements generated by the core module.
It still seams to work, but test carefully specially if you use a custom theme.
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ public function getJsonAdditionalConfig()
$config['switch_media_callback'] = Mage::getStoreConfig(self::XML_MEDIA_CALLBACK_PATH);
$config['allow_no_stock_select'] = $this->getAllowNoStockSelect();
$config['keep_values'] = Mage::getStoreConfigFlag(self::XML_KEEP_SELECTED_VALUES);
$config['image_size'] = $this->_getImageDimensions(self::XML_OPTIONS_IMAGE_RESIZE);

if (!$this->getProduct()->hasPreconfiguredValues()) {
if ($this->getDefaultValues()) {
Expand Down Expand Up @@ -487,9 +488,19 @@ public function getSwitchImages()
if (!empty($dimensions)) {
$image->resize($dimensions[0], $dimensions[1]);
}
$images[$id][$product->getId()] = (string)$image;
$images[$id][$product->getId()]['src'] = (string)$image;
$label = $product->getData('image_label');
if (empty($label)) {
$label = $product->getName();
}
$images[$id][$product->getId()]['alt'] = $this->escapeHtml($label);
} elseif (Mage::getStoreConfigFlag(self::XML_USE_CONF_IMAGE)) {
$images[$id][$product->getId()] = (string)$this->getConfProductImage();
$images[$id][$product->getId()] ['src']= (string)$this->getConfProductImage();
$label = $this->getProduct()->getData('image_label');
if (empty($label)) {
$label = $this->getProduct()->getName();
}
$images[$id][$product->getId()]['alt'] = $this->escapeHtml($label);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/code/community/Easylife/Switcher/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<config>
<modules>
<Easylife_Switcher>
<version>2.1.1</version>
<version>2.2.0</version>
</Easylife_Switcher>
</modules>
<global>
Expand All @@ -41,7 +41,7 @@
<easylife_switcher_resource>
<class>Easylife_Switcher_Model_Resource</class>
<entities>
<hashcode><!-- left here for backwards compatibility - not used since 2.0.0 -->
<hashcode><!-- left here for backwards compatibility - @deprecated since 2.0.0 -->
<table>easylife_switcher_hascode</table>
</hashcode>
</entities>
Expand Down
100 changes: 50 additions & 50 deletions app/design/frontend/base/default/layout/easylife_switcher.xml
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
<?xml version="1.0"?>
<!--
/**
* Easylife_Switcher extension
*
* NOTICE OF LICENSE
*
* This source file is subject to the MIT License
* that is bundled with this package in the file LICENSE_EASYLIFE_SWITCHER.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/mit-license.php
*
* @category Easylife
* @package Easylife_Switcher
* @copyright Copyright (c) 2013
* @license http://opensource.org/licenses/mit-license.php MIT License
*/
/**
* add new block to configurable products view
*
* @category Easylife
* @package Easylife_Switcher
* @author Marius Strajeru <[email protected]>
*/
-->
<layout>
<PRODUCT_TYPE_configurable>
<reference name="head">
<action method="addJs" ifconfig="easylife_switcher/settings/enabled">
<js>easylife_switcher/event.simulate.js</js>
</action>
<action method="addJs" ifconfig="easylife_switcher/settings/enabled">
<js>easylife_switcher/product.js</js>
</action>
<action method="addCss" ifconfig="easylife_switcher/settings/enabled">
<css>css/easylife_switcher/styles.css</css>
</action>
<action method="removeItem" ifconfig="easylife_switcher/settings/enabled">
<type>skin_js</type>
<name>js/configurableswatches/product-media.js</name>
</action>
<action method="removeItem" ifconfig="easylife_switcher/settings/enabled">
<type>skin_js</type>
<name>js/configurableswatches/swatches-product.js</name>
</action>
</reference>
<reference name="content">
<block type="easylife_switcher/catalog_product_view_type_configurable_config" template="easylife_switcher/catalog/product/view/type/configurable/config.phtml" />
</reference>
</PRODUCT_TYPE_configurable>
<?xml version="1.0"?>
<!--
/**
* Easylife_Switcher extension
*
* NOTICE OF LICENSE
*
* This source file is subject to the MIT License
* that is bundled with this package in the file LICENSE_EASYLIFE_SWITCHER.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/mit-license.php
*
* @category Easylife
* @package Easylife_Switcher
* @copyright Copyright (c) 2013
* @license http://opensource.org/licenses/mit-license.php MIT License
*/
/**
* add new block to configurable products view
*
* @category Easylife
* @package Easylife_Switcher
* @author Marius Strajeru <[email protected]>
*/
-->
<layout>
<PRODUCT_TYPE_configurable>
<reference name="head">
<action method="addJs" ifconfig="easylife_switcher/settings/enabled">
<js>easylife_switcher/event.simulate.js</js>
</action>
<action method="addJs" ifconfig="easylife_switcher/settings/enabled">
<js>easylife_switcher/product.js</js>
</action>
<action method="addCss" ifconfig="easylife_switcher/settings/enabled">
<css>css/easylife_switcher/styles.css</css>
</action>
<action method="removeItem" ifconfig="easylife_switcher/settings/enabled">
<type>skin_js</type>
<name>js/configurableswatches/product-media.js</name>
</action>
<action method="removeItem" ifconfig="easylife_switcher/settings/enabled">
<type>skin_js</type>
<name>js/configurableswatches/swatches-product.js</name>
</action>
</reference>
<reference name="content">
<block type="easylife_switcher/catalog_product_view_type_configurable_config" template="easylife_switcher/catalog/product/view/type/configurable/config.phtml" />
</reference>
</PRODUCT_TYPE_configurable>
</layout>
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
<?php
/**
* Easylife_Switcher extension
*
* NOTICE OF LICENSE
*
* This source file is subject to the MIT License
* that is bundled with this package in the file LICENSE_EASYLIFE_SWITCHER.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/mit-license.php
*
* @category Easylife
* @package Easylife_Switcher
* @copyright 2013 - 2014 Marius Strajeru
* @license http://opensource.org/licenses/mit-license.php MIT License
*/
/**
* override the spConfig variable
*
* @category Easylife
* @package Easylife_Switcher
*/
?>
<?php if (Mage::helper('easylife_switcher')->isEnabled()) : ?>
<script type="text/javascript">
//<![CDATA[
var switcherConfig = <?php echo $this->getJsonAdditionalConfig() ?>;
document.observe('dom:loaded', function(){
if (spConfig){
spConfig = new Easylife.Switcher(Object.extend(spConfig.config, switcherConfig));
}
});
//]]>
</script>
<?php
/**
* Easylife_Switcher extension
*
* NOTICE OF LICENSE
*
* This source file is subject to the MIT License
* that is bundled with this package in the file LICENSE_EASYLIFE_SWITCHER.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/mit-license.php
*
* @category Easylife
* @package Easylife_Switcher
* @copyright 2013 - 2014 Marius Strajeru
* @license http://opensource.org/licenses/mit-license.php MIT License
*/
/**
* override the spConfig variable
*
* @category Easylife
* @package Easylife_Switcher
*/
?>
<?php if (Mage::helper('easylife_switcher')->isEnabled()) : ?>
<script type="text/javascript">
//<![CDATA[
var switcherConfig = <?php echo $this->getJsonAdditionalConfig() ?>;
document.observe('dom:loaded', function(){
if (spConfig){
spConfig = new Easylife.Switcher(Object.extend(spConfig.config, switcherConfig));
}
});
//]]>
</script>
<?php endif;?>
22 changes: 11 additions & 11 deletions app/etc/modules/Easylife_Switcher.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0"?>
<config>
<modules>
<Easylife_Switcher>
<codePool>community</codePool>
<active>true</active>
<depends>
<Mage_Catalog />
</depends>
</Easylife_Switcher>
</modules>
<?xml version="1.0"?>
<config>
<modules>
<Easylife_Switcher>
<codePool>community</codePool>
<active>true</active>
<depends>
<Mage_Catalog />
</depends>
</Easylife_Switcher>
</modules>
</config>
98 changes: 49 additions & 49 deletions app/locale/es_ES/Easylife_Switcher.csv
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
"Allow out of stock products to be selected","Permitir seleccionar productos sin existencias"
Attribute,Atributo
"Autoselect first option if none specified","Autoseleccionar primera opción si no hay ninguna seleccionada"
"Block type for media section. Leave empty to use default","Tipo bloque para la sección media. Dejar vacío para utilizar la opción por defecto"
Cancel,Cancelar
"Change images when these attributes are changed","Cambiar imagen cuando estos atributos cambien"
"Change media content when these attributes are changed","Cambiar contenido media cuando estos atributos cambien"
"Changing the configurable value of these attributes will trigger the main image to change, if available.","Cambiando el valor de los atributos hará que la imagen principal cambie, si está disponible."
"Changing the configurable value of these attributes will trigger the media block to change.","Cambiando el valor de los atributos hará que el bloque media cambie."
Colors,Colores
"Configurable attributes transforms","Transformaciones de los atributos configurables"
"Configure Colors","Configurar colores"
"Configure Images","Configurar imágenes"
"Custom images","Imágenes personalizadas"
Default,Por defecto
"Dom Media block selector","Selector DOM del bloque media"
"Dom selector for main image","Selector DOM para imagen principal"
"Easylife Switcher","Easylife Switcher"
Enabled,Habilitado
"Fill Options","Rellenar opciones"
Images,Imágenes
"JS callback to be executed after the main image is changed.","JS callback que se ejecutará al cambiar la imagen principal."
"JS callback to be executed after the media block is changed.","JS callback que se ejecutará al cambiar el bloque ."
"Keep previously selected values","Mantener valores seleccionados previamente"
"Label / Options image size","Etiqueta / Opciones tamaño de imagen"
Labels,Etiquetas
"Main image size","Tamaño imagen principal"
"No image switch","Sin cambio de imagen"
"No transformation","Sin transformación"
"Prototype expression that selects the main image element","Expresión Prototype que selecciona el elemento de la imagen principal"
"Prototype expression that selects the media block container","Expresión Prototype que selecciona el contenedor del bloque media"
"Recommended if you have 2 or more configurable attributes.","Recomendado si tiene 2 o más atributos en el configurable."
Save,Guardar
Settings,Configuración
"Show added configurable prices in label","Mostrar precios configurables añadidos en la etiqueta"
"Show out of stock configurations","Mostrar opciones fuera de existencia"
"Simple product images","Imágenes producto simple"
"Switch all media section","Cambiar toda la sección media"
"Switch main image","Cambiar imagen principal"
"Switch product images","Cambiar imágenes de producto"
"Template for media block. Leave empty to use default.","Plantilla para el bloque de media. Dejar vacío para valor por defecto."
"There was a problem uploading images","Hubo un problema subiendo imágenes"
Transformation,Transformación
"Transformation settings","Configuración de las transformaciones"
"Use Configuration for default store view","Usar la configuración por defecto de la vista de tienda"
"Use configurable product image if the simple one does not have images","Usar la imagen del configurable si las vistas simples no tienen"
"Use this image attribute","Usar este atributo de imagen"
"Use values like 100x80 or simply 100. Leave empty for no resize","Usar valores como 100x80 o solo 100. Dejarlo vacío para no reescalar"
[none],[ninguno]
"Allow out of stock products to be selected","Permitir seleccionar productos sin existencias"
Attribute,Atributo
"Autoselect first option if none specified","Autoseleccionar primera opción si no hay ninguna seleccionada"
"Block type for media section. Leave empty to use default","Tipo bloque para la sección media. Dejar vacío para utilizar la opción por defecto"
Cancel,Cancelar
"Change images when these attributes are changed","Cambiar imagen cuando estos atributos cambien"
"Change media content when these attributes are changed","Cambiar contenido media cuando estos atributos cambien"
"Changing the configurable value of these attributes will trigger the main image to change, if available.","Cambiando el valor de los atributos hará que la imagen principal cambie, si está disponible."
"Changing the configurable value of these attributes will trigger the media block to change.","Cambiando el valor de los atributos hará que el bloque media cambie."
Colors,Colores
"Configurable attributes transforms","Transformaciones de los atributos configurables"
"Configure Colors","Configurar colores"
"Configure Images","Configurar imágenes"
"Custom images","Imágenes personalizadas"
Default,Por defecto
"Dom Media block selector","Selector DOM del bloque media"
"Dom selector for main image","Selector DOM para imagen principal"
"Easylife Switcher","Easylife Switcher"
Enabled,Habilitado
"Fill Options","Rellenar opciones"
Images,Imágenes
"JS callback to be executed after the main image is changed.","JS callback que se ejecutará al cambiar la imagen principal."
"JS callback to be executed after the media block is changed.","JS callback que se ejecutará al cambiar el bloque ."
"Keep previously selected values","Mantener valores seleccionados previamente"
"Label / Options image size","Etiqueta / Opciones tamaño de imagen"
Labels,Etiquetas
"Main image size","Tamaño imagen principal"
"No image switch","Sin cambio de imagen"
"No transformation","Sin transformación"
"Prototype expression that selects the main image element","Expresión Prototype que selecciona el elemento de la imagen principal"
"Prototype expression that selects the media block container","Expresión Prototype que selecciona el contenedor del bloque media"
"Recommended if you have 2 or more configurable attributes.","Recomendado si tiene 2 o más atributos en el configurable."
Save,Guardar
Settings,Configuración
"Show added configurable prices in label","Mostrar precios configurables añadidos en la etiqueta"
"Show out of stock configurations","Mostrar opciones fuera de existencia"
"Simple product images","Imágenes producto simple"
"Switch all media section","Cambiar toda la sección media"
"Switch main image","Cambiar imagen principal"
"Switch product images","Cambiar imágenes de producto"
"Template for media block. Leave empty to use default.","Plantilla para el bloque de media. Dejar vacío para valor por defecto."
"There was a problem uploading images","Hubo un problema subiendo imágenes"
Transformation,Transformación
"Transformation settings","Configuración de las transformaciones"
"Use Configuration for default store view","Usar la configuración por defecto de la vista de tienda"
"Use configurable product image if the simple one does not have images","Usar la imagen del configurable si las vistas simples no tienen"
"Use this image attribute","Usar este atributo de imagen"
"Use values like 100x80 or simply 100. Leave empty for no resize","Usar valores como 100x80 o solo 100. Dejarlo vacío para no reescalar"
[none],[ninguno]
Loading

0 comments on commit 8b94f62

Please sign in to comment.