Questions tagged [methods]
The methods tag has no usage guidance.
62
questions
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 ...
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?
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 ...
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.
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-&...
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 ...
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 ...
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 ...
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....
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.
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'...
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 ...
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 ...
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
*
...
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 ...
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
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 ...
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
...
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?
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 ...
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 ...
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 ...
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 ...
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 ...
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
...
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>
</...
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 ...
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
...
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" ...
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,...
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....
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 ...
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() ...
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 ...
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 ...
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 ...
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 ...
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 ...
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:
...
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>
<...
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
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 ...
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->...
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-...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...