Strona główna forum Wsparcie Moduły i dodatki Subblock we własnym module

Subblock we własnym module

Wszystko o modułach i dodatkach dla Magento...

Post 5 sie 2013, o 16:40

Posty: 7
Gadu-Gadu: 0

Piszę moduł do magento i chcę zrobić pod bloki. Tak wygląda mój layout.xml:

<?xml version="0.1.0"?>
<layout>
<custommodule_index_index>
<reference name="content">
<block type="custommodule/custommodule" name="custommodule" template="custommodule/custommodule.phtml">
<block type="custommodule/custommodule_slider" name="custommodule_slider_nivo" template="custommodule/sliders/nivo.phtml" />
</block>
</reference>
</custommodule_index_index>
</layout>


no i sprawa wygląda tak, że ładuje mi się template custommodule/custommodule.phtml lecz gdy robię echo $this->getChildHtml('custommodule_slider_nivo'); to dostaję pusty tekst. Metoda custommodule $this->getChild('custommodule_slider_nivo'); zwraca false co robię źle? Blok Component_Custommodule_Block_Slider istnieje i dziedziczy po Mage_Core_Block_Template
Cache wyłączony

Subblock we własnym module

PostTeraz jest 1 maja 2024, o 08:58
Google

Posty: 427
Lokalizacja: Internet

Post 5 sie 2013, o 21:25

Posty: 1575
Gadu-Gadu: 0

Wydaje się że wszystko ok, rozumiem że w katalogu Block masz katalog Custommodule a w nim Slider.php ??
hosting-magento.pl / magentohosting.eu - szybki hosting Magento
https://www.mage24.pl/ - twój sklep Magento 2 w 5 minut

Post 6 sie 2013, o 08:37

Posty: 7
Gadu-Gadu: 0

tak, plik się tam znajduje i ma w sobie klasę Component_Custommodule_Block_Slider

Post 6 sie 2013, o 09:40

Posty: 1575
Gadu-Gadu: 0

to chyba nie bardzo, powinien mieć Custommodule_Block_Custommodule_Slider a wcześniejszy Custommodule_Block_Custommodule
hosting-magento.pl / magentohosting.eu - szybki hosting Magento
https://www.mage24.pl/ - twój sklep Magento 2 w 5 minut

Post 6 sie 2013, o 20:29

Posty: 7
Gadu-Gadu: 0

ok, zrobiłem w innym module i mam tak:

<?xml version="0.1.0"?>
<layout>
<multigallery_index_index>
<reference name="content">
<block type="multigallery/multigallery" name="multigallery" template="multigallery/multigallery.phtml">
<block type="multigallery/slider" name="multigallery_slider_nivo" template="multigallery/sliders/nivo.phtml" />
</block>
</reference>
</multigallery_index_index>
</layout>


no i tu multigallery/multigallery.phtml dałuje się pięknie
następnie mam klasy bloków BlueTree_MultiGallery_Block_Multigallery oraz BlueTree_MultiGallery_Block_Slider
a w szablonie (multigallery/multigallery.phtml) zrobiłem tak:
echo $this->getChildHtml('multigallery_slider_nivo');

ale kod z pliku multigallery/sliders/nivo.phtml się nie ładuje

Post 6 sie 2013, o 21:11

Posty: 1575
Gadu-Gadu: 0

BlueTree_MultiGallery_Block_Multigallery: BlueTree/MultiGallery/Block/Multigallery.php
BlueTree_MultiGallery_Block_Slider: BlueTree/MultiGallery/Block/Slider.php
zgadza się??

tak w ogóle na twoim miejscu bym zrezygnował z dużych liter w środku słowa w BlueTree i MultiGallery
hosting-magento.pl / magentohosting.eu - szybki hosting Magento
https://www.mage24.pl/ - twój sklep Magento 2 w 5 minut


Powrót do Moduły i dodatki