Magento API to create and assign voucher codes programmatically

We have a situation where we need to create voucher codes dynamically and assign it to a set of rules. Since I’m new to magneto programming I’m not aware of using the REST API and all.

Could someone suggest how to do this, Is there an alternative way of accessing it via Python and PostgreSQL?

Also, we need this voucher codes to be sent to the customers on their first order, Do you know what all tables are involved in this?

Assign default sim to a contact Galaxy A70

Hi I have recently bought a Samsung Galaxy A70 (dual sim) which in general seems a really good phone although I have Two issues.

1. With my old phone (Lenovo K8) I was able to assign a sim to each contact so that every time I called that contact it would automatically use the assigned sim. This was handy when I was in the car and using voice commands to make a call so when I call someone because of work it would use the work sim or personal the personal sim.

I cant find any option to do this with this phone and it seems it will use the default sim (Sim1) to make all calls which I don’t want to do as this uses my personal number to make work related calls.

Is there a way to set each contact a preferred sim?

I cant select “always ask” as the phone will just sit a wait for a response to be selected on the phone so when in the car this would defeat the object of using voice control and I don’t fancy risking three points on my licence every time I want to call a work number while driving.

1. When using the voice control in the car the old phone would offer me the choice of which number to call if the contact had more than one i.e. it would say “Home, Work or Mobile” now all it says it “which do you want to call you can say one or two which when driving is no use at all. I also noticed that both numbers for mobiles were called phone not work or mobile which you can see if you look in contacts.

Is there a way to get it to understand Work, mobile, home etc?

The old phone did it via google but this one doesn’t. I have not tried Bixby yet so I don’t know if this is any different.

Thank you for any help.

Assign different taxonomy terms to translations of content

I’ve got some custom content translated with entity translation with custom taxonomy also translated. Actually taxonomy terms are correctly shown inside the content page. The problem is I need different taxonomy terms for different translation. When I change the taxonomy terms in the translation edit page every translation of the content gets updated with the terms variation.

The logic behind would be:

``- content A (english) --> taxonomy term 1 (english) - content A (french)  --> taxonomy term 2 (french) - content B (english) --> taxonomy term 2 (english) - content B (french)  --> taxonomy term 3 (french) ``

Assign IP address to a teaming NIC that is disconnected

I have two server interconnected each other with two ethernet cables and the two connections are in teaming (via Intel Teaming configuration, not 2012-R2 teaming). If one of the server is switched off, services that must listen to the interconnection teaming interface IP cannot start because IP is not assigned until the link is up. If one server starts some minutes after the first, the services on the first running server are not working. I can’t control the services, I’m asking if it’s possibile to “simulate” link on onto the teaming interface in any condition, like a loopback interface.

Assign user capabilities to a Custom User Role not working

I have a New User role called client admin. This role must create, list, edit, delete, remove user for the site. I add the following code the Site.

``    add_role(     'client_admin',     __( 'Client Admin' ),     array( 'create_users'            => true, 'list_users'                => true,  'edit_users'                => true, 'delete_users'            => true, 'remove_users'            => true, 'promote_users'           => true, ) ); ``

“You need a higher level of permission.”

User Role does work and all other capabilities for the role is working fine.

What am I missing ?

how can I assign routing tables to interfaces which are configured via dhcp

My host has two interfaces with both are DHCP configured. I do need a default gateway for both interfaces and therefore routing tables with rules for each interface. So it would be good to get all dhcp based routing entries into the right routing tables

Assign weights to the edges in a DAG so that, for all S and T, all paths from S to T have equal weight

I have a DAG, and on each edge, I have a minimum and maximum weight. I would like to assign (or determine it’s impossible to assign) exact weights to each edge so that

1. Each edge’s weight is between its min and max
2. For any two nodes $$S$$ and $$T$$ in the DAG, all paths from $$S$$ to $$T$$ have equal weight (where the weight of a path is the sum of all the weights of the edges in that path)
3. [Bonus points] The total weight of all edges in the graph is minimized

I know I can set this up as a linear program, but that feels like overkill. There has to be a simpler way to do this. I’ve tried to think of a way to reduce it to a min-cost flow problem, but I’ve had no success so far. I think that might not be the right direction. Any ideas?

There is a workflow that is sending email action but it is not sending alert notification for “Assign a task” to a SharePoint group. It is a SharePoint designer 2013 workflow built on SharePoint online list. The workflow runs on item created.

Assign product to the last level category in magento 2

we are importing product from outside of magento.we create an mappings for all attributes as target attributes and magento attributes.we have categorys as Abc/Cde/efg.Here is my category mapping code

``                  foreach(\$  Categories as \$  Category)                      {                         \$  categories = explode('/', \$  Category);                          if(count(\$  categories) > 0)                         {                             \$  level = 2;                             \$  parentId = 2;                             foreach(\$  categories as \$  category) {                                 \$  categoryCollection = \$  categoryModel->getCollection();                                 \$  categoryCollection->addAttributeToFilter('name', array('eq' => \$  category));                                 \$  categoryCollection->addFieldToFilter('level', array('eq' => \$  level));                                 \$  categoryCollection->addFieldToFilter('parent_id', array('eq' => \$  parentId));                                   if(\$  categoryCollection->getSize() > 0)                                 {                                     \$  return[\$  mapping->getAttribute()][] = \$  parentId = \$  categoryCollection->getFirstItem()->getId();                                 }                                  \$  level++;                             }                          }                      } ``

i will loop into categories and assign it level wise. Now i need to change the code as i need to assign to the last category only i.e abc/cde/fdf categorys are there i need to assign only to fdf category only.how can i change my code to assign to last category only.

“Unique constraint violation found” Error When Assign Product into Category

After Assign Product Into Category Getting Error `"Unique constraint violation found"`

In `exception.log` file :-

[2019-05-31 17:53:29] main.CRITICAL: Unique constraint violation found {“exception”:”[object] (Magento\Framework\Exception\AlreadyExistsException(code: 0): Unique constraint violation found at /var/www/html/m2shineretrofits/vendor/magento/framework/EntityManager/Operation/Update.php:121, Magento\Framework\DB\Adapter\DuplicateException(code: 1062): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘root-category/sub-category/product-url’ for key ‘URL_REWRITE_REQUEST_PATH_STORE_ID’, query was: INSERT INTO `url_rewrite` (`redirect_type`,`is_autogenerated`,`metadata`,`description`,`entity_type`,`entity_id`,`request_path`,`target_path`,`store_id`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?),

Also Try This Solution But Not Working :-

Add categories automatically – Unique constraint violation found

Magento 2 Unique Constraint Violation Found On Product Save

Magento 2 : Unique constraint violation found when adding product, categories or mega menu items