rebelsheep Posted October 21, 2019 Share Posted October 21, 2019 (edited) Hi, 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? Edited October 21, 2019 by rebelsheep Quote Link to comment Share on other sites More sharing options...
rebelsheep Posted October 21, 2019 Author Share Posted October 21, 2019 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! Quote Link to comment Share on other sites More sharing options...
burt Posted October 21, 2019 Share Posted October 21, 2019 My advice is, always; make for your own needs 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. rebelsheep 1 Quote Link to comment Share on other sites More sharing options...
rebelsheep Posted October 22, 2019 Author Share Posted October 22, 2019 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??). Quote Link to comment Share on other sites More sharing options...
♥Gyakutsuki Posted October 22, 2019 Share Posted October 22, 2019 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; rebelsheep 1 Quote Regards ----------------------------------------- Loïc Contact me by skype for business Contact me @gyakutsuki for an answer on the forum Link to comment Share on other sites More sharing options...
rebelsheep Posted October 22, 2019 Author Share Posted October 22, 2019 (edited) Thanks Gyakutsuki, very useful, I will try your code out. It also highlights an important point - that what I write should use bootstrap to be compliant / relevant. Edited October 22, 2019 by rebelsheep Quote Link to comment Share on other sites More sharing options...
rebelsheep Posted November 5, 2019 Author Share Posted November 5, 2019 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..... $.ajax({ type:'POST', url:'getTaxonomyData.php', 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? Quote Link to comment Share on other sites More sharing options...
♥Gyakutsuki Posted November 6, 2019 Share Posted November 6, 2019 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. Quote Regards ----------------------------------------- Loïc Contact me by skype for business Contact me @gyakutsuki for an answer on the forum Link to comment Share on other sites More sharing options...
rebelsheep Posted November 7, 2019 Author Share Posted November 7, 2019 Ok, thank you for the advice Gyakutsuki - I will have a look at OSCommerce hooks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.