put items into links - because of the SEO

This commit is contained in:
Senad Uka
2016-01-26 05:01:18 +01:00
parent 418eb028ae
commit 0e2e5b8fb9
2 changed files with 18 additions and 3 deletions

View File

@@ -11,6 +11,8 @@ var SingleItem = React.createClass({
var hidePrice = this.props.hidePrice || false;
var self = this;
var itemClick = this.itemClick;
var stopPropagation = this.stopPropagation;
var itemUrl = NavigationStore.getUrlForItem(this.props.item);
var firstImage = this.props.item.get('multi_media_descriptions')[0];
firstImage = firstImage || { resized_url: "https://res.cloudinary.com/lfvt7ps2n/image/upload/c_fit,h_172,w_226/v1421732950/http_www.asms.ru_bitrix_templates_main_images_nophoto_irnofq.png" } ;
if (hidePrice) {
@@ -29,7 +31,7 @@ var SingleItem = React.createClass({
}
else {
return (
<a href={itemUrl} onClick={stopPropagation}>
<div className="col-lg-3 col-md-3 col-sm-4 col-xs-6" onClick={itemClick}>
<div className="productbox">
<img className="img-responsive" src={firstImage.resized_url} alt="product image" />
@@ -40,14 +42,22 @@ var SingleItem = React.createClass({
</div>
</div>
</div>
</a>
);
}
},
},
stopPropagation: function(e){
e.stopPropagation();
e.nativeEvent.stopImmediatePropagation();
return false;
},
itemClick: function(e) {
NavigationActions.goToItemDetails(this.props.item);
}
});

View File

@@ -53,8 +53,13 @@ var NavigationStore = _.extend({}, EventEmitter.prototype, {
} else {
return false;
}
},
getUrlForItem: function(item) {
return '/artikal/' + item.get('id') +'/' + Globals.Slugify(item.get('name'))
}
});
@@ -84,4 +89,4 @@ NavigationStore.dispatchToken = AppDispatcher.register(function(payload) {
});
module.exports = NavigationStore;
module.exports = NavigationStore;