0

I have created a custom module in order to add some functions to only configurable products page , I saw that I have configurable.phtml so i tried to create configurable_1.phtml and make my changes there do i need to have a controller for this? I don't even know if I need that or not because I don't need to use any routers for that... but I need to have more functions on configurable products in local folder I created the module as fallow:

enter image description here

<config> 
    <modules>
        <Scosche_ColorSwitch>
            <version>0.0.1</version>
        </Scosche_ColorSwitch>
    </modules>
    <global>
        <blocks>
            <scosche_colorswitch>
                <class>Scosche_Block_Product_View</class>
            </scosche_colorswitch>
        </blocks>
    </global>
</config>

also module is enabled I can see it in admin panel.

in catalog.xml I have this block for configurable.phtml:

 <reference name="product.info.options.wrapper">
            <block type="catalog/product_view_type_configurable" name="product.info.options.configurable" as="options_configurable" before="-" template="catalog/product/view/type/options/configurable.phtml"/>
        </reference>

as a solution I did this:

   <reference name="product.info.options.wrapper">
         <remove name="product.info.options.configurable"></remove>
      <block type="catalog/product_view_type_configurable" name="product.info.options.configurable.scosche" as="options_configurable" before="-" template="catalog/product/view/type/options/configurable_1.phtml"/>
     </reference>

It is working but I do not want to use the type of catalog/product_view_type_configurable I want the block type to come from my custom block that I created which is:

<block type="scosche_colorswitch/product_view" name="product.info.options.configurable.scosche" as="options_configurable" before="-" template="catalog/product/view/type/options/configurable_1.phtml"/>

Unfortunately when I do this it does not work.

0

Not sure if this will fix your entire problem, but there's at least a small problem with your config.xml, according to the error log:

<config> 
    <modules>
        <Scosche_ColorSwitch>
            <version>0.0.1</version>
        </Scosche_ColorSwitch>
    </modules>
    <global>
        <blocks>
            <scosche_colorswicth>
                <class>Scosche_Block_Product_View</class>
            </scosche_colorswitch>
        </blocks>
    </global>
</config>

The opening tag contains scosche_colorswicth, which should be scosche_colorswitch.

1
  • Thank you I fixed that but still I have the problem
    – Nickool
    Aug 14 '15 at 19:36
0

You can use Specific configurable product Tag <PRODUCT_TYPE_configurable> to append and remove block using layout xml.

<PRODUCT_TYPE_configurable>
           <reference name="product.info.options.wrapper.bottom">
                <action method="unsetChild"><name>product.info.sharing</name></action>
                <action method="unsetChild"><name>product.info.addto</name></action>
                <action method="append"><block>product.info.addto.options</block></action>                
            </reference>
</PRODUCT_TYPE_configurable> 

this is just an example you can give any reference tag name which is available in product detail page to apply this change in your custom theme

hope this will sure help you to get proper solution.

3
  • actually the reference which I was telling was the type configurable but the thing is when I unset the previous child and assign the new one it does not work I can just rename the phtml file to new file and with that it works but I don't want to do it. not sure what to do.
    – Nickool
    Aug 17 '15 at 17:56
  • also instead of unsetchild I used <remove name="product.info.options.configurable"></remove> and it worked
    – Nickool
    Aug 17 '15 at 18:06
  • I updated my question
    – Nickool
    Aug 17 '15 at 18:39
0

Finally I solved my problem, the thing is the defenition of the Block class was wrong here is the right way to do it in config.xml(I renamed colorswitch to attributeselector):

enter image description here

 <global>
        <helpers>
  <attributeselector>
      <class>Scosche_AttributeSelector_Helper</class>
  </attributeselector>
</helpers>
        <blocks>
            <scosche_attributeselector>
                <class>Scosche_AttributeSelector_Block</class>
            </scosche_attributeselector>
        </blocks>
    </global>

then in the catalog.xml I did this:

<PRODUCT_TYPE_configurable translate="label" module="catalog">
         //some reference and other blocks
            <reference name="product.info.options.wrapper">
                <block type="catalog/product_view_type_configurable" name="product.info.options.configurable" as="options_configurable" before="-" template="catalog/product/view/type/options/configurable.phtml"/>
            </reference>
             <reference name="product.info.options.wrapper">
                 <remove name="product.info.options.configurable"></remove>
              <block type="scosche_attributeselector/product_view" name="product.info.options.configurable.scosche" as="options_configurable" before="-" template="catalog/product/view/type/options/configurable_1.phtml"/>
             </reference>
        </PRODUCT_TYPE_configurable>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.