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
0answers
16 views

Store wih diferent languages have broken images after programmatically product import

I have a script running in cron to import products. This import creates simple products and then creates a configurable one with all these simple ones as children of that. During this process, I ...
2
votes
1answer
663 views

Programmatically rename product images--existing images already uploaded--for SEO

I would like to create a simple script to programmatically rename existing, already uploaded product images (without having to re-upload them or use the admin backend). To process this in manageable ...
0
votes
0answers
23 views

Error “DDL statements are not allowed in transactions” while Reindexing programmatically using Event Observer Magento 2.3.0

Actually i am trying to reindex category data while saving category from backend but i am getting an error DDL statements are not allowed in transactions in log file while reindexing ...
1
vote
3answers
1k views

Magento 2 store-view progmatically

In Magento 1 i used something like this to create 2000 store views on the fly. How would I do the same thing in Magento 2? require_once('app/Mage.php'); umask(0); Mage::app('admin'); $strnm =1; ...
1
vote
2answers
46 views

How to display programmatically created custom options in admin order details

I created 4 programmatically custom options. It is successfully display in cart page and also make successful order. I created module for that. Here its code. path : vendor/addtocart/controller/index/...
2
votes
3answers
2k views
0
votes
0answers
26 views

Can we Create Product Attributes Programmatically without using setup Script in magento 2.3?

Can you help to Create Product Attributes Programmatically without using setup Script in magento 2.3 ?
0
votes
0answers
14 views

How to Create Product attributes Programmatically from CSV in magento 2.3?

I have list of product custom attributes in a CSV. How to read these attributes from CSV and create them in Magento 2.3. Note : I don't want to use setup script for creating these attributes because I ...
0
votes
3answers
1k views

Error while trying to programatically create flat category

Using Magento 1.9.0.1 I am trying to programmatically create categories using a data upgrade script with the flat categories option turned on. This first category I want to create is a new root ...
1
vote
1answer
754 views

How to add product reviews progmatically to add data on custom field

$review = Mage::getModel('review/review') ->setEntityPkValue(intval($pressquote->product_id)) //product id ->setStatusId(intval($pressquote->status)) ->setDetail($pressquote->text) -&...
5
votes
4answers
6k 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?
1
vote
3answers
3k views

Magento2: How can update & create the CMS static Page programmatically

How can update an existing CMS static Page and how to create a new CMS static Page - programmatically
2
votes
2answers
1k views

Magento 2 : Add product to cart programmatically does not populate quote item id in validate method

How to add product to cart programmatically in Magento 2.2.0 ? I have tried below code but when I do not get Quote item id in Validate method of below file. \Magento\AdvancedSalesRule\Model\Rule\...
2
votes
3answers
1k views

Magento2: How to temporarily disable “update on save” when saving products programatically?

I have a CLI command on my module that runs through the products collection & updates some of the attributes. I noticed that it's extremely slow. Each save() takes about 4-5 seconds, which is a ...
0
votes
0answers
32 views

Importing Date Attributes in DD/MM/YYYY format

When importing products with date fields in format dd/mm/YYYY it throws this error: Value for 'special_to_date' attribute contains incorrect value in row(s): 1, 2, 3 From reading around I see ...
2
votes
1answer
1k views

Magento2 - Add Custom Column in cart item table and insert data to custom column when product add to cart

i have added new column in 'quote_item' table. i want to add the data to custom column when user add any product to cart.
0
votes
1answer
29 views

What is difference between creating custom attribute programmatically and via admin in magento 2?

Creating an attribute in the back end is easy, then why to create it as programmatically? I like to know what is the difference between these two.
0
votes
1answer
27 views

Magento 2 : add tier price programatically for all customer Group

How to add Tier Price programatically for all customer group Tried below not working. As ALL GROUP id is 32000; $sku = "test"; $customerGroupId = 32000; $price = 5.5; $qty = 2; $tierPrice = $obj-&...
2
votes
1answer
457 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
24 views

How to Add Size Attribute In Configuration Product Create Programatically For Following Code?

<?php error_reporting(1); set_time_limit(0); ini_set('memory_limit', '2048M'); use Magento\Framework\App\Bootstrap; /** * If your external file is in root folder */ require __DIR__ . '/app/...
0
votes
1answer
11 views

how to het customer pick date for electron product, example, amusement park ticket

I'm trying to sell tickets electronically. Consider like an amusement park, or parking lot tickets. No worries about assigned seats or limited dates / times. I can handle checking if it is sold out, ...
1
vote
1answer
1k views

Magento:Save Product image from external url

I want to save a simple product programatically.I have used the following link http://inchoo.net/magento/programming-magento/programatically-manually-creating-simple-magento-product/ All fields are ...
0
votes
0answers
36 views

Magento 2 programmatically update products by processing feed (cron job)

I have looked everywhere high and low, and tried every "solution" I could find, but could not figure out what's wrong with my code. We have an XML feed which gets imported to a local folder, and then ...
0
votes
1answer
30 views

Magento2: How to disabled coupon code programmatically from the cart and checkout page?

I want to disabled coupon code programmatically from the cart and checkout page if the condition is true. Please help me.
0
votes
1answer
20 views

setData does not set attributes values

I am creating simple products and try to set some attribute values $attributeSetId = $product->getDefaultAttributeSetId(); $product->setSku($sku); // Set your sku here $product->setName($...
0
votes
0answers
8 views

M2.3.3 : 500 on product creation page after adding attribute programatically

I am adding product attribute programmatically the following way: use Magento\Framework\App\Bootstrap; require '/www/public_html/app/bootstrap.php'; $params = $_SERVER; $bootstrap = Bootstrap::create(...
0
votes
0answers
20 views

Magneto 2 :Delete DB fields while admin disable a module from backend

Created a module ,in which created some custom product attributes for products.Thus added few new rows in eav_entity table using InstallData.php file. Everything working fine. But even I disabled the ...
1
vote
1answer
1k views

How to create Configurable Product Programmatically

I have found some question same my own but have not found out the answer. I want to create a configurable product. I have create a form to save the product and get the child product details in ...
1
vote
1answer
921 views

Can't Create Configurable Products with multiple Attributes programmatically

I'm trying to create a configure product with multiple attributes. Here is my code. Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); $simpleProduct = Mage::getModel('catalog/...
3
votes
3answers
2k views

Increasing all product prices by percentage | Custom Script

I am trying to find a way to update all product prices by 5% then I want to revert them to the original price and wondered if anyone had any ideas of the best way to achieve this. At the moment I am ...
1
vote
1answer
41 views

How add category programmatically magento 2.3? [duplicate]

How to create categories programmatically?
0
votes
2answers
1k views

Programmatically create new orders from multiple existing orders

I would like to programmatically create new orders from existing orders by their id and send new order confirmations by mail. The new orders need to contain all the information the old ones had (Items,...
4
votes
1answer
2k views

Create order programmatically for the items on cart on checkout page

I am successfully creating the order in the Magento dashboard with the below code. //for order $id=3; // get Customer Id $customer = Mage::getModel('customer/customer')->load($id); $transaction = ...
0
votes
0answers
43 views

How to assign simple product to configurable product programatically in magento 2?

I want to know any script where we can assign a simple product to configurable products with just add product Id. can anyone give me script for it?
0
votes
1answer
769 views

How Importing Images with Labels using addImageToMediaGallery in magento2?

Magento2.1.x I had a problem adding a product Image Label programatically. Here's the code I used: $imageLabel1 = 'Test1'; $imageLabel2 = 'Test2'; $imageLabel3 = 'Test3'; $product-&...
5
votes
5answers
10k views

Magento 2 Programatically add product to cart with additional options

I want to add product to cart with some additional data. My code adds the product to cart,but the additional info is not saved properly. I want to display the additional content in cart like custom ...
1
vote
3answers
77 views

How to pass the value and call js function from template.html using knockout js in(in checkout page) Magento 2?

I have to call and pass value to the js function(showPopup())from the template(when clicking the Verify OTP button). How to achieve this?. But now i am not able to call the js function. layout file &...
4
votes
1answer
3k views

Magento 2 check which catalog rule is applied to cart product

I have created 3 catalog rules for category. Shoes Category: 5% Off , Catalog Rule Name: Shoes Offer Toys Category: 10% Off, Catalog Rule Name: Toys Offer Fashion Accessories: 8% Off, Catalog ...
0
votes
1answer
4k views

Calculate tax programmatically in magento for some customers

my products price are inclusive of 12.5% tax so if my customer has tax excempt then he should not pay 12.5% instead he should pay 2%. tax excempt:- if my customer produce c form then he is ...
1
vote
0answers
27 views

Magento 2.3: Order Create Programatically Script Allowed memory exhausted

I am working on creating orders dynamically using custom magento script , got reference from How to create order programmatically in Magento 2? now when I run script, after making 10-15 orders, first ...
1
vote
0answers
12 views

Custom Shipping Method as fallback

I've created a shipping method in magento2 . It checks if there is any oversize product in cart and if the package weight is more than 31.5 kg. How can I set this shipping method as default if ...
0
votes
0answers
20 views

Magento 2 Addtocart Group product programatically

I am facing the problem with the Addtocart group product. Can anyone suggest me the code? I have tried as a simple product but it's not working as well try with below code but that did not work out ...
3
votes
2answers
1k views

magento2 send email programmatically without template

I want to send custom email programmatically without any template. In magento 1, I used below script to do same thing. $mail = Mage::getModel('core/email'); $mail->setToName('xxx'); $mail->...
1
vote
3answers
43 views

How Reindex and Reset programmatically in magento 2?

I Need to reindex and reset the indexer programmatically using external script from magento root. How can i achieve this.Is there a Way to do this.? I am new in magento. Please help me. Thanks in ...
2
votes
1answer
75 views

Add images to product description content programatically in Magento2

I want to add images to my product description content block but I don't want these specific images to appear in the product gallery ('image', 'small_image', 'thumbnail'). To add regular images I do ...
0
votes
0answers
75 views

How to set the option swatch text by API in Magento 2

I am currently trying to set an option in a swatch text attribute: $headers = array(); $headers[] = "Content-Type: application/json"; $headers[] = "authorization: Bearer xxx"; $body = '{ "option": {"...
0
votes
1answer
1k 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 = '...
10
votes
10answers
22k views

Magento 2: Programmatically Updating Inventory

In the following code, I am able to store all the information with the exclusion of the stock data. Has something changed in Magento 2? public function __construct( ScopeConfigInterface $...
1
vote
0answers
20 views

How to add existent options inside product options

I trying to add simple products and after associate these products in a configurable product, but some options of these products can't be exists. So, I add options using EVA config and return id of ...
3
votes
1answer
3k views

How to create order programmatically with customer email in magento 1.9

I want to place order with customer email id in magento 1.9 For this i need a script means i want to do it programmatically in php Please help asap

1
2 3 4 5
8