Search the Community
Showing results for tags 'Mysql'.
-
Hi, I want to make my shop access only for registered users in prestashop 1.6. Anyone please help me to get an idea to implement it? Please don't suggest any paid modules.
-
This is a module for alternative view of indicative information about a server and additionally guidelines for evaluation of its status. Even though there is already a "Information" (in "Advanced Parameters") page with information about the server and there is also "Server Configuration" (by Mediacom87) module available, this module aims to provide a different look and use the information for a quick evaluation. Some information like OpenSSL details and kernel version is missing in the "Information" (in "Advanced Parameters") page of PrestaShop and despite the information being provided in that "Server Configuration" (by Mediacom87) module, it does not provide indication to less knowledgeable people about what this useful information actually means and how it can help. A lot (around a half according to some CMS statistics) of servers are still using officially unsupported software without security updates being provided by official vendor (in some cases since years ago). Extended support by official vendor might be not available either. A part of that problem is the lack of awareness about it by people with less knowledge about servers and how they work. Even though the information about server's software versions can be viewed on "Information" (in "Advanced Parameters") page, there is no clear indication about what those names and numbers actually mean. This modules aims to solve that and provide assistance regarding whether action should be taken or the server is fine for now. altserverinfo.zip
- 1 reply
-
- 1
-
- quick
- alternative
- (and 20 more)
-
Hi All, Greetings of the day. The module helps to integrate Database Management Tool Adminer in the back-office. This helps to run SQL queries, and database backups, and perform various jobs such as SELECT/INSERT/UPDATE/DELETE database tables and columns in tables. Also, get information and search data in different tables and databases. It is a fully functional database administration panel available in many databases. It works with very huge/big database sizes in GB for example 4 GB database. The most frequently used operations are supported by the user interface (managing databases, tables, fields, relations, indexes, users, permissions, etc), while you still have the ability to directly execute any SQL statement. Features Create, drop and alter tables Delete, edit and add fields as well as manage keys on fields Execute any SQL statement Query your databases Manage privileges Export data into various formats Back up and restore your databases Connect to a database server with a username and password Select an existing database or create a new one List fields, indexes, foreign keys and triggers of table Change name, engine, collation, auto_increment, and comment of table Alter name, type, collation, comment and default values of columns Add and drop tables and columns Create, alter, drop and search by indexes including full-text Create, alter, drop and link lists by foreign keys Create, alter, drop and select from views Create, alter, drop and call stored procedures and functions Create, alter and drop triggers List data in tables with search, aggregate, sort and limit results Insert new records, update and delete the existing ones Supports all data types, and blobs through file transfer Execute any SQL command from a text field or a file Export table structure, data, views, routines, and databases to SQL or CSV Print database schema connected by foreign keys Show processes and kill them Display users and rights and change them Display variables with links to documentation Manage events and table partitions (MySQL 5.1) Schemas, sequences, user types (PostgreSQL) Easy to install and use. Nice graphical user interface to perform various database operations on multiple databases. Security using login and password screen. Cross-platform works on all Windows and Linux distributions. Help you interact with your MySQL database easily and effortlessly. Web-Based which means you can access from any computer Local resources aren't used when connecting Simplicity. Compatible with PrestaShop 1.6.x,1.7.x,8.x.x Benefits to Merchants It has a user friendly and intuitive user interface with a little learning curve, meaning that people can use and get used to the functions easily and quickly. It allows users to perform most of the MySQL functions, including managing databases, running MySQL queries, executing SQL statements, managing users and permissions, and many more. It can import data and export data from and to different formats. It is able to alter the stored data into any other formats with the help of predefined functions. Installation Step 1: Upload the module zip file from the back-office Module & Services menu tab. Module Manager area using the upload button. After the successful installation module menu, the link will appear in the left menu or top menu in the back-office more area. Step 2: Install the module using the install button. Step 3: Visit the module management page from the back-office "More" area (section) in the left menu in the back-office. Step 4: The module installation process is very easy, how module configuration works can be seen in a demo instance. Step 5: Please visit our demo instance for module configuration and usage demo. Step 6: Please watch our demo video on our YouTube Channel for module configuration and usage demo. - Module works without making any change in the existing PrestaShop file so that existing customization and theme change do not affect. - We provide free technical and feature support in installation, and configuration, as well as access to updates available for this product. - Free support on installation, configuration, and customization as per store requirements, for example, new hook addition on your store. Other : Please leave your valuable feedback after using the module on this post. This will help to increase self-confidence, improve service, and enhance the module as per requirements to make it better for different online stores. Our Website URL => https://www.presta-addons-modules.com/en/ Pay any amount as per your choice to get the multi-languages,multi-shops, and multi-shop-groups feature in the free addon Download Module and Documentation File. readme_en.pdf sfkdbmanage.zip
-
Estoy creando un docker compose con volúmenes para hacer una snapshot de mi tienda de prestashop (una que gestiono) y así poder hacer pruebas sin afectar directamente la tienda, mi importé los datos de prestashop y mysql pero tengo un problema, no puedo acceder ni a la página de la tienda ni al admin de prestashop. Tengo ya configurado ps_Shop_url para que coincida con la dirección de docker y lo incluí en parameters.php. ¿Agluien sabe alguna configuración extra que tenga que llevar a cabo?
-
- mysql
- prestashop
-
(and 1 more)
Tagged with:
-
I have edited my db connection in app/config/parameter.php I checked in cache/cache and cache/compile there is no cache file however, I still got error with my old user and db setting [PrestaShopException] Link to database cannot be established: SQLSTATE[HY000] [1045] Access denied for user 'wjsneake_pres582'@'localhost' (using password: YES) at line 127 in file classes/db/DbPDO.php anyone, please help
-
nleft and nright values for new categories are 0 . They are not getting updated. the new categories that i create are not visible in the front office in the screenshit you will be able to see the last 4 categories have 0 nleft and nright values .htaccess file has not been changes images for other categories not visible in top horizontal menu rest all categories work fine these new categories are set to be enabled obviously i want to regenerate the category tree---prestashop is not doing it automatically for me
- 16 replies
-
- category tree
- php
-
(and 5 more)
Tagged with:
-
Bonjour, Je viens d'installer PS 8.1, et j'ai fait un test d'import de donnèes directement dans Mysql (en CSV) J'ai choisi quelque chose de simple, en l'occurence la table ps_supplier (dans le BO : Fournisseur), avec 5 colonnes (id, nom, date crea, date maj et active) Pas de soucis avec l'import, les 4 lignes sont bien dans la table Par contre dans le BO, je n'ai qu'une seule ligne, quoi que je fasse (même en dupliquant la ligne directement dans la table) Je pense que je manque quelque chose, sachant que la ligne affichée est la première ligne de la table. J'ai tenté de supprimer le fournisseur pour voir si le fournisseur 2 s'affichait, mais rien du tout je me retrouve avec mon onglet fournisseur vide dans mon back office et encore 3 lignes dans ma table Est ce que quelqu'un a une idée sur la cause ? Merci a vous
-
Hello guys , Hope you all doing good. im working on prestashop 1.7.8.5 and i added a module that override Category Class and CategoryController and i made some changes and evrythink work correctly . the problem is in /home/var/tmp folder .mad files are generated with big sizes and in some cases (not all the time) they are not autodeled wiche is the normal case in mysql so i run into diskspace problem . any ideas please ?
-
Estoy intentando realizar una consulta a la base de datos de PrestaShop (versión 1.5.6.2) para exportar los productos incluyendo las características de este, pero no conozco mucho SQL/MySQL y al intervenir tantas tablas se me está haciendo un poco complejo.. Aunque la consulta es exclusiva según las características de cada tienda, supongo que es un caso común el usar características de productos pensando en que al almacenarse en campos independientes en la base de datos posteriormente se pueden consultar/exportar de forma automática, por lo que entiendo que esta consulta/duda no es nueva, pero por más que busco no doy con la solución.. Si alguien sabría un ejemplo de consulta tipo que poder modificar/adaptar sería muy interesante para necesidades como la mía. Si no a unas malas, cuando la consiga sacar os la paso por aquí Saludos cordiales y gracias!
-
Bonsoir, Après N tentatives pour modifier ma liste de liens, je me suis résolu à "réinitialiser" ce module, mal m'en a pris, le module a alors disparu ! Qu'a cela ne tienne, il me suffisait de le réinstaller depuis le catalogue de module. Là encore, malgré un message de succès, le module n'est pas toujours tout pas disponible dans ma liste de modules. Le module ps_linklist se réinstalle pourtant bien dans le répertoire des modules, mais je n'en vois toutefois pas trace dans ma table ps_tab, ou ps_module (où il devrait être référencé (?)). Quelqu'un aurait t'il une idée pour résoudre ce problème ? Effacer toutes les traces du module et le réinstaller ? quelles sont ls tables impactées par ce module ?, il ya t'il d'autres éléments indispensables ? autres que le diossier module et ces tables ? Merci de votre aide PS 1.7.8.5 Theme classic Pas de modules tiers.
-
- mysql
- liste de liens
-
(and 1 more)
Tagged with:
-
Hello, I'd like to install prestashop using a remote mysql database, hosted by Amazon AWS RDS. I'm at the 5th step of the install assistant, where I need to add the database credentials. I've filled all the inputs, but I still get an error saying the credentials aren't right: Impossible to connect to the database server. Check your login credentials (DbPDO) Just to be sure, I tried to connect to the database using a MySQL client and using the Command Line Interface. It worked with both, so the credentials should be right. Here is what I'm writing (some letters were changed of course): address of the database server: prestadbrds.cdwmpettorfzt.us-east-1.rds.amazonaws.com Name of the database: prestadbrds Username of the database: prestadbusername Password of the databse: XXXXXX prefix of the tables: ps_ And when I click on testing, I get the same error message. Has anyone ever managed to use an AWS RDS database with Prestashop ? Thanks for your help Matthias
-
Hi, In my prestashop backoffice I had set the all products prices as tax_incl and for that products tax_incl is coming. Now I have to change my pricing to specific pricing but in specific pricing I can see only an option like tax_excl price to enter, Because of that the tax is calculating and I want to know how it can be made to tax_incl. Can anyone please help on this?
- 3 replies
-
- prestashop 1.6
- php
-
(and 1 more)
Tagged with:
-
Hola a todos, Estoy intentando instalar prestashop, y todo va bien hasta que llega a la parte de instalación de módulos Addons. Se queda pensando hasta que me sale el siguiente error: " Se ha producido un error durante la instalación... Puede utilizar los enlaces que se encuentran en la columna de la izquierda para volver a los pasos anteriores, o también reiniciar el proceso de instalación haciendo clic aquí. 1: An exception occurred while executing 'SELECT t0.id_tab AS id_tab_1, t0.id_parent AS id_parent_2, t0.position AS position_3, t0.module AS module_4, t0.class_name AS class_name_5, t0.route_name AS route_name_6, t0.active AS active_7, t0.enabled AS enabled_8, t0.hide_host_mode AS hide_host_mode_9, t0.icon AS icon_10 FROM ps_tab t0 WHERE t0.class_name = ? LIMIT 1' with params ["AdminGamification"]: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away " He buscado soluciones pero no encuentro ninguna para mi caso. Podría alguien ayudarme a solucionarlo?? Gracias, un saludo
- 2 replies
-
- prestashop
- prestashop17
-
(and 3 more)
Tagged with:
-
When i go to the new url: http://calcemi.com it redirects in some way to localhost/prestashop. I think it is not a server error but somethinh on the prestashop files, i looked the db from top to bottom and i don't see any configuration beside the one which mentions the prestashop migrating tutorial (already modified). I migrated my prestashop (v1.7.1.2) from localhost/prestashop/ to my new VPS and did all the steps to migrate the prestashop on this post https://www.prestashop.com/en/blog/how-to-migrate-prestashop-to-a-new-server including the database modifications.
-
Hello, I'm trying to use the SQL Manager to list user details (first/last name, email and their country) but i would like the query to only return a certain amount of users. But when i include the LIMIT clause, i get this error message : "The LIMIT clause must contain numeric arguments" This is what my query looks like : SELECT firstname, lastname, email, FROM ps_customer LIMIT 150 Any help is welcome
-
Bonjour à tous, Je suis un peu désespéré car j'ai mon site Prestashop qui ne fonctionne plus du tout. Quand je vais sur l'URL, rien ne s'affiche et impossible d'accéder à l'administration. J'ai regardé au niveau de l'hébergement et j'ai cru comprendre que cela venait de la base de données qui était saturée (200mo). Il me semble avoir compris qu'il s'agissait de certaines tables qui étaient particulièrement volumineuses alors j'ai "empty" celles qui étaient les plus volumineuses - liées au trafic apparemment - mais rien ne change ! J'ai accès au ftp et il me semble que cela peut être réglé via le fichier .htaccess mais je ne sais pas exactement quoi faire. Merci infiniment par avance si vous pouvez m'aider à trouver une solution à mon problème car ça fini par me déprimer je dois avouer... Bien à vous et vous souhaitant une bonne journée.
- 14 replies
-
- database
- white screen
-
(and 3 more)
Tagged with:
-
Hello everyone, I am looking to develop a Prestashop connector (version 1.7) to integrate e-commerce with different ERP's like SAP Business One and Ekon due to my need to have my users, orders, products, categories and so on synchronized in both directions. I am a software developer mainly in Python. I would like to know recommendations, or even find an expert developer for this job and not waste so much time with that.
-
Hi, I want to delete some categories from my Prestashop 1.6 backoffice. Nothing is happening on deletion. When I enable the debug mode from defines.inc.php, then I got below error: PHP Fatal error: Uncaught You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LIMIT 1' at line 4<br /><br /><pre> SELECT m.* FROM `ps_module` m JOIN `ps_module_shop` ms ON (m.`id_module` = ms.`id_module` AND ms.`id_shop` = 1) WHERE m.`id_module` = LIMIT 1</pre> thrown in C:\xampp\htdocs\abcxyz\classes\db\Db.php on line 791 Can someone help me to resolve this?
-
Hello, I am doing a type of sales report through a mysql query. The objective is to create a line for each product (with its corresponding attribute) within a purchase order. With my current query I am able to bring some information, but it is not right. For example, I get multiples for a purchase order, the products are listed but these are repeated by their attributes, and not all the products of the order come out. The mysql query is as follows. Thanks to who can hel me to solve this issue. select distinctrow o.date_add, o.reference, c.firstname, c.lastname, pa.city, ppl.name, GROUP_CONCAT(DISTINCT(pal.name) SEPARATOR ", ") AS combinations, carrier.name, o.payment, p.price ,o.total_discounts, o.valid from ps_orders as o join ps_customer as c on o.id_customer = c.id_customer join ps_cart as cart on cart.id_cart = o.id_cart join ps_cart_product as cartProduct on o.id_cart = cartProduct.id_cart join ps_product as p on cartProduct.id_product = p.id_product join ps_product_lang ppl on ppl.id_product = cartProduct.id_product join ps_address pa on c.id_customer = pa.id_customer join ps_carrier carrier on cart.id_carrier = carrier.id_carrier join ps_product_attribute prodatt on prodatt.id_product = cartProduct.id_product join ps_product_attribute_combination ppac on prodatt.id_product_attribute = ppac.id_product_attribute join ps_attribute a on ppac.id_attribute = a.id_attribute join ps_attribute_lang pal on a.id_attribute = pal.id_attribute join ps_order_detail pod on o.id_order = pod.id_order where pod.id_order = o.id_order GROUP BY ppac.id_product_attribute
-
Hello , I have Prestashop 1.7.5 one VPS with 6GB ram and 100 GB of hard disk. I have a big problem with the performance of the web site . I have a lot of query as this this one :Creating sort index | SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) AS quantity, IFNULL(product_attribute_shop.id_product_attribute, 0) AS id_product_attribute, product_attribute_shop.minimal_quantity AS product_attribute_minimal_quantity, pl.`description`, pl.`description_short`, pl.`available_now`, pl.`available_later`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, image_shop.`id_image` id_image, il.`legend` as legend, m.`name` AS manufacturer_name, cl.`name` AS category_default, DATEDIFF(product_shop.`date_add`, DATE_SUB("2020-07-05 00:00:00", INTERVAL 20 DAY)) > 0 AS new, product_shop.price AS orderprice FROM `pr_category_product` cp LEFT JOIN `pr_product` p ON p.`id_product` = cp.`id_product` INNER JOIN pr_product_shop product_shop ON (product_shop.id_product = p.id_product AND product_shop.id_shop = 1) LEFT JOIN `pr_product_attribute_shop` product_attribute_shop ON (p.`id_product` = product_attribute_shop.`id_product` AND product_attribute_shop.`default_on` = 1 AND product_attribute_shop.id_shop=1) LEFT JOIN pr_stock_available stock ON (stock.id_product = `p`.id_product AND stock.id_product_attribute = 0 AND stock.id_shop = 1 AND stock.id_shop_group = 0 ) LEFT JOIN `pr_category_lang` cl ON (product_shop.`id_category_default` = cl.`id_category` AND cl.`id_lang` = 2 AND cl.id_shop = 1 ) LEFT JOIN `pr_product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = 2 AND pl.id_shop = 1 ) LEFT JOIN `pr_image_shop` image_shop ON (image_shop.`id_product` = p.`id_product` AND image_shop.cover=1 AND image_shop.id_shop=1) LEFT JOIN `pr_image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = 2) LEFT JOIN `pr_manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer` WHERE product_shop.`id_shop` = 1 AND cp.`id_category` = 1306 AND product_shop.`active` = 1 AND product_shop.`visibility` IN ("both", "catalog") ORDER BY cp.`position` ASC LIMIT 0,9 | 0.000 | And server is busy and a lot of time I have a timeout error How I can fix it ? Thanks Luca
-
Witam Mam problem z PrestaShop w wersji 1.6.1.24 – po wejściu w Panel administracyjny nie mogę wejść w zakładki Moduły i Usługi oraz w zakładkę Pozycje i Płatności. Po włączeniu raportowania błędów lub trybu debugowania przez PresteShop z czego dowiedziałem się z tego forum… dostaje takie komunikaty o błędach: „Warning in line 551 in the file /home/hbriijom/public_html/shop/classes/controller/AdminController.php [2] count(): Parameter must be an array or an object that implements Countable Unknown error in line 75 in the file /home/hbriijom/public_html/shop/tools/smarty/sysplugins/smarty_internal_compilebase.php [8192] The each() function is deprecated. This message will be suppressed on further calls Warning in line 3274 in the file /home/hbriijom/public_html/shop/classes/controller/AdminController.php [2] count(): Parameter must be an array or an object that implements Countable Unknown error in line 198 in the file /home/hbriijom/public_html/shop/classes/helper/HelperList.php [8192] Function create_function() is deprecated.” Podsyłam screeny jako załączniki odnośnie błedów jakie mi wyskakują. Prosiłbym o pomoc w rozwiązaniu problemu….
- 30 replies
-
- baza danych mysql
- baza danych
-
(and 4 more)
Tagged with:
-
I have Prestashop v1.6; it's a long-running site with no major problems. I have made no changes recently, no alterations in modules or back office settings, but today I have lost access to the back office. Instead, I have an error page: MySQL Server has gone away. Then: UPDATE `xx_configuration` SET `value` = '1508599399',`date_upd` = '2017-10-21 16:24:25' WHERE `name` = 'PRESTO_CHANGEO_UC' AND (id_shop_group IS NULL OR id_shop_group = 0) AND (id_shop IS NULL OR id_shop = 0) LIMIT 1 Then follows a list of more specific errors. These seem to relate to the Presto Changeo module for CategoryQuantityDiscount (which I use on the site, successfully until now). I'm now having problems regaining Back Office and need some advice. I've tried so far: Checked database size - this is well within permitted requirements by the ISP, rather than being too large. When I attempt to access the back office, the page takes a long time to try to load then times out (I presume) with the error message. I found an old reference to the _UC note in the error that indicates it is something to do with time. One suggestion was to delete cache/class_index.php; I did, it replaced itself but made no difference. The module appears under Modules and also Modules in the Theme. Disabling both by renaming them produces no difference in loading Back Office, but the website itself (which otherwise works) then fails to load correctly Renaming the main Modules folder of course causes a total error for the website loading, but the Back Office now loads (empty of everything but the heading etc, but it does now load) php settings are quite high for timeouts (10000, memory limit 256M) and have worked for many months So I feel stuck. If it is this module (which I don't understand enough about code and stuff to mean that I am correct in what I am trying to do)< as opposed to some other module or group of modules, I cannot solve things by deleting it alone. I'm unsure if the cache is involved - but I'm unclear what I can delete within this (must I keep all the folders, or can I delete every file in the cache and also the theme/cache?). And even in my notes, I'm unsure what to rely on as being a correct thing to have tried. Help please?
- 11 replies
-
- category discount
- presto changeo
-
(and 2 more)
Tagged with:
-
Hola muy buenas, es mi primer tema que escribo y la verdad que no se si lo estoy haciendo bien. Llevo mucho tiempo leyendo vuestras preguntas y respuesta y la verdad que de no saber nada de nada he aprendido mucho de ustedes. Mil gracias. Mi intención RS que a ver mi alguien puede ayudarme a importar un XML a prestas hoy 1.7.2.4. He logrado importar todos los productos perfectamente pero sin imágenes. Solo he conseguido escribir en las tres tablas referentes a dichas imágenes pero no las consigo emparejar con los productos ya que no se como guardarlas en su carpeta correspondiente. El script que estoy intentando hacer funcionar es este. <?php //incluimos funciones simples de imagen //include('config/config.inc.php'); //include('images.inc.php'); //include('classes/controller/AdminController.php'); //include('config/config.inc.php'); //include('controllers/admin/AdminImportController'); //include('controllers/admin/AdminImagesController.php'); //include('SimpleImage.php'); // archivo del import (.xml) $context = stream_context_create(array('https' => array('header' => 'Accept: text/html, application/xhtml+xml,image/jpeg,application/xml;q=0.9, */*;q=0.8'))); $url = 'https://dreamlove.gesio.be/dyndata/exportaciones/csvzip/catalog_1_50_8_0_f2f9102e37db89d71346b15cbc75e8ce_xml_plain.xml'; $xml = file_get_contents($url, false, $context); $xml = simplexml_load_string($xml,null,LIBXML_NOCDATA); //datos de nuestra base de datos $username = "*************"; $password = "*************"; $hostname = "localhost"; //Conexión con la base de datos $dbhandle = mysql_connect($hostname, $username, $password) or die("No se ha podido conectar"); echo "Conectado a MySQL<br><br> "; $selected = mysql_select_db("meycalco_presta", $dbhandle) or die("No se ha podido conectar a Prueba1"); echo "Conectado a Prueba1<br><br> "; //Primero recogemos el valor del % por ciento de la base de datos $incremento_precio = 0; //declaramos la variable que guardara el valor del incremento $sql_increase = "SELECT `value`"; $sql_increase .= " FROM `ps_configuration`"; $sql_increase .= " WHERE `name` "; $sql_increase .= "LIKE 'PS_INCREASE_PRICE'"; //Ejecutamos la sentencia $result = mysql_query($sql_increase) or die("No se ha ejecutado la sentencia select PS_INCREASE_PRICE"); while ($row = mysql_fetch_array($result)) { $incremento_precio = $row{'value'}; } echo "El incremento del precio es " . $incremento_precio . "% "; //funcion para comprobar si la categoria ya existe en la base de datos function comprobarCategoriaExistente($categoria) { //Comprobar si existe categoria $sql = "SELECT * FROM `ps_category_lang` WHERE `name` LIKE '" . $categoria . "'"; $result = mysql_query($sql) or die("No se ha ejecturado la sentencia comprobarCategoriaExistente"); $id_categoria = mysql_num_rows($result); while ($row = mysql_fetch_array($result)) { //Recogemos el id de la categoria $id_categoria = $row{'id_category'}; } echo "El resultado de la busqueda comprobarCategoriaExistente es " . $id_categoria . " "; return $id_categoria; } //funcion para comprobar si el producto ya existe en la base de datos function comprobarExisteProducto($id_articulo) { //comprobamos que el producto existe en el sistema o no $sql = "SELECT * FROM `ps_product` WHERE `reference` LIKE '" . $id_articulo . "'"; $result = mysql_query($sql) or die("No se ha ejecturado la sentencia comprobarExisteProducto"); $id_articulo = mysql_num_rows($result); while ($row = mysql_fetch_array($result)) { //Recogemos el id del producto en la bd $id_articulo = $row{'id_product'}; } echo "El resultado de la busqueda comprobarExisteProducto es " . $id_articulo . " "; return $id_articulo; } //funcion para comprobar si la marca ya existe en la base de datos function comprobarMarcaExistente($marca) { //miramos si existe su marca $sql = "SELECT * FROM `ps_manufacturer` WHERE `name` LIKE '" . $marca . "'"; $result = mysql_query($sql) or die("No se ha ejecturado la sentencia comprobarMarcaExistente"); $id_fabricante = mysql_num_rows($result); while ($row = mysql_fetch_array($result)) { //Recogemos el id de la marca en la bd $id_fabricante = $row{'id_manufacturer'}; } echo "El resultado de la busqueda comprobarMarcaExistente es " . $id_fabricante . " "; return $id_fabricante; } //Creamos una función para cambiar permisos de archivos //funcion para canviar permisos function recursiveChmod($path, $filePerm = 0775, $dirPerm = 0775) { // Check if the path exists if (!file_exists($path)) { //echo "No existe el directorio"; return (false); } // See whether this is a file if (is_file($path)) { // Chmod the file with our given filepermissions chmod($path, $filePerm); // If this is a directory... } elseif (is_dir($path)) { // Then get an array of the contents $foldersAndFiles = scandir($path); // Remove "." and ".." from the list $entries = array_slice($foldersAndFiles, 2); // Parse every result... foreach ($entries as $entry) { // And call this function again recursively, with the same permissions recursiveChmod($path . "/" . $entry, $filePerm, $dirPerm); } // When we are done with the contents of the directory, we chmod the directory itself chmod($path, $dirPerm); } // Everything seemed to work out well, return true return (true); } //funcion que genera y coloca en el directorio correspondiente //los diferentes tamaños de imagen que usa prestashop function save_image($url_image,$id_image) { $array_id_image = str_split($id_image); $num_digits = strlen($id_image); $cadena_url_mod = NULL; for($img= 0;$img>load("".$path . $filename . "." .$img_ext.""); ); $image->resizeToWidth(98,98); $image->save("".$path . $filename . "-small_default." .$img_ext.""); $image2 = new SimpleImage(); $image2->load("".$path . $filename . "." .$img_ext.""); $image2->resizeToWidth(213,120); $image2->save("".$path . $filename . "-home_alysum." .$img_ext.""); $image3 = new SimpleImage(); $image3->load("".$path . $filename . "." .$img_ext.""); $image3->resizeToWidth(124); $image3->save("".$path . $filename . "-home_default." .$img_ext.""); $image4 = new SimpleImage(); $image4->load("".$path . $filename . "." .$img_ext.""); $image4->resizeToWidth(310); $image4->save("".$path . $filename . "-large_alysum." .$img_ext.""); $image5 = new SimpleImage(); $image5->load("".$path . $filename . "." .$img_ext.""); $image5->resizeToWidth(264); $image5->save("".$path . $filename . "-large_default." .$img_ext.""); $image6 = new SimpleImage(); $image6->load("".$path . $filename . "." .$img_ext.""); $image6->resizeToWidth(104); $image6->save("".$path . $filename . "-medium_alysum." .$img_ext.""); $image7 = new SimpleImage(); $image7->load("".$path . $filename . "." .$img_ext.""); $image7->resizeToWidth(58); $image7->save("".$path . $filename . "-medium_default." .$img_ext.""); $image8 = new SimpleImage(); $image8->load("".$path . $filename . "." .$img_ext.""); $image8->resizeToWidth(45); $image8->save("".$path . $filename . "-small_alysum." .$img_ext.""); $image9 = new SimpleImage(); $image9->load("".$path . $filename . "." .$img_ext.""); $image9->resizeToWidth(600); $image9->save("".$path . $filename . "-thickbox_alysum." .$img_ext.""); $image10 = new SimpleImage(); $image10->load("".$path . $filename . "." .$img_ext.""); $image10->resizeToWidth(600); $image10->save("".$path . $filename . "-thickbox_default." .$img_ext.""); chmod($ruta, 0775); $valor_permisos = recursiveChmod ($path, $filePerm=0755, $dirPerm=0775); echo "Se han dado todos los permisos? ".$valor_permisos; return filesize($filex); } //visitamos todos los nodos foreach($xml->product as $product){ $id_articulo = ($product->public_id); $ean = ($product->barcodes->barcode); $categoriaxml = (explode("|",$product->categories->category)); $nombre = mysql_real_escape_string($product->title); $marca = mysql_real_escape_string($product->brand); $descripcion = mysql_real_escape_string($product->html_description); $descripcion_corta = mysql_real_escape_string($product->description); $precio =mysql_real_escape_string($product->price); $precio_tarifa =mysql_real_escape_string($product->cost_price); $stock = mysql_real_escape_string($product->available); $stock_disponible = mysql_real_escape_string($product->stock->location); $img = ($product->images->image); $categoria = utf8_decode($categoriaxml[0]); $subcategoria = utf8_decode($categoriaxml[1]); $subsubcategoria = utf8_decode($categoriaxml[2]); $image = ($img[0]); $image2 = ($img[1]); $image3 = ($img[2]); $image4 = ($img[3]); $image5 = ($img[4]); $image6 = ($img[5]); $image7 = ($img[6]); $image8 = ($img[7]); $image8 = ($img[8]); $image9 = ($img[9]); echo " **** ####Acabado el cargado del articulo<br><br>"; $follow = TRUE; if ($follow) { // Aqui empieza todo el trabajo echo "La subcategoria es<br><br>" . $subcategoria; echo "La categoria es<br><br>" . $categoria; $id_articulo_bd = comprobarExisteProducto($id_articulo); $id_marca = comprobarMarcaExistente($marca); if (!$id_articulo_bd) { echo "El producto no existe en la base de datos "; //si la marca no existe la creamos if (!$id_marca) { //Insertamos la marca en la tabla ps_manufacturer $sql = "INSERT INTO `meycalco_presta`.`ps_manufacturer` (`id_manufacturer` ,`name` ,`date_add` ,`date_upd` ,`active`)"; $sql .= " VALUES (NULL , '" . $marca . "', '" . date("Y-m-d H:i:s") . "', '" . date("Y-m-d H:i:s") . "', '1');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Registro insertado en ps_manufacturer con exito "; } //Debemos de comprobar el id que acabamos de crear $id_marca = comprobarMarcaExistente($marca); //Insertamos la marca en la tabla ps_manufacturer_lang $sql = "INSERT INTO `meycalco_presta`.`ps_manufacturer_lang` (`id_manufacturer` ,`id_lang`)"; $sql .= " VALUES ('" . $id_marca . "' , '3');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Registro insertado en ps_manufacturer_lang con exito "; } //Insertamos la marca en la tabla ps_manufacturer_shop $sql = "INSERT INTO `meycalco_presta`.`ps_manufacturer_shop` (`id_manufacturer` ,`id_shop`)"; $sql .= " VALUES ('" . $id_marca . "' , '1');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Registro insertado en ps_manufacturer_shop con exito "; } } //Aqui empiezan las comprobaciones de las categorias $id_categoria = comprobarCategoriaExistente($categoria); if (!$id_categoria) { echo "La categoria no existe"; $categoria = str_replace("Dreamlovevalentineday", "San Valentin", $categoria); $categoria = str_replace("/", "y", $categoria); $sql = "INSERT INTO `meycalco_presta`.`ps_category` (`id_category` ,`id_parent` ,`id_shop_default`,`level_depth`,`date_add` ,`date_upd` ,`active`,`is_root_category`)"; $sql .= " VALUES (NULL , '2','1','3','" . date("Y-m-d H:i:s") . "', '" . date("Y-m-d H:i:s") . "', '1', '0');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); //Debemos de comprobar el id que acabamos de crear $id_categoria = mysql_insert_id(); $state = true; if ($state) { echo "Registro de categoria insertado en ps_category con exito "; } //Insertamos la categoria en la tabla ps_category_group $sql = "INSERT INTO `meycalco_presta`.`ps_category_group` (`id_category` ,`id_group`)"; $sql .= " VALUES ('" . $id_categoria . "' , '1');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Registro de categoria de grupo insertado en ps_category_group con exito "; } //Insertamos la categoria en la tabla ps_category_group $sql = "INSERT INTO `meycalco_presta`.`ps_category_group` (`id_category` ,`id_group`)"; $sql .= " VALUES ('" . $id_categoria . "' , '2');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Registro 2 de categoria de grupo insertado en ps_category_group con exito "; } //Insertamos la categoria en la tabla ps_category_group $sql = "INSERT INTO `meycalco_presta`.`ps_category_group` (`id_category` ,`id_group`)"; $sql .= " VALUES ('" . $id_categoria . "' , '3');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Registro 3 de categoria de grupo insertado en ps_category_group con exito "; } //Insertamos la categoria en la tabla ps_category_lang $url_categoria = strtolower($categoria); $url_categoria = str_replace(" ", "-", $url_categoria); $sql = "INSERT INTO `meycalco_presta`.`ps_category_lang` (`id_category` ,`id_shop`,`id_lang` ,`name`,`link_rewrite`)"; $sql .= " VALUES ('" . $id_categoria . "' , '1','3','" . $categoria . "','" . $url_categoria . "');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Registro de categoria insertado en ps_category_lang con exito "; } //Insertamos la categoria en la tabla ps_category_shop $url_categoria = strtolower($categoria); $url_categoria = str_replace(" ", "-", $url_categoria); $sql = "INSERT INTO `meycalco_presta`.`ps_category_shop` (`id_category` ,`id_shop`)"; $sql .= " VALUES ('" . $id_categoria . "' , '1');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Registro de categoria insertado en ps_category_shop con exito "; } } //Comprobar si existe la subcategoria y si no crearla, similar al proceso anterior $id_categoria = comprobarCategoriaExistente($categoria); $id_subcategoria = comprobarCategoriaExistente($subcategoria); if ($id_subcategoria > 0) { echo "Hay subcategoria"; $id_subcategoria = comprobarCategoriaExistente($subcategoria); } if ((!$id_subcategoria) && (!empty($subcategoria))) { echo "La subcategoria no existe"; $sql = "INSERT INTO `meycalco_presta`.`ps_category` (`id_category` ,`id_parent` ,`id_shop_default`,`level_depth`,`date_add` ,`date_upd` ,`active`,`is_root_category`)"; $sql .= " VALUES (NULL , '" . $id_categoria . "','1','3','" . date("Y-m-d H:i:s") . "', '" . date("Y-m-d H:i:s") . "', '1', '0');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); //Debemos de comprobar el id que acabamos de crear $id_categoria = mysql_insert_id(); $state = true; if ($state) { echo "Registro de subcategoria insertado en ps_category con exito "; } //Insertamos la categoria en la tabla ps_category_group $sql = "INSERT INTO `meycalco_presta`.`ps_category_group` (`id_category` ,`id_group`)"; $sql .= " VALUES ('" . $id_categoria . "' , '1');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Registro de subcategoria de grupo insertado en ps_category_group con exito "; } //Insertamos la categoria en la tabla ps_category_group $sql = "INSERT INTO `meycalco_presta`.`ps_category_group` (`id_category` ,`id_group`)"; $sql .= " VALUES ('" . $id_categoria . "' , '2');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Registro 2 de subcategoria de grupo insertado en ps_category_group con exito "; } //Insertamos la categoria en la tabla ps_category_group $sql = "INSERT INTO `meycalco_presta`.`ps_category_group` (`id_category` ,`id_group`)"; $sql .= " VALUES ('" . $id_categoria . "' , '3');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Registro 3 de subcategoria de grupo insertado en ps_category_group con exito "; } //Insertamos la categoria en la tabla ps_category_lang $url_subcategoria = strtolower($subcategoria); $url_subcategoria = str_replace(" ", "-", $url_subcategoria); $sql = "INSERT INTO `meycalco_presta`.`ps_category_lang` (`id_category` ,`id_shop`,`id_lang` ,`name`,`link_rewrite`)"; $sql .= " VALUES ('" . $id_categoria . "' , '1','3','" . $subcategoria . "','" . $url_subcategoria . "');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Registro de subcategoria insertado en ps_category_lang con exito "; } //Insertamos la categoria en la tabla ps_category_shop $url_categoria = strtolower($categoria); $url_categoria = str_replace(" ", "-", $url_categoria); $sql = "INSERT INTO `meycalco_presta`.`ps_category_shop` (`id_category` ,`id_shop`)"; $sql .= " VALUES ('" . $id_categoria . "' , '1');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Registro de subcategoria insertado en ps_category_shop con exito "; $id_subcategoria = comprobarCategoriaExistente($subcategoria); } } if (empty($subcategoria)) { echo "No hay subcategoria"; $id_subcategoria = comprobarCategoriaExistente($categoria); } } //Comprobar si existe la subcategoria y si no crearla, similar al proceso anterior $id_subcategoria = comprobarCategoriaExistente($subcategoria); $id_subsubcategoria = comprobarCategoriaExistente($subsubcategoria); if ($id_subsubcategoria > 0) { echo "Hay subcategoria"; $id_subsubcategoria = comprobarCategoriaExistente($subsubcategoria); } if ((!$id_subsubcategoria) && (!empty($subsubcategoria))) { echo "La subcategoria no existe"; $sql = "INSERT INTO `meycalco_presta`.`ps_category` (`id_category` ,`id_parent` ,`id_shop_default`,`level_depth`,`date_add` ,`date_upd` ,`active`,`is_root_category`)"; $sql .= " VALUES (NULL , '" . $id_subcategoria . "','1','3','" . date("Y-m-d H:i:s") . "', '" . date("Y-m-d H:i:s") . "', '1', '0');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); //Debemos de comprobar el id que acabamos de crear $id_subcategoria = mysql_insert_id(); $state = true; if ($state) { echo "Registro de subcategoria insertado en ps_category con exito "; } //Insertamos la categoria en la tabla ps_category_group $sql = "INSERT INTO `meycalco_presta`.`ps_category_group` (`id_category` ,`id_group`)"; $sql .= " VALUES ('" . $id_subcategoria . "' , '1');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Registro de subcategoria de grupo insertado en ps_category_group con exito "; } //Insertamos la categoria en la tabla ps_category_group $sql = "INSERT INTO `meycalco_presta`.`ps_category_group` (`id_category` ,`id_group`)"; $sql .= " VALUES ('" . $id_subcategoria . "' , '2');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Registro 2 de subcategoria de grupo insertado en ps_category_group con exito "; } //Insertamos la categoria en la tabla ps_category_group $sql = "INSERT INTO `meycalco_presta`.`ps_category_group` (`id_category` ,`id_group`)"; $sql .= " VALUES ('" . $id_subcategoria . "' , '3');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Registro 3 de subcategoria de grupo insertado en ps_category_group con exito "; } //Insertamos la categoria en la tabla ps_category_lang $url_subsubcategoria = strtolower($subsubcategoria); $url_subsubcategoria = str_replace(" ", "-", $url_subsubcategoria); $sql = "INSERT INTO `meycalco_presta`.`ps_category_lang` (`id_category` ,`id_shop`,`id_lang` ,`name`,`link_rewrite`)"; $sql .= " VALUES ('" . $id_subcategoria . "' , '1','3','" . $subsubcategoria . "','" . $url_subsubcategoria . "');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Registro de subcategoria insertado en ps_category_lang con exito "; } //Insertamos la categoria en la tabla ps_category_shop $url_subcategoria = strtolower($subcategoria); $url_subcategoria = str_replace(" ", "-", $url_subcategoria); $sql = "INSERT INTO `meycalco_presta`.`ps_category_shop` (`id_category` ,`id_shop`)"; $sql .= " VALUES ('" . $id_subcategoria . "' , '1');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Registro de subcategoria insertado en ps_category_shop con exito "; $id_subsubcategoria = comprobarCategoriaExistente($subsubcategoria); } } if (empty($subsubcategoria)) { echo "No hay subcategoria"; $id_subsubcategoria = comprobarCategoriaExistente($subcategoria); } } if (!$id_articulo_bd) { //definimos las variables del stock if ($stock == '1') { $visibilidad_producto = 1; $disponibilidad = "Disponble"; $total_stock = $stock_disponible; } else { $visibilidad_producto = 0; $disponibilidad = "No disponible"; $total_stock = 0; } echo " Vamos a crear el producto en la base de datos<br><br> "; echo "El producto no existe "; $sql = "INSERT INTO `meycalco_presta`.`ps_product` (`id_product` ,`id_supplier` ,`id_manufacturer`,`id_category_default`,`id_shop_default`,`id_tax_rules_group`,`on_sale`,`minimal_quantity`,`ean13`,`price`,`wholesale_price`,`reference`,`out_of_stock`,`available_for_order`,`condition`,`visibility`,`show_price`,`indexed`,`date_add` ,`date_upd` ,`active`)"; $sql .= " VALUES (NULL , '0','" . $id_marca . "','" . $id_subcategoria . "','1','1','0','1','" . $ean . "','" . $precio . "','" . $precio_tarifa . "','" . $id_articulo . "','2','" . $visibilidad_producto . "','new','both','1','1','" . date("Y-m-d H:i:s") . "', '" . date("Y-m-d H:i:s") . "', '1');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); //Debemos de comprobar el id que acabamos de crear $id_articulo_creado = mysql_insert_id(); $state = true; if ($state) { echo "Registro de producto insertado en ps_product con exito<br><br> "; } $url_producto_alias = strtolower($nombre); $url_producto_alias = str_replace(" ", "-", $url_producto_alias); $sql = "INSERT INTO `meycalco_presta`.`ps_product_lang` (`id_product` ,`id_shop`,`id_lang` ,`description`,`link_rewrite`,`name`,`available_now`)"; $sql .= " VALUES ('" . $id_articulo_creado . "' , '1','3','" . $descripcion . "','" . $url_producto_alias . "','" . $nombre . "','" . $disponibilidad . "');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Registro de producto insertado en ps_product_lang con exito<br><br> "; } //Aquí actualizamos el stock $sql = "INSERT INTO `meycalco_presta`.`ps_stock_available` (`id_stock_available`,`id_product` ,`id_product_attribute` ,`id_shop` ,`id_shop_group` ,`quantity` ,`depends_on_stock` ,`out_of_stock`)"; $sql .= " VALUES (NULL ,'" . $id_articulo_creado . "', '0','1','0','" . $total_stock . "','0','2');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Registro de producto insertado en ps_stock_available con exito<br><br> "; } echo "El id de la categoria es " . $id_subcategoria; $sql = "INSERT INTO `meycalco_presta`.`ps_product_shop` (`id_product`,`id_category_default`,`id_shop`,`id_tax_rules_group`,`on_sale`,`price`,`wholesale_price`,`available_for_order`,`condition`,`visibility`,`show_price`,`indexed`,`active`,`date_add` ,`date_upd` )"; $sql .= " VALUES ('" . $id_articulo_creado . "','" . $id_subcategoria . "','1','1','0','" . $precio . "','" . $precio_tarifa . "','1','new','" . $visibilidad_producto . "','1','1','1','" . date("Y-m-d H:i:s") . "', '" . date("Y-m-d H:i:s") . "');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); //Debemos de comprobar el id que acabamos de crear $state = true; if ($state) { echo "Registro de producto insertado en ps_product_shop con exito<br><br> "; } for($positionimg=0;$positionimg<10;$positionimg++){ if(!empty($image[$positionimg])){ //Primero recogemos la imagen del producto $url_image=$imagen[$positionimg]; if($positionimg==0){ $cover=1; }else{ $cover=0; } //Ahora se crean las imagenes del producto $sql = "INSERT INTO `meycalco_presta`.`ps_image` (`id_image`,`id_product` ,`position` ,`cover`)"; $sql .= " VALUES (NULL ,'".$id_articulo_creado."', '".($img+1)."','1');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; $id_foto_creado = mysql_insert_id(); if ($state) { echo "Registro de producto insertado en ps_image con exito<br><br> "; //save_img($url, $id_foto_creado);<- aquí es donde supongo que tiene que llamar a la función que guarda las imagenes } $sql = "INSERT INTO `meycalco_presta`.`ps_image_lang` (`id_image`,`id_lang`)"; $sql .= " VALUES ('".$id_foto_creado."' ,'3');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Registro de producto insertado en ps_image_lang con exito<br><br> "; } $sql = "INSERT INTO `meycalco_presta`.`ps_image_shop` (`id_product` ,`id_image`,`id_shop`,`cover`)"; $sql .= " VALUES ('".$id_articulo_creado."', '".$id_foto_creado."' ,'1','1');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Registro de producto insertado en ps_image_shop con exito<br><br><br> "; } } } $sql = "INSERT INTO `meycalco_presta`.`ps_category_product` (`id_category`,`id_product`)"; $sql .= " VALUES ('" . $id_subcategoria . "' ,'" . $id_articulo_creado . "');"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Registro de producto insertado en ps_category_product con exito<br><br> "; } } //si el articulo ya existia en la bd actualizamos disponibilidad, precio y stock if ($id_articulo_bd) { echo "El producto si que existe<br><br> "; //Si el producto ya existe comprobaremos el stock y el precio y modificaremos lo necesario if ($stock == '1') { $visibilidad_producto = 1; $disponibilidad = "Disponible"; $total_stock = $stock_disponible; } else { $visibilidad_producto = 0; $disponibilidad = "No Disponible"; $total_stock = $stock_disponible ; } $sql = "UPDATE `meycalco_presta`.`ps_product` SET `price` = '" . $precio . "', `wholesale_price` = '" . $precio_tarifa . "',`available_for_order` = '" . $visibilidad_producto . "',`show_price` = '1' WHERE `id_product` ='" . $id_articulo_bd . "'"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Actualizacion de producto en ps_product realizada<br><br> "; } $sql = "UPDATE `meycalco_presta`.`ps_stock_available` SET `quantity` = '" . $total_stock . "' WHERE `id_product` ='" . $id_articulo_bd . "'"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Actualizacion de producto en ps_stock_available realizada<br><br> "; } $sql = "UPDATE `meycalco_presta`.`ps_product_shop` SET `price` = '" . $precio . "',`wholesale_price` = '" . $precio_tarifa . "',`visibility` = '" . $visibilidad_producto . "',`show_price` = '1' WHERE `id_product` ='" . $id_articulo_bd . "'"; $res = mysql_query($sql, $dbhandle) or die(mysql_error()); $state = true; if ($state) { echo "Actualizacion de producto en ps_product_shop realizada<br><br> "; } } } //función para arreglar el arbol de categorias de prestashop /** * Re-calculate the values of all branches of the nested tree */ function regenerateEntireNtree() { $sql = ' SELECT c.`id_category`, c.`id_parent` FROM `ps_category` c LEFT JOIN `ps_category_shop` cs ON (c.`id_category` = cs.`id_category` AND cs.`id_shop` = 1) ORDER BY c.`id_parent`, cs.`position` ASC'; $result = mysql_query($sql) or die("No se ha ejecturado la sentencia comprobarCategoriaExistente"); $categories = mysql_num_rows($result); $categories_array = array(); while ($category = mysql_fetch_array($result)) { //foreach ($categories as $category){ $categories_array[$category['id_parent']]['subcategories'][] = $category['id_category']; echo "loading $categories_array <br> "; } echo "var_dump <br> "; var_dump($categories_array); $n = 1; if (isset($categories_array[0]) && $categories_array[0]['subcategories']) { _subTree($categories_array, $categories_array[0]['subcategories'][0], $n); } return (TRUE); } //funcion recursiva de regenerateEntireNtree() function _subTree(&$categories, $id_category, &$n) { echo $n . " "; $left = $n++; if (isset($categories[(int) $id_category]['subcategories'])) { echo "we are here <br> "; foreach ($categories[(int) $id_category]['subcategories'] as $id_subcategory) { _subTree($categories, (int) $id_subcategory, $n); } echo "end foreach<br> "; } $right = (int) $n++; echo "UPDATE cat " . $id_category . " left " . $left . " right " . $right . "<br> "; $sql = ' UPDATE `meycalco_presta`.`ps_category` SET `nleft` = ' . (int) $left . ' , `nright` = ' . (int) $right . ' WHERE `id_category` = ' . (int) $id_category . ' '; echo $sql . "<br> "; $res = mysql_query($sql) or die(mysql_error() . "die you biatch"); return (TRUE); } //arreglamos inconsistencias en la tabla categorias de prestashop echo "regenerate tree<br>"; regenerateEntireNtree(); En primer lugar tengo unís includes que he ido probando pero como no llego a ese nivel pues no he conseguido nada. Lo.mismo sol.los archivos correctos pero......jajajaja He hecho una modificación al original ya que no funcionaba y he conseguido importar por lo menos los artículos sin fotos aunque las tablas referentes a las imágenes si que están escritas con sus id solo escribe una ya que como les he dicho no se nada o casi nada de PHP y MySQL no se como he conseguido hacer esto. Si alguien lo quiere probar solo cambiarle el nombre a los fatos de la conexión y en las consultas a la base de datos cambiar los prefijos si son diferentes a los de prestashop. Si alguien pudiera echarme una mano o por lo menos decirme cual es la función simeimage.PHP que no la encuentro en ningún directorio de prestashop y por otro lado donde esta la función que guarda las imágenes en su correspondiente carpeta. Supongo que donde llama a save_img en mi scrip es cuando tiene que guardarla pero.... Muchas gracias a todos por su atención y Disculpadme si no he escrito con mucha claridad. A ver si entre todos podemos hacer funcionar este script ya que hay gente como yo que no tenemos 180 euros para un modulo aunque no digo que en un futuro haiga que comprarlo. Muchas gracias Saludos
-
Bonjour, Suite à un message d'OVH me signalant que je devais faire évoluer ma version de PHP qui était en 5.6, je décide, sans connaissances sur le sujet, de passer à la 7.1, compatible avec Prestashop 1.6... A partir de là, plusieurs dysfonctionnements sont apparus sur le site : plus d'accès, puis plus d'accès aux modules... Je suis revenu en version 5.6, j'ai restauré une version antérieure mais ensuite j'ai un peu paniqué et je ne sais pas revenir à une version stable. Comme le problème semblait être une impossibilité d'écrire pour les modules, je suis allé modifier les attributs avec Filezilla pour mettre les permissions de tous les dossiers à 775 et les fichiers à 664. Maintenant, j'aurais besoin d'aide car ma boutique ne peut plus prendre de commandes et ce n'est pas la bonne période. Help
- 2 replies
-
- prestashop1.6
- mysql
-
(and 2 more)
Tagged with:
-
Bonjour, J'ai remarque en moins de 2 semaines la taille de mon mysql a dépasse plus de 18 Go. AU même moment le phpmyadmin m'affiche 7Go. pourquoi cette différence? comment résoudre ce probleme? merci