Skip to content

Instantly share code, notes, and snippets.

@is-just-me
is-just-me / test_functions.php
Last active November 15, 2022 07:36
Create combinations,products and update stock with Prestashop WEBSERVICE
<?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"];
@jasondmoss
jasondmoss / simpleXmlToArray.php
Last active June 22, 2022 21:12
Convert a SimpleXML object to associative array
<?php
/**
* Convert a SimpleXML object to an associative array
*
* @param object $xmlObject
*
* @return array
* @access public
*/
@letanure
letanure / estados-cidades.json
Last active June 18, 2024 01:48
JSON estados cidades do brasil, dividido por estados. segunda lista atualizada em 2020, dados do IBGE
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
@yeroon
yeroon / simpleXmlToArray
Created April 18, 2011 14:45
Converts a simpleXML element into an array. Preserves attributes and everything.
/**
* 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: