Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

TheAquarian

Members
  • Content count

    7
  • Joined

  • Last visited

1 Follower

Profile Information

  • Real Name
    KB
  1. @@DunWeb Thanks for the quick reply! I've gotten as far as the code below, but i'm scratching my head on why it's not operating correctly. No syntax errors, it just wont retrieve the Model, Year and Part after Make is selected. Could you point me in the right direction? Or which segment I need to work on? <?php class bm_year_make_model { var $code = 'bm_year_make_model'; var $group = 'boxes'; var $title; var $description; var $sort_order; var $enabled = false; function bm_year_make_model() { $this->title = MODULE_BOXES_YEAR_MAKE_MODEL_TITLE; $this->description = MODULE_BOXES_YEAR_MAKE_MODEL_DESCRIPTION; if ( defined('MODULE_BOXES_YEAR_MAKE_MODEL_STATUS') ) { $this->sort_order = MODULE_BOXES_YEAR_MAKE_MODEL_SORT_ORDER; $this->enabled = (MODULE_BOXES_YEAR_MAKE_MODEL_STATUS == 'True'); $this->group = ((MODULE_BOXES_YEAR_MAKE_MODEL_CONTENT_PLACEMENT == 'Left Column') ? 'boxes_column_left' : 'boxes_column_right'); } } function execute() { global $SID, $HTTP_GET_VARS, $languages_id, $currencies, $oscTemplate, $Make_selected_var,$Part_selected_var, $Model_selected_var, $Year_selected_var; $Make_Model_Year_query = tep_db_query("select distinct products_car_make from products_ymm where products_car_make != '' and products_car_model != '' and products_car_part != '' and products_car_year_bof !=0 and products_car_year_eof != 0 order by products_car_make, products_car_model, products_car_year_bof, products_car_year_eof"); if ($number_of_rows = tep_db_num_rows($Make_Model_Year_query)) { $Make_array[] = array('id' => 'all', 'text' => 'Make'); while ($Makes = tep_db_fetch_array($Make_Model_Year_query)) { $Make_array[] = array('id' => $Makes['products_car_make'], 'text' => $Makes['products_car_make']); } $Model_array[] = array('id' => 'all', 'text' => 'Model'); if($Make_selected_var!=''){ $Make_Model_Year_query = tep_db_query("select distinct products_car_model from products_ymm where products_car_make = '".$Make_selected_var."' and products_car_model != '' and products_car_year_bof !=0 and products_car_year_eof != 0 '' and products_car_part != order by products_car_make, products_car_model, products_car_year_bof, products_car_year_eof"); while ($Makes = tep_db_fetch_array($Make_Model_Year_query)) { $Model_array[] = array('id' => $Makes['products_car_model'], 'text' => $Makes['products_car_model']); } } $Year_array[] = array('id' => 0, 'text' => 'Year'); if($Model_selected_var!=''){ $Make_Model_Year_query = tep_db_query("select products_car_year_bof, products_car_year_eof from products_ymm where products_car_make = '".$Make_selected_var."' and products_car_model = '".$Model_selected_var."' and products_car_part != '".$Part_selected_var."' and products_car_year_bof !=0 and products_car_year_eof != 0 order by products_car_make, products_car_model, products_car_year_bof, products_car_year_eof"); while ($Makes = tep_db_fetch_array($Make_Model_Year_query)) { $Year_array[] = array('id' => $Makes['products_car_year'], 'text' => $Makes['products_car_year']); } } $Part_array[] = array('id' => 'all', 'text' => 'Part'); if($Year_selected_var!=''){ $Make_Model_Year_query = tep_db_query("select distinct products_car_part from products_ymm where products_car_make = '".$Make_selected_var."' and products_car_model = '".$Model_selected_var."' and products_car_year_bof !=0 and products_car_year_eof != 0 '' and products_car_part != order by products_car_make, products_car_model, products_car_year_bof, products_car_year_eof"); $Makes = tep_db_fetch_array($Make_Model_Year_query); $start = $Makes['products_car_year_bof']; while($start <= $Makes['products_car_year_eof']){ $Year_array[] = array('id' => $start, 'text' => $start); $start++; } } /*$ymm_list = '<div class="ui-widget infoBoxContainer">'; $ymm_list .= '<div class="ui-widget-header infoBoxHeading">'. MODULE_BOXES_YEAR_MAKE_MODEL_TITLE . '</div>'; $ymm_list .= '<div class="ui-widget-content infoBoxContents" style="text-align: center;">';*/ $javascript = '<script language="javascript" type="text/javascript">'; $javascript .= ' function pop_model(){ var sv = document.make_model_year.Make.value; if(sv != "all"){ $.ajax({ type: "POST", url: "ymmajax.php", data: "action=getmodel&make="+sv, success: function(o){ document.getElementById("model_select").innerHTML= o; } }); } else { var o ="<select name=\"Model\" onchange=\"pop_part();\" style=\"width: 100%\"><option value=\"all\">Model</option>"; o+="</select>"; document.getElementById("model_select").innerHTML= o; } document.getElementById("year_select").innerHTML= "<select name=\"Year\" style=\"width: 100%\"><option value=\"0\">Year</option></select>"; document.getElementById("part_select").innerHTML= "<select name=\"Part\" style=\"width: 100%\"><option value=\"all\">Part</option></select>"; } function pop_part(){ var make = document.make_model_year.Make.value; var model = document.make_model_year.Model.value; if(model != "all"){ $.ajax({ type: "POST", url: "ymmajax.php", data: "action=getpart&make="+make+"&model="+model, success: function(o){ document.getElementById("part_select").innerHTML= o; } }); } else { var o ="<select name=\"Model\" onchange=\"pop_year();\" style=\"width: 100%\"><option value=\"all\">Model</option>"; o+="</select>"; document.getElementById("part_select").innerHTML= o; } document.getElementById("year_select").innerHTML= "<select name=\"Year\" style=\"width: 100%\"><option value=\"0\">Year</option></select>"; } function pop_part(){ var make = document.make_model_year.Make.value; var model = document.make_model_year.Model.value; var year = document.make_model_year.Year.value; if(part != "all"){ $.ajax({ type: "POST", url: "ymmajax.php", data: "action=getyear&make="+make+"&model="+model+"∂="+part, success: function(o){ document.getElementById("part_select").innerHTML= o; } }); } else { var o ="<select name=\"Part\" style=\"width: 100%\" onchange=\"document.make_model_year.submit();\"><option value=\"0\">Part</option>"; o+="</select>"; document.getElementById("part_select").innerHTML= o; } } </script>'; if (isset($Make_selected_var) && isset($M_a[$Make_selected_var])){ foreach ($M_a[$Make_selected_var] as $k => $v) $Model_array[] = array('id' => $k, 'text' => $k);} if (isset($Make_selected_var) && isset($Model_selected_var) && isset($M_a[$Make_selected_var][$Model_selected_var])) foreach ($M_a[$Make_selected_var][$Model_selected_var] as $k => $v) $Year_array[] = array('id' => $k, 'text' => $k); $script = basename($_SERVER['SCRIPT_NAME']); if ($script == 'index.php' && (!isset($cPath) || $cPath == '')){ if (defined('FILENAME_ALLPRODS_SEO') && ALL_PRODUCTS_SEO == 'true'){ $script = FILENAME_ALLPRODS_SEO ; } elseif (defined('ALL_PRODUCTS') && ALL_PRODUCTS == 'true'){ $script = FILENAME_ALLPRODS ; } } $hidden_get_variables = ''; $keys = Array('Year','Make','Model','Part',tep_session_name(),'x','y'); if ($script == 'product_info.php'){ if(isset($cPath) || $cPath != ''){ $HTTP_GET_VARS['cPath'] = $cPath; $link = 'index.php?cPath='.$cPath.'&Make=all&Model=all&Part=all&Year=0'; } else { $link = 'index.php?Make=all&Model=all&Part=all&Year=0'; } $action = 'index.php'; $keys [] = 'products_id'; } elseif (SEO_ENABLED == 'true' && basename($PHP_SELF) != FILENAME_ADVANCED_SEARCH_RESULT){ $action = tep_href_link($script, tep_get_all_get_params(array('Make','Model','Part','Year')), 'NONSSL', false); $link = tep_href_link($script, tep_get_all_get_params(array('Make','Model','Part','Year')).'Make=all&Model=all&Part=all&Year=0', 'NONSSL', false); $keys [] = 'cPath'; $keys [] = 'products_id'; $keys [] = 'manufacturers_id'; } else { $action = $script; $link = $script.'?'.tep_get_all_get_params(array('Make','Model','Part','Year')).'Make=all&Model=all&Part=all&Year=0'; } reset($HTTP_GET_VARS); while (list($key, $value) = each($HTTP_GET_VARS)) { if (!in_array($key,$keys)) $hidden_get_variables .= tep_draw_hidden_field($key, $value); } } $ymm_list = '<div class="ui-widget infoBoxContainer">'; $ymm_list .= '<div class="ui-widget-header infoBoxHeading">'. MODULE_BOXES_YEAR_MAKE_MODEL_TITLE . '</div>'; $ymm_list .= '<div class="ui-widget-content infoBoxContents" style="text-align: center;">'; $ymm_list .= $javascript.tep_draw_form('make_model_year', $action, 'get').tep_draw_pull_down_menu('Make', $Make_array, (isset($Make_selected_var) ? $Make_selected_var : ''), 'onchange="pop_model();" style="width: 100%"') .'<br><br>'. '<span id="model_select">'.tep_draw_pull_down_menu('Model', $Model_array, (isset($Model_selected_var) ? $Model_selected_var : ''), 'onchange="pop_year();" style="width: 100%"') .'</span><br><br>'. '<span id="year_select">'.tep_draw_pull_down_menu('Year', $Year_array, (isset($Year_selected_var) ? $Year_selected_var : ''), 'onchange="pop_part();" style="width: 100%"') .'</span><br><br>'. '<span id="part_select">'.tep_draw_pull_down_menu('Part', $Part_array, (isset($Part_selected_var) ? $Part_selected_var : ''), 'onchange="document.make_model_year.submit();" style="width: 100%"') .'</span><br><br>'. $hidden_get_variables . tep_hide_session_id() . '<input type="submit" value="Go"> <a href="'.$link.'">Reset</a></form>'; $ymm_list .= ' </div>' . '</div>'; $oscTemplate->addBlock($ymm_list, $this->group); } function isEnabled() { return $this->enabled; } function check() { return defined('MODULE_BOXES_YEAR_MAKE_MODEL_STATUS'); } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Year Make Model Module', 'MODULE_BOXES_YEAR_MAKE_MODEL_STATUS', 'True', 'Do you want to add the module to your shop?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Placement', 'MODULE_BOXES_YEAR_MAKE_MODEL_CONTENT_PLACEMENT', 'Right Column', 'Should the module be loaded in the left or right column?', '6', '1', 'tep_cfg_select_option(array(\'Left Column\', \'Right Column\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_BOXES_YEAR_MAKE_MODEL_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_BOXES_YEAR_MAKE_MODEL_STATUS', 'MODULE_BOXES_YEAR_MAKE_MODEL_CONTENT_PLACEMENT', 'MODULE_BOXES_YEAR_MAKE_MODEL_SORT_ORDER'); } } ?>
  2. @@DunWeb Quick question, I'd like to switch the order of the drop downs from the default: MAKE MODEL PART YEAR to MAKE MODEL YEAR PART Which files in particular do I need to attack?
  3. Running osc 2.3.3 Hello all, I figured this would be the best place to post my solution to combine both of the these excellent Add Ons. Easy Populate and the Year Make Model (YMM) contributions are both really great. We have a auto parts store that sells customs body kits so our product db goes way over 100,000 products. Here's my solution: In the easypopulate.php file there are instructions to add custom fields into either the products or products_description tables. I added these columns into the products_description page: products_car_make products_car_model products_car_part products_car_year_bof products_car_year_eof Now these will appear in your excel file. Be sure to add these columns into the products_description table in phpmyadmin as well. Now, the latest version of ymmp has a table called products_ymm, you'll notice the same column headers there in phpmyadmin. Well now we want to move that data over to the ymm table so it will show up in our drop downs. To do this, either export then import the data using excel files. or use this statement: INSERT INTO `products_ymm`(`products_id`, `products_car_make`, `products_car_model`, `products_car_part`, `products_car_year_bof`, `products_car_year_eof`) SELECT `products_id`, `products_car_make`, `products_car_model`, `products_car_part`, `products_car_year_bof`, `products_car_year_eof` FROM `products_description` There are a few steps involved, this is my first instructional post, so please feel free to ask and I will provide more clarity on what I did. Also, if anyone has a better way, please advise!
  4. Running osc 2.3.3 Hello all, I figured this would be the best place to post my solution to combine both of the these excellent Add Ons. Easy Populate and the Year Make Model (YMM) contributions are both really great. We have a auto parts store that sells customs body kits so our product db goes way over 100,000 products. Here's my solution: In the easypopulate.php file there are instructions to add custom fields into either the products or products_description tables. I added these columns into the products_description page: products_car_make products_car_model products_car_part products_car_year_bof products_car_year_eof Now these will appear in your excel file. Be sure to add these columns into the products_description table in phpmyadmin as well. Now, the latest version of ymmp has a table called products_ymm, you'll notice the same column headers there in phpmyadmin. Well now we want to move that data over to the ymm table so it will show up in our drop downs. To do this, either export then import the data using excel files. or use this statement: INSERT INTO `products_ymm`(`products_id`, `products_car_make`, `products_car_model`, `products_car_part`, `products_car_year_bof`, `products_car_year_eof`) SELECT `products_id`, `products_car_make`, `products_car_model`, `products_car_part`, `products_car_year_bof`, `products_car_year_eof` FROM `products_description` There are a few steps involved, this is my first instructional post, so please feel free to ask and I will provide more clarity on what I did. Also, if anyone has a better way, please advise!
  5. TheAquarian

    Easy Populate and YMM contributions

    Running osc 2.3.3 Hello all, I figured this would be the best place to post my solution to combine both of the these excellent Add Ons. Easy Populate and the Year Make Model (YMM) contributions are both really great. We have a auto parts store that sells customs body kits so our product db goes way over 100,000 products. Here's my solution: In the easypopulate.php file there are instructions to add custom fields into either the products or products_description tables. I added these columns into the products_description page: products_car_make products_car_model products_car_part products_car_year_bof products_car_year_eof Now these will appear in your excel file. Be sure to add these columns into the products_description table in phpmyadmin as well. Now, the latest version of ymmp has a table called products_ymm, you'll notice the same column headers there in phpmyadmin. Well now we want to move that data over to the ymm table so it will show up in our drop downs. To do this, either export then import the data using excel files. or use this statement: INSERT INTO `products_ymm`(`products_id`, `products_car_make`, `products_car_model`, `products_car_part`, `products_car_year_bof`, `products_car_year_eof`) SELECT `products_id`, `products_car_make`, `products_car_model`, `products_car_part`, `products_car_year_bof`, `products_car_year_eof` FROM `products_description` There are a few steps involved, this is my first instructional post, so please feel free to ask and I will provide more clarity on what I did. Also, if anyone has a better way, please advise!
  6. @@DunWeb Thank you for the reply. I will seek support there as well. As the author, do you know of any way (maybe not the EP route) to mass input the ymmp data?
  7. @@DunWeb First off, thank you so much for taking the time to create this add on. HUGE help to all of us struggling to organize an Auto Parts store. I would like ask, with Auto Parts stores, usually we have hundreds (in our case thousands) of products. I read earlier in this thread of mention of implementing this with Easy Populate to take out the tedious product-by-product ymmp settings within admin. Is there any progress on that? Or do you have any instructions for mass inputting the ymmp info into the PHPmySql? any ideas would be much appreciated
×