• Resolved Bloke

    (@bloke)


    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)
  • Thread Starter Bloke

    (@bloke)

    Not sure what this means. And I tried searching Google for it.
    $catt = DatabaseObject::tablename(Category::$table);
    If I can understand that this line of code is doing then I might be able to pull the name of the image from wp_mycart_meta If I echo $clog I will get ‘wp_mycart_catalog’ I did a search in source code for any reference to wp_mycart_catalog and couldn’t find any.

    Thread Starter Bloke

    (@bloke)

    I am getting closer.
    <?php echo $Product->ivalue;?>
    I get this value and all I need is the value of s27 How can I do that:

    O:8:"stdClass":10:{s:4:"mime";s:10:"image/jpeg";s:4:"size";s:5:"14737";s:7:"storage";s:9:"FSStorage";s:3:"uri";s:27:"cache_276_260__100_A130.jpg";s:8:"filename";s:27:"cache_276_260_100_A130.jpg";s:5:"width";s:3:"258";s:6:"height";s:3:"260";s:3:"alt";s:0:"";s:5:"title";s:0:"";s:8:"settings";a:6:{s:5:"width";i:276;s:6:"height";i:260;s:5:"scale";i:0;s:7:"sharpen";i:100;s:7:"quality";b:0;s:4:"fill";b:0;}

    Thread Starter Bloke

    (@bloke)

    `<?php $array = unserialize($Product->ivalue); echo $array[0]; ?>’

    I tried this and it didn’t work.

    Thread Starter Bloke

    (@bloke)

    Got it to work. There were four parts I had to edit on two pages.

    $imgg = DatabaseObject::tablename('meta');
    imgg.value as ivalue  //In QUERY added this
    $newvalue = unserialize($Product->ivalue);//needed to unserialize
    echo $newvalue->filename // new object created

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Editing a ecommerce query’ is closed to new replies.