Skip to content

Instantly share code, notes, and snippets.

@dayAlone
Created October 16, 2015 00:08
Show Gist options
  • Save dayAlone/a4b343b887729582969d to your computer and use it in GitHub Desktop.
Save dayAlone/a4b343b887729582969d to your computer and use it in GitHub Desktop.
/*
// Import categories
$.get('http://ru.russellhobbs.com/russell-hobbs-products/', (data) => {
$(data).find('#dsnestCat li').each((key, el)=> {
let $el = $(el);
let $img = $el.find('img');
if ($img) {
let result = {
name: $img.attr('alt'),
image: $img.attr('src'),
short_description: $el.find('p').text()
};
$.get($el.find('a').attr('href'), (data) => {
result.description = $(data).find('.dsCATtxt').html();
result.line = data.match(/#dsContentMaskB"\).css\({'background-image':'url\((.*?)\)'}\);/)[1];
});
$.post('/catalog/category/add/', result);
}
});
});
// Import collections
$.get('http://ru.russellhobbs.com/russell-hobbs-collections/', (data) => {
$(data).find('#dsnestCat li').each((key, el)=> {
let $el = $(el);
let $img = $el.find('img');
if ($img) {
let result = {
name: $img.attr('alt'),
image: $img.attr('src'),
short_description: $el.find('p').text()
};
$.get($el.find('a').attr('href'), (data) => {
result.description = $(data).find('.dsCATtxt').html();
result.line = data.match(/#dsContentMaskB"\).css\({'background-image':'url\((.*?)\)'}\);/)[1];
});
//console.log(result);
$.post('/catalog/collection/add/', result);
}
});
});
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment