-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot add a position_in_category using webservices #14903
Comments
Hi @lewis2413, I manage to reproduce the issue with PS1.7.6.0 & PS1.7.5.2.
I’ll add this to the debug roadmap so that it’s fixed. If you have already fixed it on your end or if you think you can do it, please do send us a pull request! |
Hi,
It´s imposible to change the position of a product inside a category using
the originals methods from the prestashop api, when i launch a request
internaly i dont what it does, but it changes the custom position and it
always add +1 to my position.
*--*
*Saludos Cordiales*
*Ing. Jose Luis Idrogo*
Movil: +34 678 878385
Email: [email protected]
Web Site: http://www.edisa.com/
* <http://www.edisa.com/>*
*MADRID - BARCELONA - VIGO - OVIEDO - OURENSE - LAS PALMAS - MEXICO -
COLOMBIA - ECUADOR - REP. DOMINICANA - PANAMÁ*
*------------------------------CONFIDENCIALIDAD:* Este mensaje se dirige
exclusivamente a su destinatario y puede contener información privilegiada
o confidencial. Si no es vd. el destinatario indicado, queda notificado de
que la utilización, divulgación y/o copia sin autorización está prohibida
en virtud de la legislación vigente. Si ha recibido este mensaje por error,
le rogamos que nos lo comunique inmediatamente por esta misma vía y proceda
a su destrucción.
Antes de imprimir este mensaje, asegúrate de que es necesario. Proteger el
medio ambiente está también en tu mano.
El mar., 30 jul. 2019 a las 13:24, khouloudbelguith (<
[email protected]>) escribió:
… Hi @lewis2413 <https://github.com/lewis2413>,
I manage to reproduce the issue with PS1.7.6.0 & PS1.7.5.2.
I attached a screen record
https://drive.google.com/file/d/1kTDiNC19Xk5kd0m-vhijwK9axB8laymI/view
I used this script to update the position of a product
<title>CRUD Tutorial - Create example</title>
<?php
/**
* Created by PhpStorm.
* User: khouloud.belguith
* Date: 30/09/17
* Time: 11:58
*/
define('DEBUG', true);
ini_set('display_errors','on');
define('PS_SHOP_PATH', 'http://shop.com');
define('PS_WS_AUTH_KEY', 'Key');
require_once('PSWebServiceLibrary.php');
$webService= new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);
$id = 23;
$category_id = 3;
$xml = $webService->get(array('resource' => 'products', 'id' => $id));
unset($xml->product->manufacturer_name);
unset($xml->product->quantity);
$product = $xml->children()->children();
$product->name->language[0][0] = "Produit webservice";
$product->description->language[0][0] = "Description produit webservice";
$product->price = 1.121;
$product->position_in_category = 1;
//I don't update XML, i just resend it here
$opt['putXml'] = $xml->asXML();
$opt['id'] = $id;
$opt['category_id'] = $category_id;
$opt['resource'] = 'products';
$xml = $webService->edit($opt);
echo "DONE";
I’ll add this to the debug roadmap so that it’s fixed. If you have already
fixed it on your end or if you think you can do it, please do send us a
pull request!
Thanks!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#14903?email_source=notifications&email_token=ALJTE6GSTL2PSUQ6UF3QK3TQCAQF3A5CNFSM4IHUNAOKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3DU2XA#issuecomment-516377948>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALJTE6FYHGKQXUNTKNVFVZLQCAQF3ANCNFSM4IHUNAOA>
.
|
Hi good afternoon, @khouloudbelguith Do you have any feedback about this problem? i´m contacting to you because we need some solution about this bug.. I'll hope your comments thanks advance |
Hi @lewis2413, Sorry, this issue is not yet. |
I'm not sure it's related to this problem but the function setWsCategories() in classes/Product.php looks to work in a wrong way to me. I'm not a pro in PrestaShop code so I won't dare to submit a pull request but I hope those infos will help to fix this issue. |
I've made a PR normally handling this bug : #31342 |
I am getting this bug too... The category is not empty, and I can't set the
Position in category is 4 and in the category I have already 3 products. The problem is that I get a new product without any |
@TomLorenzi Yes, I have already seen that PR, but in my opinion the real problem in that function is that it cannot update a row that doesn't exist in the DB (in the case of a new product created with the Webservice: https://github.com/PrestaShop/PrestaShop/pull/31342/files#diff-e94a594ba740485c7a4882b333984d3932a2f99c0d6d0005620745087cce7a10R7195 I don't think I could find a general solution that could work, because I don't know so much Prestashop. Maybe someone with more experience could help here, for the moment I am just creating the row in my class, where I know (after the product creation) the product ID. |
###Describe the bug
I´m trying to change the position of a product into category using the prestashop api but don´t working for me since that webservice generates a ramdon position skiping that i have done.
To reproduce this error I use the postman tool and the xml product structure
Expected behavior
If we have an empty category and we set position_in_category to 1, the product is added into the category.
Steps to reproduce
1 . have empty category
2 . call API to create a product into that category passing position_in_category equals to 1.
Acceptance Test
Unskip tests
PrestaShop/tests/UI/campaigns/functional/WS/02_productsCRUD.ts
Lines 442 to 443 in d6bd458
PrestaShop/tests/UI/campaigns/functional/WS/02_productsCRUD.ts
Lines 1123 to 1124 in d6bd458
Additional information
PrestaShop version: 1.7.5.0 & 1.7.8.8
PHP version: 7.0.33
The text was updated successfully, but these errors were encountered: