Add new States In Dropdown Of Address in ORO Commerce - orocommerce

I have installed orocommerce 4.1 and I want to add new values in States dropdown in Orocommerce how to do that ??

In OroCommerce, the state is represented by the Region entity.
You can add new states with the data migration, like that one:
https://github.com/oroinc/platform/blob/4.1.4/src/Oro/Bundle/AddressBundle/Migrations/Data/ORM/LoadCountryData.php

Related

How do I get a field in odoo 15 from res.partner module shown in account.move?

In odoo 15 I have created a PDF report for invoices using a custom layout via an external module. The address of the customer is specified at the top left of the first page of the PDF report. The content comes from the record that was created via "Customer" (res.partner) and selected via the field "partner_id". After the selection, the street and postal code as well as city are loaded in the edit view of an invoice and thus transferred to the PDF document.
How can I extend or overwrite the address field in my custom report layout to create an own address field that comes from the customer data (model res.partner)? I have created an additional field there via a module (address_suffix) that can store an address addition. I would like to be able to include this custom field of res.partner in the address field at account.move and in the end into the PDF report.
To illustrate it:
I want this field (address_suffix in res.partner)
can be seen here (account.move):
You can check the OCA partner_address_street3 module. It is similar to yours, it adds a third street field (street3) to store additional address information.
The module extends the address format, so it should automatically show on reports
On your report xm, I think you can try using t-field and using widget contact inside the t-options tag.
Example:
<span t-field="partner_id" t-options='{"widget": "contact", "fields": ["address"]}'/>

How to add a contact to a list in ActiveCampaign API v3

According to v3 docs I should be able to add a contact to a list using the Contact API but I am at a loss on how to do so as I see nothing list related under Contacts.
How do I add a contact to a list (not through automations) using version 3 of the API? Or are the docs in error?
The v3 docs have been updated (Lists documentation) and they no longer read that you can add a contact to a list through the API. ActiveCampaign Lists documentation screenshot
EDIT: you can add a contact to a list using the v1 contact_sync (contact_sync documentation)
SECOND EDIT: you can now add a contact to a list and/or change their subscription status to a given list through the v3 API!
(update list status for a contact documentation)
The above is no longer true. You can add a contact using the Create Contact endpoint.
It's basically a POST request that uses the following parameters:
E-Mail (Required)
First Name (Optional)
Last Name (Optional)
Phone (Optional)
The API v3 changed a lot though and now after you create a contact to do the following this you have to consult other endpoints. For example:
To add a contact to a list you need a POST request to the Contact Lists endpoint where you need to provide three parameters (listid, contactid, status).
If you need to assign a tag to a contact, in order to be able to create the relationship you first need to create the tag using the Create a new tag endpoint. And the use the resulting tag id with the Create Contact Tag endpoint where you combine said tag id with the contact id.
Now in order to remove that same tag the guys from Active Campaign made us work more and in order to remove a tag from a contact you don't use the contact's id and the tag's id, but rather you have to use the contact's id and the relationship id between the tag and the specific contact, that's quite a lot of steps, but I guess they wanted to make it very robuts in terms of structure.
There are many new endpoints which were actually available from around the date when you asked your question. You should check out the new API reference. It has some flaws and is not 100% complete yet, but it would be useful.
Hope this helps since it gave me some head heck... Using activecampaign php sdk when adding a contact with the sync command you can also add it to a list:
$list_id = 'thelistid';
$contact = array(
"email" => 'contactemail#doamin.com',
"p[{$list_id}]" => $list_id,
"status[{$list_id}]" => 1, // "Active" status
);
$contact_sync = $ac->api("contact/sync", $contact);
They wrote it also as examples on the repository but for some reason I didn't catch it.

How to add new field to admin customer form in Prestashop 1.6

Good evening,
I want to add new field to admin customer form. There where I can display the customer preferences. Is there any hook ? Or I need to override a controller (which) ?
Kind regards
Alter customer table to add new field
override classes/customer.php to add new definition and variable
override controllers/admin/admincustomercontroller.php
override auth or myaccount on front controller

How to change list sequence field register in prestashop 1.6?

i want to change list sequence of field register in prestashop 1.6 like country - state - city, i have tried edit in themes - default-bootsrap - address but cannot work
You have to change in to backoffice:
Localization -> Countries -> Edit the active country that you want to change the list
Then in Address format you can choose the order, change, and remove.

How to access Customizable Text Fields From Prestashop Module?

I'm creating a new module for Prestashop where users can design their own product from a third party service. When the user later adds the product to their cart, I would like to save a ID that I get from this Third Party Service where the user designed their product.
I guess the best way to do this is to create a Customization Textfield within Prestashop called "designID". Now I want to know how I save data to this field from module development in Prestashop instead of letting the users manually fill in the data.
So basically... How do I add data to these customizable fields from within a Prestashop module, when the user adds the product to their cart?
These customization fields are used if you are simple user and you are not designing a module. Using it to save the designID will be just a hack.
Since you're creating a new module my advice is to keep the 3rd party ID in a newly created database table, which will match the id_product, id_design, id_cart, id_order, etc...
You can hook to "actionCartSave" and add the record with the matching ids, and all the other required data at your table.
If you want to stick to that Customization feature, add a sample field and review the following database tables:
ps_customization
ps_customization_field
ps_customization_field_lang
ps_customized_data
and replicate the changes when you receive the 3rd party ID.
If all your products will be customized, consider adding the required data in ps_customization_field & ps_customization_field_lang (the table for the field structure) during the module installation, so after it's installed you can just fill
ps_customization & ps_customized_data (the tables for the field data)
PrestaShop does not have proper API for adding customizations, only for retrieving data, so you'll have to write the SQL queries yourself. Just review the ProductController for the ps_customization & ps_customized_data changes and the AdminProductsController for ps_customization_field & ps_customization_field_lang.
Do not forget to remove the Customization markup code from your product & cart templates.
I was able to find this out by myself by first trying to use Customization for a couple of hours without any success.
So basically how my module work is that the customer can open a popup iframe to a third party design tool, the customer then save the design in the iframe, which then sends the data to the parent window (The Prestashop Window).
So to store this I did the following:
Add a new column to the database table ps_cart_product
Hook into any display-hook on the product page and check if any post data is send containing the data from the third party module. If so, then:
if(isset($_POST['thirdparty'])){
$id_product = (int)Tools::getValue('id_product');
if (!$this->context->cart->id){
$this->context->cart->add();
if ($this->context->cart->id)
$this->context->cookie->id_cart = (int)$this->context->cart->id;
}
$this->context->cart->updateQty(1, $id_product);
if(!Db::getInstance()->update('cart_product', array('id_design'=> pSQL(trim($_POST['thirdparty']))) ,'id_cart = '.$this->context->cart->id.' AND id_product = '.(int)Tools::getValue('id_product') ))
$this->context->controller->_errors[] = Tools::displayError('Error: ').mysql_error();
}
So basically first I check if POST is set, then I check if any cart exist, if cart does not exist then add a new cart with ->add() (This function took hours to find, 0 documentation). updateQty() is used to update the cart with the new product.
The last part is the SQL query that updates the value of id_design column with the data that is send from the third party.