Editing a ecommerce query
-
I am using this ecommerce theme with WordPress and now the company is no longer I can’t get support. There is a admin page that displays Name, Category, Price, Inventory and ID. I am trying to diplay the product image. If I make any changes to the query I get no reults. If I use Meta::$table I get an error that that Meta does not exits. Is there anywhere else I could check? Maybe the $wpd->wp_mycart_meta line is correct but the query is not. The query pulls data from mycart_price and mycart_catalog but I don’t know how it finds those tables. I need to search the mycart_meta
$pd = DatabaseObject::tablename(Product::$table); $pt = DatabaseObject::tablename(Price::$table); $catt = DatabaseObject::tablename(Category::$table); $clog = DatabaseObject::tablename(Catalog::$table); $imgg = DatabaseObject::tablename(Meta::$table); // this I added $imgg = $wpd->wp_mycart_meta // I alo tried this $query = "SELECT $columns $matchcol FROM $pt AS pt LEFT JOIN $pd AS pd ON pd.id=pt.product LEFT JOIN $clog AS clog ON pd.id=clog.product LEFT JOIN $catt AS cat ON cat.id=clog.parent AND clog.type='category' WHERE $where GROUP BY pt.id $having ORDER BY pd.id,pt.sortorder LIMIT $start,$per_page"; $Products = $db->query($query,AS_ARRAY); $productcount = $db->query("SELECT FOUND_ROWS() as total"); } else { $columns = "SQL_CALC_FOUND_ROWS pd.id,pd.name,pd.slug,pd.featured,pd.variations,GROUP_CONCAT(DISTINCT cat.name ORDER BY cat.name SEPARATOR ', ') AS categories, IF(pt.options=0,IF(pt.tax='off',pt.price,pt.price+(pt.price*$taxrate)),-1) AS mainprice, IF(MAX(pt.tax)='off',MAX(pt.price),MAX(pt.price+(pt.price*$taxrate))) AS maxprice, IF(MAX(pt.tax)='off',MIN(pt.price),MIN(pt.price+(pt.price*$taxrate))) AS minprice, IF(pt.inventory='on','on','off') AS inventory, ROUND(SUM(pt.stock)/IF(clog.id IS NULL,1,count(DISTINCT clog.id)),0) AS stock"; if ($workflow) $columns = "pd.id"; $query = "SELECT $columns $matchcol FROM $pd AS pd LEFT JOIN $pt AS pt ON pd.id=pt.product AND pt.type != 'N/A' AND pt.context != 'addon' LEFT JOIN $clog AS clog ON pd.id=clog.product LEFT JOIN $catt AS cat ON cat.id=clog.parent AND clog.type='category' WHERE $where GROUP BY pd.id $having ORDER BY pd.name LIMIT $start,$per_page";
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Editing a ecommerce query’ is closed to new replies.