magento 1.9 – Problem in creating Observer for Third Party Module?

I am using this extension for additional fees,

I did something else in this file in magento (app / code / local / Voronoy / ExtraFee / Model / Quote / Address / Total / Fee / Rule.php).

FYI -> The function on the right works.

I just created Observer for this extension:

My observer:

app / etc / modules / Gta_ExtraFeesRemove.xml



    
        
            true
            local
            
                
            
        
    

app / code / local / Gta / ExtraFeesRemove / etc / config.xml



    
        
        0.1.0
        
    
    
        
            
                
                    Gta_ExtraFeesRemove_Model_Quote_AddressTotal_Fee_Rule
                
            
        
    

app / code / local / Gta / ExtraFeesRemove / Model / Quote / AddressTotal / Fee / Rule.php

_calculator = Mage::getSingleton('voronoy_extrafee/salesRule_validator');
    }
    /**
     * @param Mage_Sales_Model_Quote_Address $address
     *
     * @return Mage_Sales_Model_Quote_Address_Total_Abstract
     */
    public function collect(Mage_Sales_Model_Quote_Address $address)
    {
        if (!Mage::helper('voronoy_extrafee')->isRuleExtraFeeEnabled()) {
            return $this;
        }
        parent::collect($address);
        $quote = $address->getQuote();
        $shipping_method = $quote->getShippingAddress()->getShippingMethod();
        $current_website = Mage::app()->getWebsite()->getId();

        ### log ###
        Mage::log("ExtraFeesWebsite -".$current_website." website checking part");
        ### log ###


        /* Flat Rate Condition Start*/
        if ($shipping_method != 'flatrate' && $current_website != 2) :
            $store = Mage::app()->getStore($quote->getStoreId());
            $this->_calculator->reset($address);

            $items = $this->_getAddressItems($address);
            if (!count($items)) {
                return $this;
            }

            ### log ###
            Mage::log("FlatRateCondition - ".$items."Flat Rate Condition ");
            ### log ###

            $this->_calculator->init($store->getWebsiteId(), $quote->getCustomerGroupId(), $quote->getCouponCode());
            $this->_calculator->initTotals($items, $address);

            $items = $this->_calculator->sortItemsByPriority($items);
            foreach ($items as $item) {
                if ($item->getParentItemId()) {
                    continue;
                }
                if ($item->getHasChildren() && $item->isChildrenCalculated()) {
                    foreach ($item->getChildren() as $child) {
                        $this->_calculator->process($child);
                        $this->_addAmount($child->getExtraFeeRuleAmount());
                        $this->_addBaseAmount($child->getBaseExtraFeeRuleAmount());
                    }
                } else {
                    $this->_calculator->process($item);
                    $this->_addAmount($item->getExtraFeeRuleAmount());
                    $this->_addBaseAmount($item->getBaseExtraFeeRuleAmount());
                }
            }
            $this->_calculator->prepareDescription($address);

            ### log ###
            Mage::log("FlatRateCondition - ".$items."Flat Rate Condition ");
            ### log ###

        endif;
        // / Flat Rate Condition End /
    }
    /**
     * Fetch Totals
     *
     * @param Mage_Sales_Model_Quote_Address $address
     *
     * @return Voronoy_ExtraFee_Model_Quote_Address_Total_Fee_Rule
     */
    public function fetch(Mage_Sales_Model_Quote_Address $address)
    {
        if (!Mage::helper('voronoy_extrafee')->isRuleExtraFeeEnabled()) {
            return $this;
        }
        $amount = $address->getExtraFeeRuleAmount();
        if ($address->getExtraFeeRuleDescription()) {
            $discountLabel = Mage::helper('voronoy_extrafee')->__(
                '%s (%s)',
                Mage::helper('voronoy_extrafee')->getExtraFeeRuleLabel(),
                $address->getExtraFeeRuleDescription()
            );
        } else {
            $discountLabel = Mage::helper('voronoy_extrafee')->getExtraFeeRuleLabel();
        }
        if ($amount > 0) {
            $address->addTotal(array(
                'code' => $this->getCode(),
                'title' => $discountLabel,
                'value' => $amount
            ));
        }
        return $this;
    }


}

The third party module observer does not work.

FYI -> Changes in core work.

design patterns: query and cache in the module versus having a specific class for cached data

I am currently rewriting one of my Discord bots that I also used as a practice to learn more about using databases.

Previously, I cached what I needed to use in the class where I was going to use that data.

For example:

class MyBotModule(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

        # Dictionary {guild_id: prefix: str}
        self._guild_prefixes = cachetools.LRUCache(max_size=256)

    async def get_guild_prefix(self, guild_id: int):
        """
        Prefix in this case might not change in a long time or change at all
        and it's going to be used a lot depending on command usage in the
        guild (server).
        """
        if guild_id not in self._guild_prefixes:
            prefix = await self.bot.database.fetchval(
                '''SELECT prefix FROM GuildSettings WHERE guild_id = $1''', 
                guild_id)

            self._guild_prefixes(guild_id) = prefix or self.bot.default_prefix

        return self._guild_prefixes(guild_id)

    async def get_guilds_news_feed(self):
        """
        Fetch from the database all the set up news feed for when we 
        need to send out news through their webhooks.
        There's no need to cache this data since it might be used 
        once or twice per day or every 3 - 4 days.
        """
        return await self.bot.database.fetch(
            '''SELECT guild_id, channel_id, webhook_id, webhook_token, role_id 
               FROM GuildNewsFeed''')

Advantage

  • More control over the columns that I consult from the database. I only cache what I need and preferably store them in a LRUCache.

Disadvantages

  • If I need that data elsewhere, I should check it again and cache it in that class, depending on what I want to do.
  • Have SQL queries throughout the code.

Then I came up with another method that consists of having classes that cache data from the database and also act as a "layer" between the bot and database commands.

class GuildSettings(object):
    def __init__(self, guild_id, bot, database):
        self.guild_id = guild_id
        self.bot = bot
        self.database = database

    async def populate(self):
        """
        We populate the GuildSettings object with data from the database
        and if it doesn't exist we just assume default data.
        """
        data = await self.bot.database.fetch(
            '''SELECT * FROM GuildSettings WHERE guild_id = $1''',
            guild_id
        )

        self.prefix = data('prefix') or self.bot.default_prefix

    async def get_prefix(self):
        """
        We request the guild prefix.
        """
        return self.prefix

    async def set_prefix(self, new_prefix):
        """
        If for any reason the guild (server) wants to update the prefix
        we update it on database and set the prefix variable of the class
        to the new value.
        """
        self.prefix = await self.database.fetchval(
            '''
            UPDATE GuildSettings SET prefix = $1
            WHERE guild_id = $2
            RETURNING prefix
            ''', new_prefix, self.guild_id
        )


# Then somehwere...

class MyBot(commands.AutoShardedBot):
    def __init__(self):
        self.guild_settings = {}
        # ... etc.

    async def start(self):
        self.database = await asyncpg.create_pool(**self.config('database'))
        # ... etc.

    async def get_guild_settings(self, guild_id: int):
        """
        Since all the modules have access to this class I can just
        get_guild_settings from innside them and use the data as I need.
        """
        if guild_id not in self.guild_settings:
            guild_settings = GuildSettings(guild_id, self, self.database)
            await guild_settings.populate()

            self.guild_settings(guild_id) = guild_settings

        return self.guild_settings(guild_id)

Advantage

  • Each module has access to get_guild_settings () making the cached data available throughout the bot and its modules if necessary.
  • Most of the code is in one place, I don't have SQL queries everywhere.

Disadvantages

  • I can't check exactly what I need. Or I check everything or end up having to write separate functions to get what I need.

  • When viewing the previous code block before this one, I need a method to get all the Guild news (get_guilds_news_feed ()), so here it gives me two options:

    • Since this is not cached, just run the queries on the modules that need them, after all, I will use them once until the next time I need them, which can happen in a few hours to a few days.

    • To have in my class GuildsSettings an additional function that requests the news source of the guild. Since I would be doing get_guild_settings of each guild the bot is in, if the guild is in cache, I would simply query the GuildNewsFeed table through get_news_feed () and call it done, but if the guild is not cached, Then I first need to get the data from the GuildSettings table through populate () and then query the GuildsNewsFeed table using get_news_feed ().
      This would exceed the point of caching the data of the most active guilds, since it would end up requesting the data of all the guilds only to obtain only their news source.

    # This would be on class GuildSettings(object)
    async def get_news_feed(self):
        return await self.bot.database.fetch(
            '''SELECT guild_id, channel_id, webhook_id, webhook_token, role_id 
               FROM GuildNewsFeed
            WHERE guild_id = $1''', self.guild_id)

Which approach is better considering the advantages and disadvantages? Is there a better approach on how to approach this method of organization / design?

How can I learn the Drupal theme (8) and module development?

How can I learn the Drupal theme (8) and module development? The | Web Hosting Talk

& # 39;);
var sidebar_align = & # 39; right & # 39 ;;
var content_container_margin = parseInt (& # 39; 350px & # 39;);
var sidebar_width = parseInt (& # 39; 330px & # 39;);
// ->

  1. How can I learn the Drupal theme (8) and module development?

    My next project requires that I develop a theme in drupal 8. Please guide. Thank you!


  2. Well, that's a sinister request. Simply go to the Drupal site and you will find many demonstrations to help you with your project. See https://www.drupal.org/documentation

    ProlimeHost – Dedicated server Hosting and KVM SSD VPS
    Three data center locations: Los Angeles, Denver and Singapore
    SuperMicro Hardware | Multiple bandwidth providers | Engineers on site 24/7


Similar threads

  1. Answers: 8

    Last post: 01-09-2004, 03:02 p.m.

  2. Answers: 5 5

    Last post: 05-08-2004, 09:36 p.m.

  3. Answers: 6 6

    Last post: 06/13/2004, 01:14 PM

  4. Answers: one

    Last post: 03-02-2004, 12:26 a. M.

  5. Answers: 8

    Last post: 06/19/2003, 12:39 PM

Publishing Permissions

  • you could not publish new threads
  • you could not post replies
  • you could not publish attachments
  • you could not edit your posts




Calling Microsoft Azure Queue from the custom Drupal module does not work

The use case is to invoke the code in the MS Azure queue when the external file is loaded into the Drupal physical storage of the file path to update as a message. The independent PHP interface works as expected with Azure Queue but not with the drupal application. Is there any work sample for this scenario? (Drupal 8x and MS Azure Queue SDK).

⭐ Start your own VPS hosting ⭐ Cheap VPS reseller with CPMC module WHMCS label Completely white label

WindowsVPS.Host It is configured with the objective of serving customers in an excellent way by providing quality service. We strongly believe in high quality standards and, therefore, will always find our services better than any other host in this industry. We understand the value of time and, therefore, our ordering process is very simple. Customers can choose servers of multiple price levels to suit their budgets.What is included?

Pure SSD drives
Microsoft Hyper-V virtualization
Dedicated resources, without overselling
99.9% uptime SLA incl. interruption compensation
Basic professional support 24/7
Fully white label interface
Set your own plans and prices
Intel Xeon Multi-Core processors on VPS nodes

=================================================== ==================

WINDOWS VPS RESELLER 1 – $ 50 / MONTH

Until 5 5 VPS
100GB SSD STORAGE
Not measured TO TRANSFER
5 5 IPs
1000mbit PORT
Windows license INCLUDED
VPS control panel for you and your client
Complete white label VPS

ORDER NOW

WINDOWS VPS RESELLER 2 – $ 80 / MONTH

Until 10 VPS
200GB SSD STORAGE
Not measured TO TRANSFER
10 IPs
1000mbit PORT
Windows license INCLUDED
VPS control panel for you and your client
Complete white label VPS

ORDER NOW

WINDOWS VPS RESELLER 3 – $ 150 / MONTH

Until 25 VPS
600GB SSD STORAGE
Not measured TO TRANSFER
25 IPs
1000mbit PORT
Windows license INCLUDED
VPS control panel for you and your client
Complete white label VPS

ORDER NOW

=================================================== ==================

8 – Import node with paragraphs using the Feeds module

I would like to import a node with several paragraphs, but I cannot make the font module work with paragraphs.

Here is a sample of xml data to load:


    unique_account_name
    unique_location_name
    
        
            unique_item_id_1
            sample title of item 1
        
        
            unique_item_id_2
            sample title of item 2
        
    

account_name Y location_name It will be created in a node. items/item will be created in the paragraph of the node.

Here is a sample of node fields

account_name = text field
location_name = text field
items = multiple paragraph

I tried to create a separate feed type for each one.

node import
paragraph import

I tried to create a content reference field in the paragraph feed, to refer to the paragraph in the node feed, but I still had no luck. I am also not sure how the main identification and the main field in the paragraph feed work.

Has anyone tried to do the same and make it work without writing a custom code?

magento2 – Magento 2.3.X Custom JavaScript module will not be loaded with require.js

I am building a module, and the HTML loads well, but the JS does not.
This is what I have:

  • Seller Name: NewShop
  • Module Name: HelloWorld

File: app / code / NewShop / HelloWorld / view / frontend / requirejs-config.js

var config = {
  map: {
    '*': {
      "helloworld": "NewShop_HelloWorld/js/newshop_helloworld",
    }
  }
};

File: app / code / NewShop / HelloWorld / view / frontend / web / js / newshop_helloworld.js

require(("helloworld"), function($) {
  console.log('Hello World!')
});

I cleaned the cache and everything. I cannot see the message from the console, although the module shows well.

magento2 – Magento 2 – How to make a dynamic drop-down menu in the custom payment module

I have a custom module that uses most of the sample form in the Magento 2 documents for a static form: https://devdocs.magento.com/guides/v2.3/howdoi/checkout/checkout_form.html

I need the selection box to complete with data from another administrator entry. I have the dynamic rows running, saving data, converting the serialized array and it is ready for input. The problem is that I can't get the values ​​in the field.

Here is my checkout_index_index.xml. I call the Options class to complete the values ​​in the selection box. The code for the class is most of the way:


    uiComponent
    custom-checkout-form
    
        
            0
            Vendor_Module/js/view/checkout/custom-checkout-form
            checkoutProvider
            
                Vendor_Module/checkout/custom-checkout-form
            
            
                
                    uiComponent
                    custom-checkout-form-fields
                    
                        
                            Magento_Ui/js/form/element/abstract
                            
                                customCheckoutForm
                                ui/form/field
                                ui/form/element/input
                            
                            checkoutProvider
                            customCheckoutForm.checkout_buyer_name
                            Buyer name
                            1
                        
                        
                            Magento_Ui/js/form/element/abstract
                            
                                customCheckoutForm
                                ui/form/field
                                ui/form/element/email
                                
                                    We will send an order confirmation to this email address
                                
                            
                            checkoutProvider
                            customCheckoutForm.checkout_buyer_email
                            Buyer email
                            2
                            
                                true
                            
                        
                        
                            Magento_Ui/js/form/element/abstract
                            
                                customCheckoutForm
                                ui/form/field
                                ui/form/element/input
                            
                            
                                true
                            
                            checkoutProvider
                            customCheckoutForm.checkout_purchase_order_no
                            Purchase order no.
                            3
                        
                        
                            Magento_Ui/js/form/element/abstract
                            
                                customCheckoutForm
                                ui/form/field
                                ui/form/element/input
                            
                            checkoutProvider
                            customCheckoutForm.checkout_goods_mark
                            Goods mark
                            4
                        



                        
                            Magento_Ui/js/form/element/select
                            
                              
                              customCheckoutForm
                              ui/form/field
                              ui/form/element/select
                            


                            VendorModuleModelOptionsOptions


                            
                            Please Select Value
                            checkoutProvider
                            customCheckoutForm.checkout_building_address
                            Select Building Address
                            2
                        



                        
                            Magento_Ui/js/form/element/abstract
                            
                                customCheckoutForm
                                ui/form/field
                                ui/form/element/textarea
                                15
                                2
                            
                            checkoutProvider
                            customCheckoutForm.checkout_comment
                            Comment
                            5
                        
                    
                
            
        
    


Here are my class options using default values ​​as proof:

namespace VendorModuleModelOptions;

use MagentoFrameworkDataOptionSourceInterface;
use MagentoFrameworkViewElementBlockArgumentInterface;

class Options implements OptionSourceInterface, ArgumentInterface
{
    /**
     * @return array
     */
    public function toOptionArray()
    {
        $options = (
            (
                'value' => '1',
                'label' => 'Option 1'
            ),
            (
                'value' => '2',
                'label' => 'Option 2'
            ),
            (
                'value' => '3',
                'label' => 'Option 3'
            ),
            (
                'value' => '4',
                'label' => 'Option 4'
            )
        );

        return $options;
    }
}

The drop-down box appears but there are no values ​​in the fields. What am I doing wrong?

Thank you!

Complex geometry: structure of the derivation module in the space of holomorphic functions.

Maybe this is well known, maybe not.
Leave
$ Omega subset mathbb {C} $ Be connected open and not empty.
It can be shown that yes
$ d in mathfrak {Der} ( mathcal {H} ( Omega)) $
(that is to say. $ d $ is a derivation of algebra
$ mathcal {H} ( Omega) $) and is continuous
for the topology of compact convergence
so $ d $ it's the way
$ d = varphi (z) frac {d} {dz} $.
This are my questions

  1. Can continuity be withdrawn?
  2. If yes, for what $ Omega $ ?
  3. can $ Omega $ be replaced by one
    multiple dimensional complex? (in
    particular, for these multiple, is
    there is a main derivation
    I like it $ frac {d} {dz} $ ?)

In particular, the third question is trivial
in the case of a connected compact collector
(why $ mathcal {H} ( Omega) = mathbb {C} 1 _ { Omega} $
by maximum principle).

Write the Elixir module with the Ejabberd Linux installer

I am new to ELixir Module Development, I have installed Ejabberd with the Linux installer. How do I start the development of the Elixir module?

Should I compile ejabberd from the source before developing the ELixir module?

I've been through tutorials https://blog.process-one.net/elixir-sips-ejabberd-with-elixir-part-1/

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive Proxies-free.com New Proxy Lists Every Day Proxies123
Proxy Sites Proxy Tunnels Proxy List Working Proxy Sites Hotproxysite Proxy Sites Proxy Sites Anonymous Proxy Anonymous Proxies Top-Proxies.co.uk http://www.proxysitesnow.com Proxy Servers Free Proxies Free Proxy List Proxy List Zoxy Proxy List PR liste all proxy sites More Proxies netgofree netgofree Hide-MyIp - The Best Proxy List American Proxy List www.proxylisty.com/proxylist Web Proxy Submit Proxies Updated Proxy List Updated Proxy List aproxy.org Bypass Proxy Sites Free Proxies List Evolving Critic Business Web Directory Free Proxy List iShortIt MyProxyList Online Proxies Go Proxies Need Proxies PrivateProxies Proxies4MySchool Proxies4Work Free Proxy List Free Proxy Sites ProxyInside Wiksa Proxy ProxyLister.org Free Proxy List ProxyNoid Proxy List Free Proxy List Proxy Sites Proxy TopList ProxyVille UK Proxy WebProxy List RatedProxy.com - Listing the best Web Proxies Free Proxy List SchoolProxiesList Stay Anonymous Proxy List The Power Of Ninja Proxy List UNubstruct Free proxy sites Free proxy sites