yitzyy

froogle preselected

Mar 31st, 2016
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Smarty 1.50 KB | None | 0 0
  1. Code for Preselected options on Xcart
  2. /modules/Product_Options/customer_options.php (ln. 94-96)
  3. $varsku = func_query("SELECT productcode, $sql_tbl[class_options].optionid FROM $sql_tbl[variants] JOIN $sql_tbl[variant_items] ON $sql_tbl[variants].variantid=$sql_tbl[variant_items].variantid JOIN $sql_tbl[class_options] ON $sql_tbl[class_options].optionid=$sql_tbl[variant_items].optionid WHERE $sql_tbl[variants].productid='$productid'");
  4. $smarty->assign('varsku', $varsku);
  5. }
  6. /common_files/modules/Product_Options/customer_options.tpl (ln. 51-71)
  7. After <select> and before {foreach}:
  8. <script>
  9. {literal}
  10. $(document).ready(function() {
  11.   var select = GetUrlParameter("select");
  12.   $("#" + select).attr("selected", "");
  13. });
  14.  
  15. function GetUrlParameter(name) {
  16.     var value;
  17.     $.each(window.location.search.slice(1).split("&"), function (i, kvp) {
  18.         var values = kvp.split("=");
  19.         if (name === values[0]) {
  20.             value = values[1] ? values[1] : values[0];
  21.             return false;
  22.         }
  23.     });
  24.     return value;
  25. }
  26. {/literal}
  27. </script>
  28. (ln 74) within <option> element:
  29. id="{section name=vsku loop=$varsku}{if $varsku[vsku].optionid eq $o.optionid}{$varsku[vsku].productcode}{/if}{/section}"
  30.  
  31. Include SKU in Froogle Export:
  32. /public_html/modules/Froogle/froogle.php
  33. (ln 349): $skufix = str_replace('.', '_', $product['productcode']);
  34. (ln 353): $product_url = $http_location.constant('DIR_CUSTOMER').'/'.func_get_resource_url('product', $product['productid'], '', false)."?select=".$skufix;
Add Comment
Please, Sign In to add comment