Jump to content

RubenMartins

Members
  • Content count

    20
  • Joined

  • Last visited

4 Followers

About RubenMartins

  • Rank
    PrestaShop Newbie

Profile Information

  • Gender
    Male
  • Location
    Portugal
  • Interests
    Develop great web and mobile systems
  • Activity
    Freelancer

Contact Methods

  • Website URL
    https://rubenmartins.pt/
  1. Hi, Anyone know how to hide/remove the wholesale price from an specific role from the back office? Thanks.
  2. Olá comunidade prestashop, Com isto recorro a vocês. Estou a ter um problema com o web service da prestashop e um software externo, encontro-me em desenvolvimento de um website desenvolvido através do prestashop e neste momento encontro-me a desenvolver uma interligação com o web service da prestashop que é disponibilizado através da página http://doc.prestashop.com/display/PS16/Using+the+PrestaShop+Web+Service onde já testei os exemplos e funciona perfeitamente com o recurso "customers" em adicionar/editar/visualizar. Contudo pretendo neste momento gerir os produtos através do web service que irá estar em ligação com um software externo de facturação onde contem todos os produtos e seu dados como stock e preços, para isso faço um pedido ao web service através de get com os seguintes parâmetros $opt = array('url' => PS_SHOP_PATH.'/api/products?display=full&filter[reference]=[XPTO]'); que me devolve os dados do producto com a referencia "XPTO" pois é o dado que existe em concordância no prestashop e software de facturação externo com isso pretendo verificar se o produto existe no prestashop através da referencia e isso funciona depois obtenho também os dados de produto e altero para os dados que obtenho do software externo mas ao tentar enviar o xml já com os dados editados devolve-me o erro "Other error This call to PrestaShop Web Services failed and returned an HTTP status of 400. That means: Bad Request." -------- Este é o codigo completo que estou a usar: <?php // Here we define constants /!\ You need to replace this parameters define('DEBUG', true); define('PS_SHOP_PATH', 'http://www.examplesite.com/prestashop'); define('PS_WS_AUTH_KEY', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'); require_once('PSWebServiceLibrary.php'); //echo phpinfo(); // First : We always get the customer's list or a specific one try { $webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG); $opt = array('url' => PS_SHOP_PATH.'/api/products?display=full&filter[reference]=[FAC6.2454]'); $xml = $webService->get($opt); // Here we get the elements from children of customer markup which is children of prestashop root markup $resources = $xml->children()->children(); //$resources = $xml->children()->children()->children(); } catch (PrestaShopWebserviceException $e) { // Here we are dealing with errors $trace = $e->getTrace(); if ($trace[0]['args'][0] == 404) echo 'Bad Reference'; else if ($trace[0]['args'][0] == 401) echo 'Bad auth key'; else echo 'Other error - '.$e; } // We set the Title echo "<h1>Customer's List</h1>"; echo '<table border="5">'; // if $resources is set we can lists element in it otherwise do nothing cause there's an error if (!empty($resources)) { $data = array(); foreach ($resources->children() as $product => $resource) { echo '<tr><th>'.$product.'</th><td>'; echo '<input type="text" name="'.$product.'" value="'.$resource.'"/>'; echo '</td></tr>'; $data = array_merge($data, array($product => "".$resource)); } if (isset($data['id'])) // Here we check id cause in every resource there's an id { // Here we have XML before update, lets update XML with new values foreach ($resources->children() as $nodeKey => $node) { if($nodeKey=='ean13'){ $resources->children()->ean13 = (int)'123456'; } else{ $resources->children()->$nodeKey = $node; } } // And call the web service try { $opt = array('resource' => 'products'); $opt['putXml'] = $xml->asXML(); $opt['id'] = $data['id']; $xml = $webService->edit($opt); // if WebService don't throw an exception the action worked well and we don't show the following message echo "Successfully updated."; } catch (PrestaShopWebserviceException $ex) { // Here we are dealing with errors $trace = $ex->getTrace(); if ($trace[0]['args'][0] == 404) echo 'Bad ID'; else if ($trace[0]['args'][0] == 401) echo 'Bad auth key'; else echo 'Other error<br />'.$ex->getMessage(); } } } echo '</table>'; ?> --------------- Se possível me ajudem que já tentei varias situações e até ao momento ainda não consegui editar um produto através do web service, contudo os "customers" consigo fazer tudo dai acreditar que não seja problema do servidor/CURL/permissões. Ou me indiquem algum exemplo de como editar um produto através do web service. Obrigado, Rúben Martins
  3. Hi, I'm trying to get an specific product via web service with php and the library from prestashop PSWebServiceLibrary.php. I already try the examples provided from prestashop to get data via web service and work fine getting an product by id but i want to get the product by reference so i can update the data of some products from an external program. I think its something like this in first place but this doesn't work: for ($i = 1; $i <= $total_products; $i++) { try { $webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG); $opt = array('resource' => 'products'); if (isset($_GET['reference'])) $opt['reference'] = $_GET['reference']; $xml = $webService->get($opt); // Here we get the elements from children of customer markup which is children of prestashop root markup $resources = $xml->children()->children(); } catch (PrestaShopWebserviceException $e) { // Here we are dealing with errors $trace = $e->getTrace(); if ($trace[0]['args'][0] == 404) echo 'Bad ID'; else if ($trace[0]['args'][0] == 401) echo 'Bad auth key'; else echo 'Other error'; } } My final program will interacte an existing database from an external program with the daily stocks of products via web service into the web site build with prestashop. So i need to run a loop with all my products in an existing external program and from each product check if exists in the site prestashop by reference and then update the stock of then product and so on.. Can anyone help me? Tanks in advance, Rúben Martins
  4. 700 categories, too slow to modify them on backoffice

    I'm just wondered if someone else has of have similar problem with many categories in the system.... If someone have tested the system with many categories and whats the result...
  5. 700 categories, too slow to modify them on backoffice

    The stranger in this is that i also have around 6000 products in the same system for tests and that as no influence in the changes of any product and i can see one product has must more content to save at any change. And the categories is for about 700 and takes too long to do any change or add a new one. Any cache or some like that i think is not related because i already try the same 700 categories in a new and clean installation of the prestashop 1.5.5.0 and takes about the same time too change anything. I tried also too just import 150 categories for test in the same clean installation of prestashop and that starts too save slower than just with 20/30 categories, so i take the conclusion that is the amount of categories inserted in the system that makes that too long to do some changes. The strangest is that just happen in the categories all the rest work fine.
  6. 700 categories, too slow to modify them on backoffice

    Hi Benjamin, i clear manually that folders and the result is the same unfortunately :/ Hi pzi, i try to do that but that has no result :/ but thanks any way. just for curiosity, that is to do not regenerate the tree of the categories right? because as many categories and sub categories inside the categories, makes sens in theory.
  7. 700 categories, too slow to modify them on backoffice

    Hi to all. First of all tank u both of 3 to answer me, I will try to do the suggestions but maybe just tomorrow morning i will answer u guys. And i know stottycabanas, in this situations this questions needs to be done to clear any dubs but yes i already try to clear Smarty cache and had no effect. But tanks for asking.
  8. O erro pode estar no url que estás a colocar no browser pois nos servidores locais normalmente o url é "locahost/pasta_prestashopXXX" pois o htdocs é por defeito a pasta onde deves colocar os ficheiros e pastas de sites neste caso. Não incluas o htdocs no link.
  9. Hi. U need to change your base URI to "/prestasho_main/" and not "prestasho_main". this if u has the installation on your on line server in a folder "prestasho_main" but if the installation directly in your web server you just need to put "/" in your base URI. This you can made on the folder "config/settings.inc.php" in the line "define(‘__PS_BASE_URI__’, ‘/prestasho_main/’);"
  10. Problem with CSV file import

    for the erro on line 2: "Property Category->name length(115) must be between 0 and 64" It was my mistake. U need also to go to the file located in "folder_of_your_site/classes/Category.php" and for about the 110 line is something like this: " 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCatalogName', 'required' => true, 'size' => 64), " Change it the "64" to the number u input in the database name structure size. for the error on line 6: "Property Category->name not valid" Change the chars encode of the file.csv to utf-8 or try to select the option ISO-8859-1 before import. This will correct the "?" streng chars u are seeing when import.
  11. Hi, Unfortunately i notice also a decrease of the speed the web pages. And with 700 categories in my shop i need to wait a lot to change something in the categories, like 50 seconds with the working shop and also to the same in a new installed shop only with categories inside.
  12. Problem with CSV file import

    The best u can do is to create a structure of categories like this: category1 - sub1_category1 - - sub_sub1_category1 - - sub_sub1_category2 - - - sub_sub1_sub2_category1 - sub_category2 - sub_category3 And with that u will short your categories names. Try that and say to me something. U have another choice but I do not recommend to make that change for visual effect in the front office and may cause some problems in the database in a medium/long time of the live of the shop..... The error is that the name off each group of the name of the category is to long must be between 0 and 64 if u what to jump that u need to go to the database and change the structure of the column "name" in the table "xxxxxx_category_lang" to about 200 because i see errors with 155 chars.
  13. Problem with CSV file import

    Please post an image with the import file open in a notepad please. And another with the preview of the import before import the CSV, the second form after u made all the configurations on the third print-screen u post on your first post of this topic.
×