firegento / firegento-magesetup

MageSetup
GNU General Public License v3.0
120 stars 81 forks source link

Problem with Disable Tax Display on Category Pages as in FAQ #325

Closed Arn2014 closed 6 years ago

Arn2014 commented 6 years ago

Hi,

Based on your FAQ I've made a module to remove the Tax and Shipping costs display on my category pages but the result is not as expected:

app/etc/Modules/Mycustom_Taxremover.xml
app/code/local/Mycustom/
app/code/local/Mycustom/Taxremover/
app/code/local/Mycustom/Taxremover/etc/config.xml
app/code/local/Mycustom/Taxremover/Model/Observer.php
<?xml version="1.0"?>
<config>
    <modules>
        <Mycustom_Taxremover>
            <codePool>local</codePool>
            <active>true</active>  
        </Mycustom_Taxremover>
    </modules>
</config>

this is my config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Mycustom_Taxremover>
            <version>0.0.1</version>
        </Mycustom_Taxremover>
    </modules>
    <global>
        <models>
            <mycustom_taxremover>
                <class>Mycustom_Taxremover_Model</class>
            </mycustom_taxremover>
        </models>
    </global>
    <frontend>
                <events>
                        <magesetup_after_product_price>
                          <observers>
                                <mycustom_taxremover>
                                <type>singleton</type>
                                    <class>mycustom_taxremover/observer</class>
                                    <method>removeMageSetupPriceHint</method>
                                </mycustom_taxremover>
                           </observers>
                </magesetup_after_product_price>
            </events>
       </frontend>
    </config>

This is the Observer as suggested in the FAQ..

<?php
/**
     * @mageEvent magesetup_after_product_price
     * 
     * @param type $event 
      * FIXED with adding class
     */
class mycustom_taxremover_model_observer
{

    public function removeMageSetupPriceHint($event)
    {
        if(in_array('catalog_category_view', Mage::app()->getLayout()->getUpdate()->getHandles()) || in_array('catalogsearch_result_index', Mage::app()->getLayout()->getUpdate()->getHandles()))
        {
            $obj = $event->getHtmlObj();
            $obj->setPrefix('');
            $obj->setHtml('');
            $obj->setSuffix('');
        }
    }
}

?>

Seems like the Observer creates issues with:

Mage::app()->getLayout()->getUpdate()->getHandles()) 

Any further advice / faq update is much appreciated!

Schrank commented 6 years ago

If only one product is shown and the price is missing you have an error on your page.

Please turn on display_errors and check.

Arn2014 commented 6 years ago

rundown of error shows a 500 internal server error on:

Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /home/hidden/domains/hidden.com/public_html/app/code/local/Mycustom/Taxremover/Model/Observer.php on line 7

which is: public function removeMageSetupPriceHint($event)

sprankhub commented 6 years ago

Seems you are missing a class definition...

Schrank commented 6 years ago

An alternative to the observer is, to just add display: none; to your CSS.

The class around the infos is: .tax-details-box

Arn2014 commented 6 years ago

Thank for the css suggestion but i need clean SEO friendly code.. I already use the css: display none option for over a year but it's messing up my keyword density with words as zzgl. versandkosten uzw...

i prefer the observer method:

class Mycustom_Taxremover_Observer extends ???

Arn2014 commented 6 years ago

fixed..

class mycustom_taxremover_model_observer

Arn2014 commented 6 years ago

no extend needed.. topic may be closed..faq can be updated..;)

@Schrank @sprankhub Thanks for the support!