We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [programmatically]

Denotes questions related to making changes to the Magento platform programmatically, rather than via the admin interface.

Filter by
Sorted by
Tagged with
1
vote
1answer
181 views

Sending order confirmation email in magento 2 programmatically

Normally I would do something like <?php use \Magento\Sales\Model\Order\Email\Sender\OrderSender; use \Magento\Sales\Model\Order; class MyClass { private $orderSender; private $order; ...
0
votes
0answers
55 views

Custom Product Attribute values editable through Dashboard

I created a module that install and upgrades custom product attribute programmatically. It works as intended, however, when viewing the attribute through admin dashboard, I am unable to make any ...
0
votes
0answers
51 views

Magento 2.2 - Custom options are not saved programmatically on cart update

Initially, while adding an item to cart the custom options and other details are saved successfully to cart. When reupdating the cart with updated custom options are not saved in cart programmatically....
1
vote
1answer
110 views

How to duplicate sales rule programmatically in Magento2

Im try to duplicate some salesrule exist, i can duplicate this, but i can't use setConditionsSerialized and setActionsSerialized with getCondition and getActionCondition, its dont working use ...
0
votes
2answers
198 views

How to set List Mode(backend configuration) programmatically for category page magento 2?

Actually i want to set list/grid mode(List Mode) configuration values for category page programmatically not from magento admin backend.if anyone have any idea please guide me.
0
votes
1answer
191 views

Send Sales Order mail to multiple account Programatically

In this screenshot you can see sales order mail sending to multiple acounts . and It work good mail sending to all accounts which mention in Send Order Email Copy To This is hard code to give ...
0
votes
0answers
14 views

Coupon code being applied only to the first product in cart insead of whole cart

A coupon code is generated programmatically on a particular day. The coupon code when applied shows the correct discount amount and even the checkout shows the correct discount amount, but when the ...
0
votes
1answer
297 views

How to call Web API call inside custom module Magento 2

How can we call Web API in a custom module? I have a third party module, in which they are sending a request with API calls. I have custom functionality where I have to redirect my page to that Web ...
0
votes
0answers
32 views

How to add product qty and product price store wise progrmatically in magento 2

I want to create product progrmatically. product creating section is done, after creating the product i want to update the product qty and price store wise. I have following array which return me the ...
2
votes
2answers
205 views

How to set the category ids to a products from category path?

I want to progrmmatically create products from a xml. Ex : I am getting the product categories as like below. Default Category/Beer , Default Category/Beer /CRAFT, Default Category/Beer /CRAFT/...
1
vote
0answers
21 views

How to add category Path when creating product progrmatically in magento 2

I want to create products programatically by reading an xml file. Reading from xml, and creating product part is completed. I have no idea how to assign the products to category. This is my xml node ...
1
vote
0answers
135 views

Add multiple products in cart programatically magento 2

I am trying to add multiple products in cart programmatically. This below code is working properly but I need to set quantity dynamically. If quantity is not set that product to be skipped without ...
1
vote
1answer
63 views

How to apply Coupon on the Specific Products in Magento 2?

I want to apply the coupon on the specific product I tried: use Magento\SalesRule\Model\Rule; public function __construct( \Magento\Framework\App\Helper\Context $helpercontext, Rule $rule, )...
4
votes
1answer
199 views

How to set cms block to category in Magento 2 programmatically?

I would like to add CMS block to a category programmatically, how to achieve it?
0
votes
1answer
37 views

Only 1 product adding to order when creating orders programmatically in Magento 2

I am in a process of creating orders programatically in Magento 2. below is my code: <?php namespace Eight65media\MpowerSync\Helper; use \Magento\Framework\App\Helper\AbstractHelper; class Data ...
1
vote
0answers
37 views

Issue in pragmatically create orders in magento 2

I want to create orders pragmatically by getting the data from xml. Reading data from xml part is done. when creating order steps i am getting this error. Parse error: syntax error, unexpected '$...
0
votes
1answer
694 views

Magento 2 programmatically create cart rule with condition issue on setOperator

As per my requirement am creating the cart rule programmatically, for that i am reviewed the following code and implemented in my local public function createRule() { $price = 100; $sku = '...
1
vote
3answers
306 views

Magento 2 - How Can I Update Catalog Product Price Programmatically in Frontend and Add Product to Cart With New Price?

I create one Module and make a custom form which is display in the catalog product view page. when the customer change option from dropdown then the product price will change and also that updated ...
1
vote
1answer
85 views

Magento 2 - Create or change customer to set customerID

Is there a way to create a customer programmatically and set the customer ID? Or is there a way to change it afterwards? We are getting customer data from a central system in csv format and would ...
2
votes
1answer
62 views

Magento programmatically refresh statistics. - Magento1

How to refresh statistics programmatically in Magento 1?
0
votes
2answers
114 views

Login by email without password

I would login by email only , without password. I have Read these two Posts but it not works for me. Programmatically login a user https://blog.ancud.de/home/-/blogs/magento-how-to-login-a I use ...
1
vote
0answers
80 views

Magento 2.2.6: Programatically updating product custom options

I am working on custom script to update product custom options. $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $_product = $objectManager->create('Magento\Catalog\Api\...
0
votes
0answers
13 views

How to edit category in Magento 1 using PHP using path (Not ID)

I need to be able to revise Magento 1 categories externally. When products are created using Magmi it creates the category, during the process, I store the path used to create the category. I want to ...
0
votes
0answers
116 views

How to add bundled product to cart programmatically in Magento 1.9?

I am trying to add the bundled product to cart programmatically, Still, I didn't get any solution. I have tried to add the configurable product to cart, That is working fine. this is the code I have ...
0
votes
1answer
109 views

setPrice() not working

I want to change the price of a particular product via a module but it is not working. I have searched and found a lot of solutions but none is working for me. I'm relatively new to Magento, I'm ...
1
vote
0answers
207 views

How to speed up creating orders programmatically in Magento 2?

I have a script that creates orders in Magento 2. <?php /** * ExtendedRma Helper */ namespace Company\Module\Helper; class CreateOrder extends \Magento\Framework\App\Helper\AbstractHelper { ...
0
votes
0answers
72 views

Magento 2: Create Customer Attribute in Custom Save Controller

I have a custom module with a custom form in admin. On this form save action, I want to create customer attribute programmatically with the data fetched from the custom form. How can I do it. ...
0
votes
1answer
195 views

Programmatically Add Products to Store View?

We have a multi-store with a bunch of products. For certain categories in specific store views, I'd like to set all products to be in a particular store. Advice on how to achieve this would be ...
1
vote
1answer
294 views

Magento 2: Login user programmatically showing wrong default header message “Default welcome msg!” instead of showing “Welcome, user!”

When you login to Magento 2.2.6 programmatically with code below, header show default message "Default welcome msg!" instead of "Welcome, user!" // Load customer session $customerSession = $...
0
votes
3answers
145 views

How to programmatically create multiple CMS pages at once?

I am working in Magento 2 and I am needing to create multiple CMS pages all at one time. I am trying to set up an Install script to do this all at once. Every tutorial and search that I look up shows ...
1
vote
0answers
309 views

Magento 2.2.5: Add, Update and Delete existing products Custom Options

I am working on updating custom options of an existing product programatically when admin click product save button - I have done below code to full fil my desire - app/code/Namespace/Module/etc/...
1
vote
2answers
854 views

How to create guest order programmatically for Guest User

I have followed Create order programmatically in Magento 2 But it is saving the customer. And When I skip customer set data and customer save then It's getting an error report like "Please enter ...
0
votes
1answer
222 views

Get Parent ID from SKU

<?php ini_set('display_errors', 1); error_reporting(E_ALL); $_SERVER['MAGE_IS_DEVELOPER_MODE'] = true; require_once "app/Mage.php"; Mage::app(); umask(0); try { echo('<h1>Completed ...
0
votes
0answers
89 views

Magento 2 category updated programmatically not working

from upload the CSV file trying to created&update the category, while I create the category from the below script it's working, but while I update the category with the same script does not work. ...
2
votes
2answers
2k views

How to get products name and sku and url key using sql query in magento 2?

How to get products name and sku and url key using sql query in magento 2 ?
0
votes
1answer
292 views

how to create order for guest in magento 1.9

I am trying to create an order for guest checkout programmatically. I have gone through a lot of articles. Finally, I got one stackExchange link for creating order. But In that code, they are not ...
0
votes
1answer
74 views

How to add multiple product to cart and get cart id in magento 1.9 for guest checkout?

I am trying to store multiple products to cart and getting cart id of the products list for generating order in Magento 1.9. I don't know how to create cart and order for guest checkout.
0
votes
1answer
203 views

How to cancel Magento order programmatically

I want to change the order status to 'canceled' when payment failed. I've tried the code below but the order status gets saved as processing: $orderId = $number8; //order id $order = ...
0
votes
0answers
38 views

Actually i am facing one error while sending email programmatically magento2?

Here I am using default contact us email template from admin panel magento 2. app/code/Vendor/Module/Controller/Index/Contact.php <?php namespace Vendor\Module\Controller\Index; use ...
5
votes
2answers
1k views

How to add new item (product) into existing order programmatically in Magento 2

I have created one virtual product in my Magento2 website. Now, I want to add it programmatically to the existing customer orders on some occasions with its custom price and name. Can someone please ...
2
votes
1answer
224 views

Magento1.9 CSV generate but not download on save action

Here is my controller code :: public function saveAction() { $post_data=$this->getRequest()->getPost(); if ($post_data) { try { ...
1
vote
2answers
2k views

Add shipping method programmaticaly

I'm creating quote / order programmaticaly. But when I do this, I have an exception : (in english, "select shipping method") Magento\Framework\Exception\LocalizedException: Sélectionnez un mode ...
0
votes
1answer
96 views

Possibility of creating order programatically without quote

Has anyone checked wheter it is possible to add order programatically without creation of quote?
4
votes
0answers
82 views

Apply unique images by attribute to each sku magento 2 programmatically

In magento2 - How can I perform this task through a script? I already relate the configurations to the product with this segment $attributeModel = $this->objectManager->create('Magento\...
2
votes
1answer
154 views

Using the Mage_Sales_Model_Order_Shipment_Api create() method to create a new shipment

I am making a connector for Magento, where orders from Magento are pushed into our system, then get shipments created that need to be pulled back into Magento and converted to the right format. In ...
4
votes
3answers
5k views

Magento 2: How to add customer address programmatically?

I have succeed create customer programmatically. Now I want to add customer address to the customer, how can i do this programmatically?
0
votes
1answer
40 views

Programatically load orders of data changed in magento1.9

Can anyone help me how to load the data edited orders in magento1.9. Please help me if any one have idea about this. Thanks
0
votes
1answer
47 views

$product->save() taking 4 seconds to save one simple product in magento 2.1.3

I have below code with Image Upload which is working fine...but it takes 4 seconds to save one simple product....my store have more than 25000 products. It takes more than 4/5 hrs to create/update the ...
0
votes
0answers
435 views

Magento 2 Add a block to a layout programatically?

public function __construct( Context $context, array $data = [] ) { parent::__construct($context, $data); $block = $this->getLayout() ->createBlock('Magento\Framework\...
0
votes
1answer
337 views

Create virtual product programmatically

I'm using magento v2.5.5 to develop an extension, in this extension i have to generate virtual product with non manageble stock (infinite stock), how to do this programmatically, my virtual product ...