Magento Configurable Product Overwrite Defaults by URL -


i browsing through js/varien/configurable.js , noticed comment said, // overwrite defaults url. mean there way pre-select drop down values altering url?

if so, can please show me example of how accomplished (example: color)? perhaps http://www.example.com/test/product.html#color=blue? options url modify selections? associated sku? attribute , option labels? attribute , option ids?

    // overwrite defaults url     var separatorindex = window.location.href.indexof('#');     if (separatorindex != -1) {         var paramsstr = window.location.href.substr(separatorindex+1);         var urlvalues = paramsstr.toqueryparams();         if (!this.values) {             this.values = {};         }         (var in urlvalues) {             this.values[i] = urlvalues[i];         }     }      // overwrite defaults inputs values if needed     if (config.inputsinitialized) {         this.values = {};         this.settings.each(function(element) {             if (element.value) {                 var attributeid = element.id.replace(/[a-z]*/, '');                 this.values[attributeid] = element.value;             }         }.bind(this));     } 

thank in advance!

so seems can pre-select product attribute options using url, however, not user-friendly way of doing so. full url must followed #attribute_id=option_id. you'll want have access database appropriate ids unless have plans of using native magento functions implement this.

example

http://www.example.com/test/product.html#107=54&33=82

when load url, magento pre-select values dropdown menus. believe me, rather this: #attribute_code=option_code (#color=dark_blue), although almost there ids , labels options of drop down.

if you're looking way make more user-friendly, perhaps try adding url rewrites accomplish this. example: http://www.example.com/test/product.html#107=54&33=82 http://www.example.com/test/dark-blue-product.html


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -