This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function add_combination($data){ | |
global $webService, $config; | |
try{ | |
$xml = $webService->get(array('url' => $config["ps_shop"].'api/combinations?schema=blank')); | |
$combination = $xml->children()->children(); | |
$combination->associations->product_option_values->product_option_values[0]->id = $data["option_id"]; | |
$combination->reference = $data["code"]; | |
$combination->id_product = $data["id_product"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Convert a SimpleXML object to an associative array | |
* | |
* @param object $xmlObject | |
* | |
* @return array | |
* @access public | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"estados": [ | |
{ | |
"sigla": "AC", | |
"nome": "Acre", | |
"cidades": [ | |
"Acrelândia", | |
"Assis Brasil", | |
"Brasiléia", | |
"Bujari", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Converts a simpleXML element into an array. Preserves attributes and everything. | |
* You can choose to get your elements either flattened, or stored in a custom index that | |
* you define. | |
* For example, for a given element | |
* <field name="someName" type="someType"/> | |
* if you choose to flatten attributes, you would get: | |
* $array['field']['name'] = 'someName'; | |
* $array['field']['type'] = 'someType'; | |
* If you choose not to flatten, you get: |