0

I created an extension to show the price split in parcels on product page but it only renders on configurable products not on simple products. Here are all the files of my extension:

/app/code/local/Newer7/Parcelamento/etc/config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Newer7_Parcelamento>
            <version>0.1.0</version>
        </Newer7_Parcelamento>
    </modules>
    <frontend>
        <routers>
            <parcelamento>
                <use>standard</use>
                    <args>
                        <module>Newer7_Parcelamento</module>
                        <frontName>parcelamento</frontName>
                    </args>
            </parcelamento>
        </routers>
        <layout>
            <updates>
                <parcelamento>
                    <file>newer7_parcelamento.xml</file>
                </parcelamento>
            </updates>
        </layout>
    </frontend>
    <global>
        <helpers>
            <parcelamento>
                <class>Newer7_Parcelamento_Helper</class>
            </parcelamento>
        </helpers>
    </global>
    <adminhtml>
        <acl>
            <resources>
                <admin>
                    <children>
                        <system>
                            <children>
                                <config>
                                    <children>
                                        <parcelamento>
                                            <title>Newer7 Parcelamento</title>
                                            <sort_order>70</sort_order>
                                        </parcelamento>
                                    </children>
                                </config>
                            </children>
                        </system>
                    </children>
                </admin>
            </resources>
        </acl>
    </adminhtml>
        <default>
            <parcelamento>
                <parcelamento_general>
                    <enabled>0</enabled>
                    <parcelamento_jquery>1</parcelamento_jquery>
                    <parcelamento_xparcelas>0</parcelamento_xparcelas>
                    <parcelamento_desconto>0</parcelamento_desconto>
                    <parcelamento_minimo>0</parcelamento_minimo>                                        
                </parcelamento_general>
            </parcelamento>
        </default>
</config>

/app/code/local/Newer7/Parcelamento/etc/system.xml

<?xml version="1.0"?>
<config>
    <tabs>
        <parcelamento translate="label" module="parcelamento">
            <label>Newer7</label>
            <sort_order>110</sort_order>
        </parcelamento>
    </tabs>
    <sections>
        <parcelamento translate="label" module="parcelamento">
            <class>separator-top</class>
            <label>Parcelamento</label>
            <tab>parcelamento</tab>
            <sort_order>100</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
            <groups>
                <parcelamento_general translate="label">
                    <label>Configurações</label>
                    <frontend_type>text</frontend_type>
                    <sort_order>10</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <enabled translate="label">
                        <label>Ativar</label>
                        <frontend_type>select</frontend_type>
                        <source_model>adminhtml/system_config_source_yesno</source_model>
                        <sort_order>1</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                        <comment>Selecione para ativar/desativar o módulo.</comment>
                        </enabled>
                        <parcelamento_jquery translate="label">
                        <label>Habilitar jQuery</label>
                        <frontend_type>select</frontend_type>
                        <source_model>adminhtml/system_config_source_enabledisable</source_model>
                        <sort_order>2</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                        <comment>Desabilite se estiver sendo carregado por outro módulo.</comment>
                        </parcelamento_jquery>
                        <parcelamento_xparcelas translate="label">
                        <label>Quantidade de parcelas</label>
                        <frontend_type>text</frontend_type>
                        <sort_order>3</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                        <comment>Digite a quantidade máxima de parcelas.</comment>
                        </parcelamento_xparcelas>
                        <parcelamento_desconto translate="label">
                        <label>Desconto à vista</label>
                        <frontend_type>text</frontend_type>
                        <sort_order>4</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                        <comment>Digite o valor para o desconto à vista.</comment>
                        </parcelamento_desconto>
                        <boleto_desconto translate="label">
                        <label>Desconto à vista</label>
                        <frontend_type>text</frontend_type>
                        <sort_order>5</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                        <comment>Digite o valor para o desconto no boleto.</comment>
                        </boleto_desconto>
                        <parcelamento_minimo translate="label">
                        <label>Parcela Mínima</label>
                        <frontend_type>text</frontend_type>
                        <sort_order>6</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                        <comment>Digite o valor mínimo de cada parcela.</comment>
                        </parcelamento_minimo>
                    </fields>
                </parcelamento_general>
            </groups>
        </parcelamento>
    </sections>
</config>

/app/design/frontend/base/default/layout/newer7_parcelamento.xml

<?xml version="1.0"?>
<layout version="0.1.0">
<default>
    <reference name="head">
        <action method="addItem" ifconfig="parcelamento/parcelamento_general/parcelamento_jquery"><type>js</type><name>newer7_parcelamento/jquery-1.11.0.js</name></action>
    </reference>
</default>
<catalog_product_view>
    <reference name="product.info">
        <block type="catalog/product_view" name="valores" as="valores" template="newer7_parcelamento/valores.phtml" />
    </reference>
</catalog_product_view>
</layout>

I'm using RWD package. Does anyone can give me a light what is going on? Thanks!

  • I guess you are calling your block with some <?php echo $this->getChildHtml('valores') ?>. If I am right, could you tell us in which template and where in this template you are doing this call ? – Julien Loizelet Jan 16 at 15:39
  • Julien, thanks for the help! You were totaly right and there was a condition to call this block to load only configurable products! I removed the condition and it worked. Thanks! – Filipe Marques Jan 16 at 15:42
0

Well, finally I've already find out what was going on:

I had to insert a snippet on the view.phtml to call the block but there was a condition there:

<?php if($_product->getTypeId() == 'configurable' && Mage::getStoreConfig('parcelamento/parcelamento_general/enabled')): ?>

<?php echo $this->getChildHtml("valores"); ?>

<?php endif; ?>

I removed

$_product->getTypeId() == 'configurable' &&

from the condition and it worked.

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.