VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: gigamarr on October 14, 2019, 19:22:17 PM

Title: Trying to add product with python using requests library
Post by: gigamarr on October 14, 2019, 19:22:17 PM
Hello, my goal is to be able to send data from remote python server and add products to virtuemart that way (which of  course is located on another server).

My script does following: (using python requests library)
1. goes to domain.com/administrator/index.php
2. logs in successfully
3. goes to /index.php?option=com_virtuemart&view=product&task=edit&virtuemart_product_id=0 and sends POST data to this url

step 3 goes by without any errors but i don't see new products being added, for now i'm only sending "product_name", and predefined values of hidden inputs with names: task, option, boxchecked, controller, view and one more input which doesn't have a static name, I think it's csrf token, I'm sending that as well. Is what I'm trying to achieve possible with this approach? any guidance is appreciated
Title: Re: Trying to add product with python using requests library
Post by: pinochico on January 30, 2020, 12:07:29 PM
- Use python script for creating XML file and this file import to Virtuemart
- Use eMagic for write to DB
Title: Re: Trying to add product with python using requests library
Post by: Studio 42 on January 30, 2020, 14:04:49 PM
You have to write your own script to add the product to DB.
Because you need form token and valid user for VM, it's better to use com_ajax for eg and a plugin or use your own Joomla component to add the product to DB