Magento - update order status via API - magento

I have added a custom order status option.
Does anyone know how I can set it to my custom value via the API?

Thanks to Diglin for pointing me in the right place. Just to present the answer properly:
You can do this by using the addComment method, which also lets you specify the new order status as one of it's parameters.
$sku='100000003';
$orderStatus = 'Downloaded';
$comment = 'The order was successfully downloaded';
$sendEmailToCustomer = false;
$proxy->call($sessionId, 'sales_order.addComment', array($sku, $orderStatus, $comment, $sendEmailToCustomer));
Hope this helps someone.

After to have seen the api doc and the source code, you can get only information about an order and add a comment to it. You cannot edit or delete an order. You have to create your own API if you need that.
See this link to see what is possible with the API: Magento Core API - Mage Sales

Related

How do I add an "author" field in the strapi cms?

I can't figure out how to set up the links. I have created a collection. I need an creator to be automatically specified in that record when adding a record to the collection. How do I do that?
I've faced this problem...
I found the solution in the documentation:
need to add
"populateCreatorFields": true
in the file (strapi v3) /api/your-type-name/models/your-type-name.settings.json
in options object
like:
...
"options": {
"increments": true,
"timestamps": true,
"draftAndPublish": true,
"populateCreatorFields": true
},
...
More information can be found at strapi documentation
Strapi does not support it by default. As mentioned in this form you can achieve it by editing the strapi's controller. But I will not recommend you to edit the strapi controller at all. Please avoid it.
There is a simple and better solution to this. You can achieve this by creating one to one relationship. Create an author table/collection. Make one to one relationship with your other collection. You can make it a required option as well. So whenever someone creates an entry they have to select an author from your already created collection of authors.
And now you can get relation in your API and use it wherever you want to.
As stated in my comment, Strapi (tested on v3) comes with a created by field. To ascertain the claim, the following steps can be followed;
Create a new content type. Here I am setting only one field, called test
Add an entry for that content type. Notice the last update and by field on the right.
Save and open the entry. The last update and by fields have been automatically populated.

Adding an extension to the blog post pages on liferay

My problem is i want to add '.html' extension to my every blog post. For example right now i have a blog post url 'http://www.indu.com/blog/-/blogs/creating-a-custom-portlet-in-liferay' and what i want is 'http://www.indu.com/blog/-/blogs/creating-a-custom-portlet-in-liferay.html'
I would be grateful if any one can help?
I wonder why would you want this.
Anyways, I think you can change the urlTitle field of BlogsEntry and append .html to the string. May be use a service-wrapper-hook to append .html to the urlTitle whenever a blog is created or updated.
Or you can even use a ModelListener if it exists for BlogsEntry hook to update the blog's urlTitle by using onCreate & onUpdate methods.
Edit
The urlTitle field is present in the BlogsEntry table.
You can access this in java with the following methods:
BlogsEntry blog = BlogsEntryLocalServiceUtil.getBlogsEntry(90989); // retrieves the blog-entry
String blogUrlTitle = blog.getUrlTitle();
blog.setUrlTitle(blogUrlTitle + ".html"); // this would set the string
You can have a check for the blogUrlTitle so that you don't have repeated .html appended to the string:
if (!blogUrlTitle.contains(".html")) { // append only if the title does not contain `.html`
blog.setUrlTitle(blogUrlTitle + ".html");
}
You can refine your code as you like, the above is just a guide-line.
As a side-note, I would always try to reason with the client why they want something, this helps not only to fend-off bad-change-requests but also helps in giving an alternative to the client (which is less taxing on the developers like us ;-) ). In most cases this helps to understand the client's business better & provide better returns.

is it possible to remove zip/postal code field in magento

is it possible to remove zip/postal code field depending on country chosen in the address section of the checkout page in Magento?
e.g. when a user chooses 'Ireland' the field disappears on the fly.
thanks
Dave
In the admin panel there is an option to make zip code optional for specific countries:
System-> Configuration -> General -> Countries Options -> "Postal Code is Optional for the following countries"
Select your specific countries which you want to make optional.
If this isn't enough with a some basic modification you should be able to make the field invisible as well.
In your theme (don't modify the existing themes), copy js/opcheckout.js and modify that.
Add your observer to the zipcode fields. The best is to hide the zipcode, as the client-side validation won't fire then.
If you would like some code to get you started, I can post that in an edit.
Magento hasn't anything built-in yet. You have to wrote some javascript to do that and, of course, control this flow into Magento Core classes.
on Magento 1.7.0.2
first you have to remove 'required-entry' on zipcode field (you can use jquery to remove class)
then
go to Mage_Checkout_OnepageController
on saveBillingAction() method
$result = $this->getOnepage()->saveBilling($data, $customerAddressId);
$result = array() // clear error message;
and then on saveShippingAction() method
$result = $this->getOnepage()->saveShipping($data, $customerAddressId);
$result = array() // clear error message;
hope works!!

How to confirm an order in Magento using the SOAP webservice?

I'm trying to confirm an order using the Magento web-service. I can put an order on hold like this:
$result = $client->salesOrderHold( $sessionId, $order_id );
echo "Order on Hold: " . $result . "<br>";
or add a comment to the order, but I can't find the function to call to confirm an order.
NOTE: my orders are being confirmed manually, so, I need to do this using the web service.
any help is appreciated!
From Magento version 1.4.2, the status of an order can be customized. So now, you have two kind of value for a status order. Check this link to see what is possible and what are the differences between state and status. Magento state and status
I am not sure of what you are expecting by setting your order to "confirm". If it's just a display needs, you can create yours in backend menu System > Order Statuses. Then you can use the API to addComment with your customized status or an existing one but it won't change the state of the order. It will stay in "On Hold" if it is in this state.
If you want to change the state and not the status, you need to extend the api of the module Mage_Sales to allow to set a status to an order. Magento doesn't offer it by default. As it is written in the link provided in my comment, you cannot edit the status and a state of an order. The method addComment of the API doesn't change the state, it allows only to change the status in the comment. You have to create your method based on the class Mage_Sales_Model_Order_Api. See the following link to do it by yourself Create a custom API
Hope it helps

Magento saving a product option for an attribute with a dropdown type

I have written code that automatically imports products basically something like:
$product->setName('my name');
$product->save();
This is fine for free fill text boxes, but how would I go about setting say manufacturer, which is a drop down menu? Is there also a way that if the option doesnt exist, then it will automagically add it?
Thanks
This is tested in 1.5.0.1, you just need to target the correct attribute ID. As #B00MER stated, the attribute will not be created that you are targetting but if the attribute exist, this will create the options.
$eav_entity_setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$new_option['attribute_id'] = $id;
$new_option['value']['_custom_'.$value][0] = $value;
$eav_entity_setup->addAttributeOption($new_option);
Documentation about addAttributeOption can be found here.
http://freegento.com/doc/d0/d7b/_eav_2_model_2_entity_2_setup_8php-source.html#l00603
You will need to create the functionality yourself unfortunately. And by default Magento will not 'automagically' create a option if one doesn't pre-exist.
To simply set the ID of the value you want (Say Sony was ID 12) you can do:
$product->setData('mfr', '12');
However you may find a lot more insight here on steps to do what your looking for:
http://www.arscommunity.com/wiki/magento/configurable-products-creation-code

Resources