How to Upload Products Image in zoho Inventory using postman - zoho

This code is working fine to uopload image in Zoho Inventory
*You can Used this code to upload image in zoho inventory.
Item id*
authtoken*
organization_id*
PHP Curl code
'https://inventory.zoho.com/api/v1/items//image?authtoken=xxxxxxx&organization_id=xxxxxxx',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('image'=> new CURLFILE('/C:/Users/shobh/OneDrive/Pictures/WE\'RE HIRING (1).png')),
CURLOPT_HTTPHEADER => array(
'Authorization: Zoho-oauthtoken xxxxxxxxx',
'Cookie: xxxxxxx'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
*Response*
[enter image description here][1]
[1]: https://i.stack.imgur.com/jsKoV.png

Related

Opayo returning 5080

Has anyone called OPAYO via curl? I am getting a 5080 and I have no idea why
$postArray = [
'VPSProtocol' => '4.00',
'TxType' => 'Payment',
'vendor' => 'rusticstone',
'Crypt' => $Crypt
];
$postBody = json_encode($postArray);
$curl = curl_init();
curl_setopt_array($curl, array(
//CURLOPT_URL => "https://test.sagepay.com/gateway/service/vspform-register.vsp",
CURLOPT_URL => "https://live.sagepay.com/gateway/service/vspform-register.vsp",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $postBody,
CURLOPT_HTTPHEADER => array(
"Authorization: Basic " . $auth,
"Cache-Control: no-cache",
"Content-Type: application/json"
),
));
I have just tried it using a form instead and it worked
$postBody is
{"VPSProtocol":"4.00","TxType":"Payment","vendor":"rusticstone","Crypt":"#15A496D03676639B8E842F7214455E71D22977384A358F34168CCF52C587AEE4BAB43463991678E55604A91976F88E700FA67CE64BDCCC2CB921B00AAB2A343792D4621FDF77AB542F2E46171F7F611073AE80CB79F587E8B3DD5F4133CE213F1B4AACBDE3B57F8A68238486E2EFE3C4A12234D60477F98212D595D72A42BB4D5181BCDB54627067B152A75F665F3120518D5157DB85976BD2FA0795FE0086D464A59EFB8E68BAB295A48F175519FFEF51611C1897F62888A73C3D1ECE181657FD267B8B28DA91B7D0D0BD58832B4866596D4B6630E7F1E961A1F281A1318DB3FB450DC4FB38C2E82AF2205F94601FDAC769471ADDFF1B01CD950FE54FA2D3DDAEF0388292B68617DC2FF04DF38BF4D5AF40FB0C2F52F095C3EA9539F2DC85DBCFAC572ED6E364D429984B6FE8EF00BFEBA590E8E81C4B277361D48E873DA90CBA3675D17AD6180B325294D542CA03A5C9E0FFEFC14C455E8BBFDEC9CF36FED346F21F4C3085217F8CCD13A8A211328295EDC697083D8E718AF0E4ED1602453A69E3211A379210D64A86D1FB19FE9F6D67A4A05079830A2CA1B2160E8CF3ACE2005A29FC1CC20B7FC7CCB4FB234781DA0C979502CC1E441FB0BCC7A6D062D96EC9B4DF6486CEE3E5B24B8099400D75C74EDC7EAD80A9690A0991D4C4B04FE78CCBB8A4F91CE643727EA46AC87840A42E98B06D766E9FCF25058EDACC1E7C71415A19CE5C235D85BF08F0D64A2763E372DD0D7164338616F98A1EB93D1EB22D959F3B333C48DBD0B392FB53096A5A9CE822E110BED1533738C0BA191281C9DD6E600812D01EABC543EB0CCBF2DEE2B4A58A40680DFF434608846B81E3DEB85B56CD81FA956713D0E18F9BE05D9CBF768C400A886BCC00738B784386851DA869CBADFB719DD0ADE084E75754404097B99D62A5F843FA168E4979716F7A6229558221EB5EB1013B3C290CEB2DB2E9FF612711281600FCFE19DB5CBE97629432FDA0AAA57FCABF72990CB1127A6EC4124897DB68E2C9FC1977FF5023EB29B693393D22AB79A2FD1BC8244F869AD6A2A0F9E9DF43A974D1892D8FDDD071D5A1159D5D45ED5B328F0E0CF9177744FA1F85B4A6D8231B967A7B87C8140A7B32AA02814BDB2AE2B1BAF00DF953F8F3D1C5F0EF2E96CF83940B49821C1BD7267B9FA450BC32188DCF03ED92A9ACA9D2CC3240F5963E01475E9B4A87E5029E61B6A335E1E087C7D48E91C5B82F1D89EC1F5F9C44D5099EC156972B0C9E21755630F209EC7E0FC1EF9BE526906896EABE6933ED4146D10CAB95BDDC93B6A04CA68AD6DE6292D63516506EF61E21FD7490AEEF76AC4649B4D005408A20ADA6E3A29B68D54F0FDBE35BA6F0D8D294C465C89F8CBAA0571E5A1CFD4371B7AC0D396C97E9216E04
Thanks

Configurable product and its associated product creation using soap api documentation is not in magento api guide.any idea?

I am trying to create a configurable product and its associated product using magento soap api.Product created successfully but configurable product linking with associated product is not working properly guys any idea? This is my code
<?php
$client = new SoapClient('https://sample.com/api/v2_soap?wsdl=1');
// If some stuff requires api authentification,
// then get a session token
$session = $client->login('username', 'Password');
// get attribute set
$attributeSets = $client->catalogProductAttributeSetList($session);
$attributeSet = current($attributeSets);
print_r($attributeSet);
$result = $client->catalogProductCreate($session, 'simple',72, 'product_sku0002', array(
'categories' => array(2),
'websites' => array(1),
'name' => 'Product name',
'description' => 'Product description',
'short_description' => 'Product short description',
'weight' => '10',
'status' => '1',
'url_key' => 'product-url-key',
'url_path' => 'product-url-path',
'visibility' => '4',
'price' => '100',
'tax_class_id' => 1,
'meta_title' => 'Product meta title',
'meta_keyword' => 'Product meta keyword',
'meta_description' => 'Product meta description',
'additional_attributes' => array(
'single_data' => array(
array(
'key' => 'color',
'value' => 'Red', // Id or label of color, attribute that will be used to configure product
)
),
),
));
var_dump ($result);
$result = $client->catalogProductCreate($session, 'configurable',72, 'Configurable_product_sku0001', array(
'categories' => array(2),
'websites' => array(1),
'name' => 'Confihurable Product name',
'description' => 'Product description',
'short_description' => 'Product short description',
'weight' => '10',
'status' => '1',
'url_key' => 'product-url-key',
'url_path' => 'product-url-path',
'visibility' => '4',
'price' => '100',
'tax_class_id' => 1,
'meta_title' => 'Product meta title',
'meta_keyword' => 'Product meta keyword',
'meta_description' => 'Product meta description',
'associated_skus' => array('product_sku0002'),
'price_changes' => array(
array(
'color' => array(
'Red' => '0'
)
),
),
));
var_dump ($result);
?>
Its working fine using this method follow the link
http://www.bubblecode.net/en/2012/04/20/magento-api-associate-simple-products-to-configurable-or-grouped-product/

Cake PHP 2.8.0 not validating

I have the folowing validate inside my Workshops class
public $validate = array(
'programa'=> array(
'allowEmpty' => false,
'required' => true
),
'lugar'=> array(
'allowEmpty' => false,
'required' => true
),
'fecha_inicio'=> array(
'allowEmpty' => false,
'required' => true
),
'fecha_fin'=> array(
'allowEmpty' => false,
'required' => true
),
'objetivo'=> array(
'allowEmpty' => false,
'required' => true
),
'instructor'=> array(
'allowEmpty' => false,
'required' => true
)
);
however when I save with empty fields a record is created in the database, the validation is not being done.
This is the code for my add form
<h1>Agregar Taller</h1>
<?php
echo $this->Form->create('Workshop');
echo $this->Form->input('nombre');
echo $this->Form->input('fecha_inicio',
array(
'label' => 'Fecha Inicio',
'dateFormat' => 'DMYhm',
'minYear' => date('Y') - 0,
'maxYear' => date('Y') + 2,
));
echo $this->Form->input('fecha_fin',
array(
'label' => 'Fecha fin',
'dateFormat' => 'DMYhm',
'minYear' => date('Y') - 0,
'maxYear' => date('Y') + 2,
));
echo $this->Form->input('caracteristica_tec21');
echo $this->Form->input('programa');
echo $this->Form->input('lugar');
echo $this->Form->input('instructor');
echo $this->Form->input('objetivo', array('rows' => '3'));
echo $this->Form->end('Guardar Taller');
?>
And here is my controller
<?php
class WorkshopsController extends AppController {
public $helpers = array('Html', 'Form');
public function index() {
$this->set('workshops',$this->Workshop->find('all'));
}
public function view($id = null){
if(!$id){
throw new NotFoundException(__('Taller inválido'));
}
$workshop = $this->Workshop->findById($id);
if (!$workshop) {
throw new NotFoundException(__('Taller inválido'));
}
$this->set('workshop', $workshop);
}
public function add() {
if ($this->request->is('post')) {
$this->Workshop->create();
if ($this->Workshop->save($this->request->data)) {
$this->Flash->success(__('El taller se ha agregado'));
return $this->redirect(array('action' => 'index'));
}else{
$this->Flash->error(__('No se ha podido agregar el taller'));
}
}
}
}
?>
You suppose to add a message field in every form field's validation, this is the message which shown in view file. Please see the below:
public $validate = array(
'programa' => array(
'allowEmpty' => false,
'required' => true,
'message' => "Please Enter the programa."
),
'lugar' => array(
'allowEmpty' => false,
'required' => true,
'message' => "Please Enter the lugar."
),
'fecha_inicio' => array(
'allowEmpty' => false,
'required' => true,
'message' => "Please Enter the fecha_inicio."
),
'fecha_fin' => array(
'allowEmpty' => false,
'required' => true,
'message' => "Please Enter the fecha_fin."
),
'objetivo' => array(
'allowEmpty' => false,
'required' => true,
'message' => "Please Enter the objetivo."
),
'instructor' => array(
'allowEmpty' => false,
'required' => true,
'message' => "Please Enter the instructor."
)
);
If the answer is correct, Please don't forget to mark it as a answer.

Magento : Add an additional field under order form for admin use only

I need two additional fields for adding additional notes with each order besides comments...
I have trying running this script found on the web
require_once('app/Mage.php');
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
$installer = new Mage_Sales_Model_Mysql4_Setup;
$attribute = array(
'type' => 'text',
'backend_type' => 'text',
'frontend_input' => 'text',
'is_user_defined' => true,
'label' => 'Your attribute label',
'visible' => true,
'required' => false,
'user_defined' => false,
'searchable' => false,
'filterable' => false,
'comparable' => false,
'default' => ''
);
$installer->addAttribute('order', 'your_attribute_code', $attribute);
$installer->endSetup();
But after running and checking the order form there were no additional field beside comments.... any one has any idea about how i could do it..

How to use custom customer variables in transactional email templates in magento?

I have added some custom variables to customer and I want to use them in email template.
Here's example how I have added a variable to customer in my installer:
$setup->addAttribute('customer', 'companyname', array(
'input' => 'text',
'type' => 'varchar',
'label' => 'Company name',
'visible' => 1,
'required' => 1,
'user_defined' => 1,
));
$setup->addAttributeToGroup(
$entityTypeId,
$attributeSetId,
$attributeGroupId,
'companyname',
'999' //sort_order
);
$oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'companyname');
$oAttribute->setData('used_in_forms', array('adminhtml_customer','customer_account_create'));
$oAttribute->save();
I try to use this variable in email template:
{{var order.getCustomer().getCompanyname()}}
But it's not showing. How to make it work?
I done similar task with code like below:
$setup->addAttribute('customer', 'attr_name', array(
'type' => 'int',
'input' => 'select',
'label' => 'Attr label',
'global' => 1,
'visible' => 1,
'required' => 1,
'default' => '0',
'user_defined' => 1,
'visible_on_front' => 1,
));
if (version_compare(Mage::getVersion(), '1.6.0', '<='))
{
$customer = Mage::getModel('customer/customer');
$attrSetId = $customer->getResource()->getEntityType()->getDefaultAttributeSetId();
$setup->addAttributeToSet('customer', $attrSetId, 'General', 'attr_name');
}
if (version_compare(Mage::getVersion(), '1.4.2', '>='))
{
Mage::getSingleton('eav/config')
->getAttribute('customer', 'attr_name')
->setData('used_in_forms', array('customer_account_create'))
->save();
}
Next have tested it (right now) within "Order new" email {{var order.getCustomer().getAttrName()}} and have got correct value.
Try it, might it helps to you.

Resources