Questions tagged [methods]

The tag has no usage guidance.

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

Payment Methods

I use Magento ver. 2.3.5 My payment method displays by default a credit card module that I do not want: I have to click on "place order", to be returned to the payment page and the correct ...
Yoann Balthazard's user avatar
0 votes
2 answers
494 views

Method setFrom is deprecated

Method setFrom is deprecated Declared in Magento\Framework\Mail\Template\TransportBuilder Is there any alternative?
Hafiz Arslan's user avatar
2 votes
1 answer
640 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 ...
leo's user avatar
  • 1,198
0 votes
3 answers
648 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.
Ramesh KR's user avatar
  • 836
0 votes
1 answer
286 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-&...
Andrey Smolin's user avatar
6 votes
2 answers
2k 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 ...
dinesh prajapati's user avatar
1 vote
2 answers
3k 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 ...
Sanjay Shiyal's user avatar
1 vote
1 answer
28 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 ...
guerinteed_mike's user avatar
0 votes
2 answers
409 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....
user7064432's user avatar
0 votes
1 answer
492 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.
Magento Dev's user avatar
  • 1,254
2 votes
3 answers
496 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'...
Degnan's user avatar
  • 99
0 votes
0 answers
83 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 ...
Jafar Pinjar's user avatar
  • 1,889
0 votes
2 answers
1k 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 ...
Akshay Vasu's user avatar
0 votes
1 answer
668 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 * ...
Bong Channarith's 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 ...
Mohamed LAKRAA's user avatar
1 vote
0 answers
25 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
Anil Thakur's user avatar
1 vote
1 answer
2k 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 ...
Nagaraju Kasa's user avatar
12 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 ...
user3339988's user avatar
3 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?
marilena6's user avatar
  • 125
1 vote
2 answers
2k 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 ...
Ramkishan Suthar's user avatar
1 vote
2 answers
338 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 ...
LeCodeur's user avatar
  • 366
0 votes
1 answer
80 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 ...
unknownmx's 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 ...
Rws's user avatar
  • 1
0 votes
1 answer
56 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 ...
enrico69's user avatar
  • 515
0 votes
2 answers
239 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 ...
Alin Lupoiu's user avatar
  • 2,662
0 votes
1 answer
904 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> </...
Melvin's user avatar
  • 43
2 votes
1 answer
57 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 ...
LeCodeur's 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 ...
shuidaan's 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" ...
Blackpanther0001's 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,...
Sayali's user avatar
  • 115
1 vote
3 answers
405 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....
leo's user avatar
  • 1,198
2 votes
1 answer
2k 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 ...
MikeMason's user avatar
  • 1,357
2 votes
2 answers
177 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() ...
shineability's user avatar
3 votes
1 answer
145 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 ...
Steve Digital's 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 ...
deroccha's user avatar
  • 667
2 votes
1 answer
178 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 ...
localhost's 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 ...
MikeMason's user avatar
  • 1,357
0 votes
1 answer
432 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 ...
fefe's user avatar
  • 927
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: ...
Tùng Mạc Sơn's user avatar
1 vote
0 answers
93 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> <...
thismethod's user avatar
0 votes
1 answer
30 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
Paras Arora's user avatar
1 vote
1 answer
372 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 ...
Ronen Ness's user avatar
1 vote
1 answer
46 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->...
Claudiu Creanga's user avatar
0 votes
1 answer
847 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-...
Khaled Ben Ali's user avatar
2 votes
1 answer
761 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 ...
Gilles Lesire's 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 ...
Vee's 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 ...
Vee's user avatar
  • 219
0 votes
1 answer
482 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 ...
Kobid Kunda's user avatar
4 votes
1 answer
143 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 ...
Jonathan Eltgroth's 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 ...
Arslantabassum's user avatar