PSD-Tutorials.de
Forum für Design, Fotografie & Bildbearbeitung
Tutkit
Agentur
Hilfe
Kontakt
Start
Forum
Aktuelles
Besonderer Inhalt
Foren durchsuchen
Tutorials
News
Anmelden
Kostenlos registrieren
Aktuelles
Suche
Suche
Nur Titel durchsuchen
Von:
Menü
Anmelden
Kostenlos registrieren
App installieren
Installieren
JavaScript ist deaktiviert. Für eine bessere Darstellung aktiviere bitte JavaScript in deinem Browser, bevor du fortfährst.
Du verwendest einen veralteten Browser. Es ist möglich, dass diese oder andere Websites nicht korrekt angezeigt werden.
Du solltest ein Upgrade durchführen oder einen
alternativen Browser
verwenden.
Antworten auf deine Fragen:
Neues Thema erstellen
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
PHP, Javascript, jQuery, Ajax, nodeJS, MySQL...
php Syntax-error
Beitrag
<blockquote data-quote="Tease" data-source="post: 1674205" data-attributes="member: 179934"><p><strong>AW: php Syntax-error</strong></p><p></p><p></p><p>Danke für deine Antwort!</p><p></p><p>Ich habe nun alle die mitendrin im Code stehen gelöscht, aber nun habe ich wieder die ursprüngliche (nur in einer anderen Zeile) Fehlermeldung.</p><p></p><p>Hier der Code:</p><p>[PHP]</p><p><?php</p><p></p><p>class TM_Featured_Block_Featured extends Mage_Catalog_Block_Product_Abstract</p><p>{</p><p> protected $_productsCount = null;</p><p></p><p> const DEFAULT_PRODUCTS_COUNT = 5;</p><p> </p><p> protected function _beforeToHtml()</p><p> {</p><p> $collection = Mage::getResourceModel('catalog/product_collection');</p><p> </p><p> Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);</p><p> Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);</p><p> </p><p> $collection = $this->_addProductAttributesAndPrices($collection)</p><p> ->addStoreFilter(Mage::app()->getStore()->getId())</p><p> ->addAttributeToFilter('featured', array('Yes' => true))</p><p> ->setPageSize($this->getProductsCount())</p><p> ->setCurPage(1);</p><p></p><p> $this->addPriceBlockType('bundle', 'bundle/catalog_product_price', 'bundle/catalog/product/price.phtml');</p><p> $this->setProductCollection($collection);</p><p> </p><p> return parent::_beforeToHtml();</p><p> }</p><p> </p><p> public function setProductsCount($count)</p><p> {</p><p> $this->_productsCount = $count;</p><p> return $this;</p><p> }</p><p></p><p> public function getProductsCount()</p><p> {</p><p> if (null === $this->_productsCount) {</p><p> $this->_productsCount = self::DEFAULT_PRODUCTS_COUNT;</p><p> }</p><p> return $this->_productsCount;</p><p> }</p><p>}</p><p></p><p>class TM_Featured_Block_Featured extends Mage_Catalog_Block_Product_Abstract</p><p>{</p><p> protected $_productsCount = null;</p><p></p><p> const DEFAULT_PRODUCTS_COUNT = 5;</p><p> </p><p> protected function _beforeToHtml()</p><p> {</p><p> $collection = Mage::getResourceModel('catalog/product_collection');</p><p> </p><p> Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);</p><p> Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);</p><p> </p><p> $collection = $this->_addProductAttributesAndPrices($collection)</p><p> ->addStoreFilter(Mage::app()->getStore()->getId())</p><p> ->addAttributeToFilter('featured', array('Yes' => true))</p><p> ->setPageSize($this->getProductsCount())</p><p> ->setCurPage(1);</p><p></p><p> $this->addPriceBlockType('bundle', 'bundle/catalog_product_price', 'bundle/catalog/product/price.phtml');</p><p> $this->setProductCollection($collection);</p><p> </p><p> return parent::_beforeToHtml();</p><p> }</p><p> </p><p> public function setProductsCount($count)</p><p> {</p><p> $this->_productsCount = $count;</p><p> return $this;</p><p> }</p><p></p><p> public function getProductsCount()</p><p> {</p><p> if (null == $this->_productsCount) {</p><p> $this->_productsCount = self::DEFAULT_PRODUCTS_COUNT;</p><p> }</p><p> return $this->_productsCount;</p><p> }</p><p>}</p><p></p><p>class TM_Featured_Block_Featured extends Mage_Catalog_Block_Product_Abstract</p><p>{</p><p> protected $_productsCount = null;</p><p></p><p> const DEFAULT_PRODUCTS_COUNT = 5;</p><p> </p><p> protected function _beforeToHtml()</p><p> {</p><p> $collection = Mage::getResourceModel('catalog/product_collection');</p><p> </p><p> Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);</p><p> Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);</p><p> </p><p> $collection = $this->_addProductAttributesAndPrices($collection)</p><p> ->addStoreFilter(Mage::app()->getStore()->getId())</p><p> ->addAttributeToFilter('featured', array('Yes' => true))</p><p> ->setPageSize($this->getProductsCount())</p><p> ->setCurPage(1);</p><p></p><p> $this->addPriceBlockType('bundle', 'bundle/catalog_product_price', 'bundle/catalog/product/price.phtml');</p><p> $this->setProductCollection($collection);</p><p> </p><p> return parent::_beforeToHtml();</p><p> }</p><p> </p><p> public function setProductsCount($count)</p><p> {</p><p> $this->_productsCount = $count;</p><p> return $this;</p><p> }</p><p></p><p> public function getProductsCount()</p><p> {</p><p> if (null == $this->_productsCount) {</p><p> $this->_productsCount = self::DEFAULT_PRODUCTS_COUNT;</p><p> }</p><p> return $this->_productsCount;</p><p> }</p><p>}</p><p></p><p>class TM_Featured_Block_Featured extends Mage_Catalog_Block_Product_Abstract</p><p>{</p><p> protected $_productsCount = null;</p><p></p><p> const DEFAULT_PRODUCTS_COUNT = 5;</p><p> </p><p> protected function _beforeToHtml()</p><p> {</p><p> $collection = Mage::getResourceModel('catalog/product_collection');</p><p> </p><p> Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);</p><p> Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);</p><p> </p><p> $collection = $this->_addProductAttributesAndPrices($collection)</p><p> ->addStoreFilter(Mage::app()->getStore()->getId())</p><p> ->addAttributeToFilter('featured', array('Yes' => true))</p><p> ->setPageSize($this->getProductsCount())</p><p> ->setCurPage(1);</p><p></p><p> $this->addPriceBlockType('bundle', 'bundle/catalog_product_price', 'bundle/catalog/product/price.phtml');</p><p> $this->setProductCollection($collection);</p><p> </p><p> return parent::_beforeToHtml();</p><p> }</p><p> </p><p> public function setProductsCount($count)</p><p> {</p><p> $this->_productsCount = $count;</p><p> return $this;</p><p> }</p><p></p><p> public function getProductsCount()</p><p> {</p><p> if (null == $this->_productsCount) {</p><p> $this->_productsCount = self::DEFAULT_PRODUCTS_COUNT;</p><p> }</p><p> return $this->_productsCount;</p><p> }</p><p>}</p><p></p><p>class TM_Featured_Block_Featured extends Mage_Catalog_Block_Product_Abstract</p><p>{</p><p> protected $_productsCount = null;</p><p></p><p> const DEFAULT_PRODUCTS_COUNT = 5;</p><p> </p><p> protected function _beforeToHtml()</p><p> {</p><p> $collection = Mage::getResourceModel('catalog/product_collection');</p><p> </p><p> Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);</p><p> Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);</p><p> </p><p> $collection = $this->_addProductAttributesAndPrices($collection)</p><p> ->addStoreFilter(Mage::app()->getStore()->getId())</p><p> ->addAttributeToFilter('featured', array('Yes' => true))</p><p> ->setPageSize($this->getProductsCount())</p><p> ->setCurPage(1);</p><p></p><p> $this->addPriceBlockType('bundle', 'bundle/catalog_product_price', 'bundle/catalog/product/price.phtml');</p><p> $this->setProductCollection($collection);</p><p> </p><p> return parent::_beforeToHtml();</p><p> }</p><p> </p><p> public function setProductsCount($count)</p><p> {</p><p> $this->_productsCount = $count;</p><p> return $this;</p><p> }</p><p></p><p> public function getProductsCount()</p><p> {</p><p> if (null == $this->_productsCount) {</p><p> $this->_productsCount = self::DEFAULT_PRODUCTS_COUNT;</p><p> }</p><p> return $this->_productsCount;</p><p> }</p><p>}</p><p>?></p><p>[/PHP]</p><p></p><p>und hier die darus resultierende Meldung vom Browser:</p><p><strong>Fatal error</strong>: Cannot redeclare class TM_Featured_Block_Featured in <strong>/var/www/app/code/local/TM/Featured/Block/Featured.php</strong> on line <strong>81</strong></p><p></p><p>Ich vermute, dass ich nun wieder etwas zuviel gelöscht habe, kann aber nicht sagen, was.</p><p></p><p>Danke, für's zeitnehmehmen!</p><p></p><p>Und ja, ich wer mir gleichzeitig auch den Link mit den php_Grundlagen durchsehen, nur dauert das halt bis man da mal durchblickt, deswegen wäre ich euch dankbar, wenn ihr mir da weiterhelft! Aber Danke auch für den Link! ;-)</p></blockquote><p></p>
[QUOTE="Tease, post: 1674205, member: 179934"] [b]AW: php Syntax-error[/b] Danke für deine Antwort! Ich habe nun alle die mitendrin im Code stehen gelöscht, aber nun habe ich wieder die ursprüngliche (nur in einer anderen Zeile) Fehlermeldung. Hier der Code: [PHP] <?php class TM_Featured_Block_Featured extends Mage_Catalog_Block_Product_Abstract { protected $_productsCount = null; const DEFAULT_PRODUCTS_COUNT = 5; protected function _beforeToHtml() { $collection = Mage::getResourceModel('catalog/product_collection'); Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection); Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection); $collection = $this->_addProductAttributesAndPrices($collection) ->addStoreFilter(Mage::app()->getStore()->getId()) ->addAttributeToFilter('featured', array('Yes' => true)) ->setPageSize($this->getProductsCount()) ->setCurPage(1); $this->addPriceBlockType('bundle', 'bundle/catalog_product_price', 'bundle/catalog/product/price.phtml'); $this->setProductCollection($collection); return parent::_beforeToHtml(); } public function setProductsCount($count) { $this->_productsCount = $count; return $this; } public function getProductsCount() { if (null === $this->_productsCount) { $this->_productsCount = self::DEFAULT_PRODUCTS_COUNT; } return $this->_productsCount; } } class TM_Featured_Block_Featured extends Mage_Catalog_Block_Product_Abstract { protected $_productsCount = null; const DEFAULT_PRODUCTS_COUNT = 5; protected function _beforeToHtml() { $collection = Mage::getResourceModel('catalog/product_collection'); Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection); Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection); $collection = $this->_addProductAttributesAndPrices($collection) ->addStoreFilter(Mage::app()->getStore()->getId()) ->addAttributeToFilter('featured', array('Yes' => true)) ->setPageSize($this->getProductsCount()) ->setCurPage(1); $this->addPriceBlockType('bundle', 'bundle/catalog_product_price', 'bundle/catalog/product/price.phtml'); $this->setProductCollection($collection); return parent::_beforeToHtml(); } public function setProductsCount($count) { $this->_productsCount = $count; return $this; } public function getProductsCount() { if (null == $this->_productsCount) { $this->_productsCount = self::DEFAULT_PRODUCTS_COUNT; } return $this->_productsCount; } } class TM_Featured_Block_Featured extends Mage_Catalog_Block_Product_Abstract { protected $_productsCount = null; const DEFAULT_PRODUCTS_COUNT = 5; protected function _beforeToHtml() { $collection = Mage::getResourceModel('catalog/product_collection'); Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection); Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection); $collection = $this->_addProductAttributesAndPrices($collection) ->addStoreFilter(Mage::app()->getStore()->getId()) ->addAttributeToFilter('featured', array('Yes' => true)) ->setPageSize($this->getProductsCount()) ->setCurPage(1); $this->addPriceBlockType('bundle', 'bundle/catalog_product_price', 'bundle/catalog/product/price.phtml'); $this->setProductCollection($collection); return parent::_beforeToHtml(); } public function setProductsCount($count) { $this->_productsCount = $count; return $this; } public function getProductsCount() { if (null == $this->_productsCount) { $this->_productsCount = self::DEFAULT_PRODUCTS_COUNT; } return $this->_productsCount; } } class TM_Featured_Block_Featured extends Mage_Catalog_Block_Product_Abstract { protected $_productsCount = null; const DEFAULT_PRODUCTS_COUNT = 5; protected function _beforeToHtml() { $collection = Mage::getResourceModel('catalog/product_collection'); Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection); Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection); $collection = $this->_addProductAttributesAndPrices($collection) ->addStoreFilter(Mage::app()->getStore()->getId()) ->addAttributeToFilter('featured', array('Yes' => true)) ->setPageSize($this->getProductsCount()) ->setCurPage(1); $this->addPriceBlockType('bundle', 'bundle/catalog_product_price', 'bundle/catalog/product/price.phtml'); $this->setProductCollection($collection); return parent::_beforeToHtml(); } public function setProductsCount($count) { $this->_productsCount = $count; return $this; } public function getProductsCount() { if (null == $this->_productsCount) { $this->_productsCount = self::DEFAULT_PRODUCTS_COUNT; } return $this->_productsCount; } } class TM_Featured_Block_Featured extends Mage_Catalog_Block_Product_Abstract { protected $_productsCount = null; const DEFAULT_PRODUCTS_COUNT = 5; protected function _beforeToHtml() { $collection = Mage::getResourceModel('catalog/product_collection'); Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection); Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection); $collection = $this->_addProductAttributesAndPrices($collection) ->addStoreFilter(Mage::app()->getStore()->getId()) ->addAttributeToFilter('featured', array('Yes' => true)) ->setPageSize($this->getProductsCount()) ->setCurPage(1); $this->addPriceBlockType('bundle', 'bundle/catalog_product_price', 'bundle/catalog/product/price.phtml'); $this->setProductCollection($collection); return parent::_beforeToHtml(); } public function setProductsCount($count) { $this->_productsCount = $count; return $this; } public function getProductsCount() { if (null == $this->_productsCount) { $this->_productsCount = self::DEFAULT_PRODUCTS_COUNT; } return $this->_productsCount; } } ?> [/PHP] und hier die darus resultierende Meldung vom Browser: [B]Fatal error[/B]: Cannot redeclare class TM_Featured_Block_Featured in [B]/var/www/app/code/local/TM/Featured/Block/Featured.php[/B] on line [B]81[/B] Ich vermute, dass ich nun wieder etwas zuviel gelöscht habe, kann aber nicht sagen, was. Danke, für's zeitnehmehmen! Und ja, ich wer mir gleichzeitig auch den Link mit den php_Grundlagen durchsehen, nur dauert das halt bis man da mal durchblickt, deswegen wäre ich euch dankbar, wenn ihr mir da weiterhelft! Aber Danke auch für den Link! ;-) [/QUOTE]
Bilder bitte
hier hochladen
und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Zitate einfügen…
Authentifizierung
Wenn ▲ = 7, ▼ = 3, ◇ = 2 und die Summe von ▲ und ▼ durch ◇ geteilt wird, was ist das Ergebnis?
Antworten
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
PHP, Javascript, jQuery, Ajax, nodeJS, MySQL...
php Syntax-error
Oben