Jump to content
  • 0

Ek Preis Mit Artikel Id Und Name Exportieren / Ek In Produktübersicht


Lausli

Question

Hallo,

 

ich überlege gerade, wie ich den Großhandelspreis / EK mit exportieren kann:

  post-1091593-0-87363900-1458044135_thumb.png

 

Wenn es da mit drinnen wäre, könnte ich es ja mit exportieren.

 

Alternative:

SELECT a.`id_product`, b.`name` AS `name`, `reference`, a.`price` AS `price`, sa.`active` AS `active` , shop.`name` AS `shopname`, a.`id_shop_default`, image_shop.`id_image` AS `id_image`, cl.`name` AS `name_category`, sa.`price`, 0 AS `price_final`, a.`is_virtual`, pd.`nb_downloadable`, sav.`quantity` AS `sav_quantity`, sa.`active`, IF(sav.`quantity`<=0, 1, 0) AS `badge_danger`, (select count(*) from `ps_statistics_wallposts` pstwitterpost_swp where pstwitterpost_swp.id_product = a.id_product and b.`id_shop` = pstwitterpost_swp.id_shop) as count_wallposts FROM `ps_product` a LEFT JOIN `ps_product_lang` b ON (b.`id_product` = a.`id_product` AND b.`id_lang` = 1 AND b.`id_shop` = 1) LEFT JOIN `ps_stock_available` sav ON (sav.`id_product` = a.`id_product` AND sav.`id_product_attribute` = 0 AND sav.id_shop = 1 AND sav.id_shop_group = 0 ) JOIN `ps_product_shop` sa ON (a.`id_product` = sa.`id_product` AND sa.id_shop = a.id_shop_default) LEFT JOIN `ps_category_lang` cl ON (sa.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = a.id_shop_default) LEFT JOIN `ps_shop` shop ON (shop.id_shop = a.id_shop_default) LEFT JOIN `ps_image_shop` image_shop ON (image_shop.`id_product` = a.`id_product` AND image_shop.`cover` = 1 AND image_shop.id_shop = a.id_shop_default) LEFT JOIN `ps_image` i ON (i.`id_image` = image_shop.`id_image`) LEFT JOIN `ps_product_download` pd ON (pd.`id_product` = a.`id_product`) WHERE 1 ORDER BY a.`id_product` ASC LIMIT 0, 50

Wie kann ich da den EK mit einfügen, das der mit ausgegeben wird?

 

Danke!

Edited by Lausli (see edit history)
Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Also so hier dann:

 

SELECT a.`id_product`, b.`name` AS `name`, `reference`, a.`price` AS `price`, sa.`active` AS `active` , shop.`name` AS `shopname`, a.`id_shop_default`, image_shop.`id_image` AS `id_image`, cl.`name` AS `name_category`, sa.`price`, 0 AS `price_final`, a.`is_virtual`, pd.`nb_downloadable`, sav.`quantity` AS `sav_quantity`, sa.`active`, IF(sav.`quantity`<=0, 1, 0) AS `badge_danger`, (select count(*) from `ps_statistics_wallposts` pstwitterpost_swp where pstwitterpost_swp.id_product = a.id_product and b.`id_shop` = pstwitterpost_swp.id_shop) as count_wallposts FROM `ps_product` a LEFT JOIN `ps_product_lang` b ON (b.`id_product` = a.`id_product` AND b.`id_lang` = 1 AND b.`id_shop` = 1),a.wholesale_price AS `EK` AS `EK` LEFT JOIN `ps_stock_available` sav ON (sav.`id_product` = a.`id_product` AND sav.`id_product_attribute` = 0 AND sav.id_shop = 1 AND sav.id_shop_group = 0 ) JOIN `ps_product_shop` sa ON (a.`id_product` = sa.`id_product` AND sa.id_shop = a.id_shop_default) LEFT JOIN `ps_category_lang` cl ON (sa.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = a.id_shop_default) LEFT JOIN `ps_shop` shop ON (shop.id_shop = a.id_shop_default) LEFT JOIN `ps_image_shop` image_shop ON (image_shop.`id_product` = a.`id_product` AND image_shop.`cover` = 1 AND image_shop.id_shop = a.id_shop_default) LEFT JOIN `ps_image` i ON (i.`id_image` = image_shop.`id_image`) LEFT JOIN `ps_product_download` pd ON (pd.`id_product` = a.`id_product`) WHERE 1 ORDER BY a.`id_product` ASC LIMIT 0, 50

 

?

 

Naja die Hochkommas sind direkt beim Export im Shop dabei. Also "SQL-Anfrage exportieren.

Edited by Lausli (see edit history)
Link to comment
Share on other sites

  • 0

Hallo Lausli,

 

der Einkaufspreis steht in der tabelle ps_product

Du müsstest also in deiner sql Abfrage an der Stelle an der der Preis erscheinen soll so etwas einbauen:

a.wholesale_price AS "EK"

Ich verstehe allerdings die Hochkommas in deiner sql-Abfrage nicht - funktioniert das so denn?

 

Anyway, du kannst zum Testen ja mal diese sql-Abfrage probieren, da zeigt er dir Preis u. EK:

SELECT a.id_product, a.price AS "PREIS", a.wholesale_price AS "EK"
    FROM ps_product a
   

Grüsse

Whiley

Link to comment
Share on other sites

  • 0

Ja, also mit den Hochkommas im SQL Manager geht es.

Aber wenn ich den EK versuche einzubinden bekomme ich das:

"Die Datenbanktabelle "a.wholesale_price" existiert nicht."

 

Das aber geht:

SELECT a.id_product, a.price AS "PREIS", a.wholesale_price AS "EK"
FROM ps_product a

 

Dazu brauche ich halt noch name, Beschreibung, menge 

Edited by Lausli (see edit history)
Link to comment
Share on other sites

  • 0

a.wholesale_price AS "EK" muß noch in die select-Anweisung, Setze es doch versuchsweise ganz oben hinter select ein, dann mit Komma abtrennen und das AS "EK" darf nicht doppelt sein.

 

Bei mir läuft die ganze Abfrage - wohl wegen der seltsamen Hochkommas - nicht!

 

Grüsse

Whiley

Link to comment
Share on other sites

  • 0

komisch, diese hochkomma sind wie gesagt direkt von Prestashop beim SQL Export dabei

 

Das hier hat funktioniert:

SELECT  a.`wholesale_price`  AS `EK`,
a.`id_product`, 
       b.`name`                                             AS `name`, 
       `reference`, 
       a.`price`                                            AS `price`, 
       sa.`active`                                          AS `active`, 
       shop.`name`                                          AS `shopname`, 
       a.`id_shop_default`, 
       image_shop.`id_image`                                AS `id_image`, 
       cl.`name`                                            AS `name_category`, 
       sa.`price`, 
       0                                                    AS `price_final`, 
       a.`is_virtual`, 
       pd.`nb_downloadable`, 
       sav.`quantity`                                       AS `sav_quantity`, 
       sa.`active`, 
       IF(sav.`quantity` <= 0, 1, 0)                        AS `badge_danger`, 
       (SELECT Count(*) 
        FROM   `ps_statistics_wallposts` pstwitterpost_swp
        WHERE  pstwitterpost_swp.id_product = a.id_product 
               AND b.`id_shop` = pstwitterpost_swp.id_shop) AS count_wallposts 

			   
FROM   `ps_product` a 
       LEFT JOIN `ps_product_lang` b 
              ON ( b.`id_product` = a.`id_product` 
                   AND b.`id_lang` = 1 
                   AND b.`id_shop` = 1 ) 
       LEFT JOIN `ps_stock_available` sav 
              ON ( sav.`id_product` = a.`id_product` 
                   AND sav.`id_product_attribute` = 0 
                   AND sav.id_shop = 1 
                   AND sav.id_shop_group = 0 ) 
       JOIN `ps_product_shop` sa 
         ON ( a.`id_product` = sa.`id_product` 
              AND sa.id_shop = a.id_shop_default ) 
       LEFT JOIN `ps_category_lang` cl 
              ON ( sa.`id_category_default` = cl.`id_category` 
                   AND b.`id_lang` = cl.`id_lang` 
                   AND cl.id_shop = a.id_shop_default ) 
       LEFT JOIN `ps_shop` shop 
              ON ( shop.id_shop = a.id_shop_default ) 
       LEFT JOIN `ps_image_shop` image_shop 
              ON ( image_shop.`id_product` = a.`id_product` 
                   AND image_shop.`cover` = 1 
                   AND image_shop.id_shop = a.id_shop_default ) 
       LEFT JOIN `ps_image` i 
              ON ( i.`id_image` = image_shop.`id_image` ) 
       LEFT JOIN `ps_product_download` pd 
              ON ( pd.`id_product` = a.`id_product` ) 

Danke!

Link to comment
Share on other sites

  • 0

Interessant ...

 

Und woher stammt bei dir die Datenbanktabelle ps_statistics_wallposts, auf die der eingebettete SELECT-Befehl zugreift? PrestaShop in der Standadardversion kennt so eine Tabelle überhaupt nicht. Fehlerfrei abspeichern kann ich die Abfrage nämlich auch mit Phantasie-Tabellen, die es überhaupt nicht in der DB gibt. Zum Beispiel gibt es auch hier keine Fehlermeldung:

(SELECT Count(*)         FROM   `ps_pimperdichselbst` pumpernickel_swp        WHERE  pumpernickel_swp.id_product = a.id_product                AND b.`id_shop` = pumpernickel_swp.id_shop) AS count_wasauchimmer
Es gibt zwar keine Fehlermeldung, aber exportiert wird natürlich absolut nichts - nicht einmal die Spaltennamen.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...