Questions tagged [methods]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
33 views

Magento 2 Custom Payment Method: Capture Function Error Handling

When using a custom payment method, the placeOrder function submits the information to the capture function in the Model file of the module. If an error happens there, is there a way to return that ...
user avatar
2 votes
1 answer
339 views

What is final methods in Magento2?

When I read the limitation of Plugin in Magento2, the official devdocs mentions that, Plugins can not be used on following: Final methods Final classes Non-public methods Class methods (such as ...
user avatar
  • 1,090
0 votes
3 answers
230 views

What mean this function in magento 2

I saw a function declared like this below. <?php public function getFirstName():string { return $this->firstName(); } why this :string is used and when I should use this.
user avatar
  • 828
0 votes
1 answer
132 views

Method 'delete' is deprecated

phpstorm IDE saing that method 'delete' is deprecated. Is there any alternatives? public function deleteVoucherStatus($entity_id) { $voucherStatus = $this->voucherStatusModelFactory-&...
user avatar
6 votes
2 answers
1k views

Magento 2: EQP Error Possible useless method

I'm doing EQP of custom module then its shows error as below: Possible useless method overriding detected You can check this screenshot error is on line no. 20 Let me know if anyone has a ...
user avatar
1 vote
2 answers
2k views

Magento2 : How to get active payment methods list store wise

I want to get all active payment method list store wise. I have two store -- store indstore -- store usstore And i have set payment methods for only indstore and if i try to get all active ...
user avatar
1 vote
1 answer
22 views

What are correct methods to implement in a repository?

What methods is a repository required to implement? The documentation (https://devdocs.magento.com/guides/v2.3/extension-dev-guide/service-contracts/design-patterns.html) states that you need to ...
user avatar
0 votes
2 answers
365 views

How can we check context object list for observer in magento2

I want to know context object list which we can use methods directly from $context object in Observer. Just like in below URl. Magento2 – Use Defined Methods from Context Object URL:- https://webkul....
user avatar
0 votes
1 answer
458 views

Create custom payment gateway in Magento 2?

Which class we need to extends,implement interface and method use when create a custom payment gateway.
user avatar
  • 1,214
2 votes
3 answers
383 views

Difference between load() and get() methods

While going through the Magento code I have been seeing a lot of instances of: $objectName->load($foo) or $objectName->get($foo) and I was wondering, what is the difference between the 'load'...
user avatar
  • 99
0 votes
0 answers
77 views

Magento2 Custom api with Two methods

I followed below link to create custom api. https://belvg.com/blog/how-to-create-custom-api-in-magento-2.html. Where 2 methods are written in that first method is working but calling rest/V1/test1 ...
user avatar
  • 1,739
0 votes
2 answers
916 views

Save method is not working for products

I want to resave all products programmatically. So I am trying to use the below code to achieve it. But the save method is not working in it. I have placed the code in the root directory of my Magento ...
user avatar
0 votes
1 answer
531 views

How does '@method Address setCollectShippingRates(int $value)' work?

Magento 2.2, Clsss 'Magento\Quote\Model\Quote\Address'. I cannot find body of method 'setCollectShippingRates()'. <?php namespace Magento\Quote\Model\Quote; /** * Sales Quote address model * ...
user avatar
0 votes
1 answer
1k views

Custom Payment Methods not showing on checkout

Preconditions Magento 2.1.9 PHP 5.6 Ubuntu 16 Expected result Many choices payment method Actual result here is log exception.log: [2018-03-28 19:38:24] main.CRITICAL: exception 'Exception' with ...
user avatar
1 vote
0 answers
23 views

How to create soap api method to sign up in magento website from facebook account?

I want to create a soap api method for sign up from facebook login details. In which I will use user facebook id and password from user and create magento website sign up from this detail
user avatar
1 vote
1 answer
1k views

magento 2 unable to set the values for product collection using service contract from custom module?

I am trying to form a custom format for product collection(getList) using service-contract concept in magento 2 i am able to add keys but i am unable to add values to the response object can you ...
user avatar
11 votes
1 answer
1k views

How to override a static method in Magento2

Plugin Interceptors and overriding with preference does not work on static methods. Need to override getOptionArray method in Magento\Catalog\Model\Product\Visibility to return a custom visibility ...
user avatar
4 votes
1 answer
3k views

Magento 2 multiple shipping options on checkout

Is there a way to create something like: Free Shipping 3 days delivery (+5£) Next day Delivery (+9£) so the customer can choose on checkout? Is there a module to do this?
user avatar
  • 135
1 vote
1 answer
1k views

CURL request using DELETE method in Magento 2

I am trying to call a curl request for delete method using Magento\Framework\HTTP\Client\Curl.php. In this class makeRequest method is responsible for sending curl request. But as I can see that ...
user avatar
1 vote
2 answers
314 views

$this->getOrders()

I am using Magento 1.7. In recent.phtml under app/design/frontend/default/custom_theme/template/sales/order, there is the following call: $_orders = $this->getOrders(); and later on $_orders is ...
user avatar
  • 366
0 votes
1 answer
78 views

Empty getAddToCompareUrl only in guest mode

I have this variable $_compareUrl=$this->getAddToCompareUrl($_product) to get compare url but this is empty in guest mode, only when i signed in magento it's not empty. I recently migrate from ...
user avatar
0 votes
1 answer
23 views

Repositories and Methods

Does anybody have a link where I can find a list of all Magento 2.1 (or Magento 2) repositories and their methods? I tried to find this in Magento Devdocs and can't seem to find anything. Maybe I am ...
user avatar
  • 1
0 votes
1 answer
53 views

Are commented methods good practice?

When looking inside Magento 2 core code, I found some commented methods, as it was in Magento 1 : * @method string getState() * @method string getStatus() I know how it works technically, and the ...
user avatar
  • 515
0 votes
2 answers
220 views

How to define methods inside of Plugin in Magento 2

I try to overwrite get_url() function located in item.php from this path \vendor\magento\module-catalog\Model\Layer\Filter\Item.php For this, i created a PLUGIN, and my code it's this one: <?php ...
user avatar
  • 2,602
0 votes
1 answer
870 views

Rest api with same route of different entity type and using put and post method

<routes> <route_collection> <route>/cart/addtocart/:device_id/:product_id/:qty</route> <action_type>collection</action_type> </...
user avatar
  • 143
2 votes
1 answer
55 views

How to know all available methods and how to use them [closed]

I'm still learning how to use Magento and I see that it has lots of useful methods. However, my only way of learning that a method exists, and how to use it, remains looking at code that's already ...
user avatar
  • 366
1 vote
2 answers
2k views

Magento 2 My Orders->Order Shipments->Track this shipment results in Invalid method error

(magento 2.0.10) My Orders->Order Shipments->Track this shipment->after click. Invalid method Magento\Framework\View\Element\Template::formatDeliveryDateTime(Array ( [0] => 2016-11-22 ...
user avatar
2 votes
1 answer
3k views

magento 2: where are methods ($_product->getResource()->getAttribute($_code)->getFrontend()->getValue($_product)) declared?

lets say in my catalog_product_view.xml I have this additional Block: <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.demo" template="product/view/warranty.phtml" ...
user avatar
0 votes
2 answers
1k views

Invalid method Mage_Core_Block_Template::getProducts(Array

I am trying to call getProducts method from content.phtml file. Block file: class AdminModules_Topjob_Block_Topjob extends Mage_Core_Block_Template { public function getProducts($pro_cond,...
user avatar
  • 115
1 vote
3 answers
374 views

Why can i pass in unlimited argument as injection in constructor of magento2?

In my understanding, argument passed to a function/method are strictly mapped to your function call, and the arguments must be arranged in correct order to map what you pass in your function call. e....
user avatar
  • 1,090
2 votes
1 answer
1k views

Magento 2: Custom function – best place to put it?

I've created a little function for one of my template (.phtml) files which I'd like to re-use in a few other template files. All the function does is concatenate a couple of strings together and trim ...
user avatar
  • 1,317
2 votes
2 answers
168 views

What methods typically go in Model, Resource and Collection

I'm fairly new to Magento, coming from a Symfony/Laravel background. Magento's ORM implementation seems a bit confusing at first. Most resource/collection classes only seem to have a _construct() ...
user avatar
3 votes
1 answer
142 views

Where does Magento implement methods?

I am new to Magento. I have following code in a template file called brand.html $brandImageUrl = $this->getBrandImageUrl($brand); My understanding (roughly) is that $this refers to an instance of ...
user avatar
2 votes
1 answer
2k views

getIdentities() what it does? [duplicate]

I get a warrning on Magento\Catalog\Block\Product\ListProduct->getIdentities() Warning: Invalid argument supplied for foreach() I checked the specified method but I do not understand what does ...
user avatar
  • 647
2 votes
1 answer
177 views

Understanding code and pratical

I have been reading a lot of blog from Alan strom and Magento tutorials and i have gained a lot, still blurry but good. Now i am at a point, where i need to put everything together. I am really lost ...
user avatar
  • 249
1 vote
1 answer
1k views

Magento 2: Updated file not working

I want to update the class Select and its getValuesHTML() method which is saved here: module-catalog/Block/Product/View/Options/Type/Select.php I have made a copy of this file and placed it in my ...
user avatar
  • 1,317
0 votes
1 answer
342 views

Reusing methods from other blocks in custom block

Having a custom Block where I fetch custom data what is the accepted workaround to inject the methods in this custom Block from another block. Having the following situation I fetch in my custom ...
user avatar
  • 887
0 votes
2 answers
1k views

Error : Call to undefined method addStoreFilter()

my manufactorer manage grid can't filter at store column. Uncaught Error: Call to undefined method Magebuzz_Manufacturer_Model_Mysql4_Manufacturer_Collection::addStoreFilter() prepare column: ...
user avatar
1 vote
0 answers
92 views

How to instantiate my new class and methods

I'm looking to trigger anything on a /admin/customer/edit just to know it's working.. an echo or print.. I have this code below. app/code/community/YourModule/etc/config.xml <global> <...
user avatar
0 votes
1 answer
25 views

Magento 2 method call evrrytime on reload

hi I am newb to magento and I am looking for certain process through which magento will call some method every time whenever its frontend or backend reloads
user avatar
1 vote
1 answer
345 views

layouts - make a sibling my child

lets say there's the following hierarchy of blocks: <block name="parent"> <block name="child" /> </block> and I want to push a block of my own inside "parent", and put the ...
user avatar
1 vote
1 answer
38 views

Where do you place common methods that you use throughout your module

I have a method that is going to be called in multiple files in my module: public function getStore(){ $order = Mage::registry('current_order'); $store_id = $order->...
user avatar
0 votes
1 answer
836 views

Can not access payment methods tab in magento back office

I installed the last version available of Magento 1.9.2.1. I try to access the payment methods tab as an admin and I have this error: Fatal error: Call to a member function setAllowedTypes() on a non-...
user avatar
2 votes
1 answer
694 views

invalid method in /lib/Varien/Object.php after update, causing maintenance mode

I just updated some modules and now my webshop keeps showing the maintenance page, whilst there is not maintenance.flag file in the root folder. I checked the /var/log and in the exception.log it ...
user avatar
0 votes
2 answers
2k views

How is getContinueShoppingUrl() called by Mage::getSingleton('checkout/session')?

I'm using Magento 1.9 and am trying to gain a better understanding of the method, getContinueShoppingUrl(), when called by Mage::getSingleton('checkout/session') but can't seem to find the file that ...
user avatar
  • 219
1 vote
0 answers
24 views

Method is being called from the "wrong" class - undefined method error [duplicate]

I have a CE Magento 1.9 application that is using a custom theme from Trego and a checkout extension from Webtex. The application was functioning but then after installing the checkout extension, I ...
user avatar
  • 219
0 votes
1 answer
423 views

Magento becomes unresponsive / hangs while trying to save config in System > Configuration > Payment methods

currently i have two payment methods for my site . cash on delivery is working fine. but when i try to make payment using payumoney. then after placing the order it should redirect to payumoney ...
user avatar
4 votes
1 answer
141 views

<Namespace>_<module>_Model_<module>::_construct() not allowing method calls

I'm having a curious problem in model's _construct function. When the model is instantiated I would like to call a method to pull and save an access key from a database into a class property so it is ...
user avatar
0 votes
1 answer
5k views

Invalid method Mage_Core_Block_Template::methodblock

here is a block file: <?php class webhive_ManageUrl_Block_Monblock extends Mage_Core_Block_Template { public function methodblock() { return 'informations about my block !!' ; } } view ...
user avatar
1 vote
1 answer
700 views

What does this code do in magento? $this->_init('weblog/blogpost');

This is my model Class <?php class Magentotutorial_Weblog_Model_Blogpost extends Mage_Core_Model_Abstract { protected function _construct() { $this->_init('weblog/blogpost'); } } ?> My ...
user avatar