phpopencartosclass

osclass - latest premium items in a XML/PHP/HTML file in html format


Requirement:

I have to write a script that calls latest premium items on the home page of OpenCart from OsClass.

My directory structure:

OpenCart is installed on the root of website, and OsClass is installed inside classifieds folder in the root.

../public_html/ (OpenCart is installed here)
../public_html/classifieds (OsClass is installed here)

Website URL's:

www.example.com (OpenCart based main website)
www.example.com/classifieds (OsClass based Classifieds)

I basically need help from any senior, in finalizing the perfect method to get above requirement fulfilled.


Solution

  • Include this on the homepage of Opencart

    <?php
    require_once 'classifieds/oc-load.php';
    $items = osc_query_item('premium=1');
    // DISPLAY HERE $items AS YOU WANT
    // print_r($items);
    ?>
    

    Take a look at the function osc_query_item, you may want to modify the params to do display other items https://github.com/conejoninja/Osclass/blob/master/oc-includes/osclass/helpers/hItems.php#L1353