Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Facebook Shop Module


Recommended Posts


I'm currently working on a Facebook Shop module that will push Products from OSCommerce to Facebook.

I just need a couple of pointers as to the OSCommerce standards for Module development.

ie. Facebook has 'Google Product Category' as a required field for feeds to its shop.

So I have modified admin/categories.php file to have an extra, Google Category field.

To test it it is currently just a textbox - my next step is to change it to a combobox (linked to a GoogleProductCategory table so users can choose).

However I thought of implementing the ability to choose the Google Product Category in a pop up form (acting like a dialogue box) - so users can choose from a scrollable list with a Search box too.

Would this implementation be frowned upon for an OSCommerce module?

Am I moving too far away from the standards and adding to much customisation / proprietary code using a popup dialogue box?

Screenshot_2019-10-21 osCommerce Online Merchant Administration Tool.png

Edited by rebelsheep
Link to comment
Share on other sites

Currently the Google Category field has the GoogleProductCategoryID - the user in the combobox or listbox would see the Category choice itself (with the id as the hidden field / value, when chosen).

So the Category would show as something like:

Electronics > Electronics Accessories > Computer Components > Storage Devices > Disk Duplicators

You can see with the length of some of these why I was considering a dialog box (implementing a treeview) as a solution rather than a combox!

Link to comment
Share on other sites

My advice is, always;

  1. make for your own needs
  2. if possible try to do it without core code changes
    this simply makes things easier in the future for upgrading
    also makes it easier to share with others

If it was me;

  • I'd create a spreadsheet with the ID and full name of the taxonomy - spreadsheets are easy to keep updated if google decide to change taxonomies...
  • I'd create a dropdown box using the spreadsheet data
    this box would do exactly as your input box performs, just update the category_id appropriately

Keep It Simple.

Link to comment
Share on other sites

Hi burt,

That's good advice. Google release their taxonomy as a plain txt file or as an exel spreadsheet - so if I used the speadsheet as the source, then it would be one less step for OSCommerce developers (no need for them to import into the OSCommerce database - should the Taxonomy be updated by Google). So I see your point.

Regarding the drop downlist/combo...

I think I will strike a balance between simplicity and usability. I think a one plain dropdown box to navigate the taxonomy would be too limited from a usability point of you (great from a simplicity pecrspective, though).

Instead I am going to implement a 'Google Category Chooser' dialog - which will allow users to drill down through the 6 levels of the taxonomy via listboxes (pretty much a copy of how ebay does it, who actually use <ul>s to miminic listboxes).

If there are integration issues further down the line if rolling it out as a module for the community to use, then I can address them then after feedback from the community. The main issue I can see is the Dialog code - which may need to be standardised and added as a feature for OSCommerce developers in the future (a dialog class??).


Link to comment
Share on other sites

Hello @rebelsheep,

A little code can help you about the taxonomy. It's better to redirect via blank page to the taxonomy page.

        $content = '<div class="row" id="GoogleTaxonomy">';
        $content .= '<div class="col-md-12">';
        $content .= '<div class="form-group row">';
        $content .=  TEXT_GOOGLE_TAXONOMY;
        $content .= '<div class="col-md-6">';
        $content .= tep_draw_input_field('google_taxonomy_id', $google_taxonomy_id) . ' ';
        $content .= '<a href="http://www.google.com/basepages/producttype/taxonomy-with-ids.en-US.txt" target="_blank"><i class="fas fa-external-link-square-alt"></i></a>';
        $content .= '</div>';
        $content .= '</div>';
        $content .= '</div>';
        $content .= '</div>';

        echo $content;




Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum


Link to comment
Share on other sites

  • 2 weeks later...

I'm coding this by getting data via a jquery ajax call which gets that taxonomy data I want by calling a separate php page.....

            data:{level:level, selected_text:selectedText},
            success:function(result){ .... }

All works fine, but I want getTaxonomyData.php to use the OSCommerce database functions.

How do I access these without putting the whole require('includes/application_top.php'); at the top of the code.

How do I use tep_db_query and tep_db_fetch_array as well as getting the variables to the database connection?

Link to comment
Share on other sites

Just a question to you take in consideration the multilanguage about the taxonomy ?
Make an ajax can be slow
Note phoenix use the Hooks, call a hooks can be the best approach without to include code inside the source. look this way.
=> But need the latest version.


Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...