Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

PrestaShop cannot export sql query results to a CSV file in SQL Manager

Posted on 2013-12-05
1
Medium Priority
?
2,009 Views
Last Modified: 2013-12-10
We're using PrestaShop 1.5.4.1

We try to export the list of all the products into a csv file by using a custom sql query in SQL Manager.

Following query works well if you just VIEW it. But when it comes to export the results to a CSV file by clicking the first button next to the query, you get the whole sql query string itself inside a csv file. No results, just the query itself.

SELECT p.id_product, p.active, pl.name, GROUP_CONCAT(DISTINCT(cl.name) SEPARATOR ",") as categories, p.price, p.id_tax_rules_group, p.wholesale_price, p.reference, p.supplier_reference, p.id_supplier, p.id_manufacturer, p.upc, p.ecotax, p.weight, p.quantity, pl.description_short, pl.description, pl.meta_title, pl.meta_keywords, pl.meta_description, pl.link_rewrite, pl.available_now, pl.available_later, p.available_for_order, p.date_add, p.show_price, p.online_only, p.condition, p.id_shop_default 
FROM ps_product p 
LEFT JOIN ps_product_lang pl ON (p.id_product = pl.id_product) 
LEFT JOIN ps_category_product cp ON (p.id_product = cp.id_product) 
LEFT JOIN ps_category_lang cl ON (cp.id_category = cl.id_category) 
LEFT JOIN ps_category c ON (cp.id_category = c.id_category) 
LEFT JOIN ps_product_tag pt ON (p.id_product = pt.id_product) 
WHERE pl.id_lang = 1 
AND cl.id_lang = 1 
AND p.id_shop_default = 1 AND c.id_shop_default = 1 
GROUP BY p.id_product

Open in new window


I don't think that it is related with the sql query itself because I also tried exporting with a single line basic sql query but it didn't work. I also tried different browsers, nothing changed.

Thanks in advance.
0
Comment
Question by:sbayrak
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
sbayrak earned 0 total points
ID: 39709012
Ok. I found the problem.

When I checked the http error log file of the web server, I saw the following lines;
"PHP Warning:  fopen(/.../export/request_sql_1.csv): failed to open stream: Permission denied in /.../controllers/admin/AdminRequestSqlController.php on line xxx, referer: http://www.mysite.com/..."

That means Prestashop cannot generate the csv file inside "export" folder.

Navigating to the admin folder and setting the owner of the export folder as www solves the issue.
# chown www:www export
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
While opting for any web-to-print solution, you need to discuss with your team and some of your end users and know their opinions about your decisions. In this article we list down some questions you need to ask yourself.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question