Skip to content

Instantly share code, notes, and snippets.

@iris-i
Forked from crittermike/gist:5509547
Created April 28, 2014 19:55
Show Gist options
  • Save iris-i/11382331 to your computer and use it in GitHub Desktop.
Save iris-i/11382331 to your computer and use it in GitHub Desktop.
var frugalzontitle = jQuery('h1').text().trim();
var frugalzonprice = jQuery('.a-color-price, .priceLarge').eq(0).text().trim().replace("$","");
var frugalzoncategory = jQuery('.nav-category-button').eq(0).text().trim().replace('All ', '').replace(',', '');
var frugalzonimage = jQuery('#holderMainImage img, #prodImageCell img').attr('src');
var frugalzonurl = document.URL;
if (frugalzonurl.indexOf('?') > -1) {
frugalzonurl += '&tag=frugalzon-20';
} else {
frugalzonurl += '?tag=frugalzon-20';
}
if (jQuery('#actualPriceExtraMessaging img').length > 0 || jQuery('#price img').length > 0) {
frugalzonshipping = 'Prime';
} else {
frugalzonshipping = 'Normal';
}
url = 'http://frugalzon.localhost/node/add/product?';
url += 'edit[title]=' + encodeURIComponent(frugalzontitle) + '&';
url += 'edit[field_price][und][0][value]=' + encodeURIComponent(frugalzonprice) + '&';
url += 'edit[field_url][und][0][value]=' + encodeURIComponent(frugalzonurl) + '&';
url += 'edit[field_category][und]=' + encodeURIComponent(frugalzoncategory) + '&';
url += 'edit[field_shipping][und]=' + encodeURIComponent(frugalzonshipping) + '&';
url += 'edit[field_image][und][0][filefield_remote][url]=' + frugalzonimage + '&';
window.open(url, '_blank');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment