put items into links - because of the SEO
This commit is contained in:
@@ -11,6 +11,8 @@ var SingleItem = React.createClass({
|
|||||||
var hidePrice = this.props.hidePrice || false;
|
var hidePrice = this.props.hidePrice || false;
|
||||||
var self = this;
|
var self = this;
|
||||||
var itemClick = this.itemClick;
|
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];
|
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" } ;
|
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) {
|
if (hidePrice) {
|
||||||
@@ -29,7 +31,7 @@ var SingleItem = React.createClass({
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return (
|
return (
|
||||||
|
<a href={itemUrl} onClick={stopPropagation}>
|
||||||
<div className="col-lg-3 col-md-3 col-sm-4 col-xs-6" onClick={itemClick}>
|
<div className="col-lg-3 col-md-3 col-sm-4 col-xs-6" onClick={itemClick}>
|
||||||
<div className="productbox">
|
<div className="productbox">
|
||||||
<img className="img-responsive" src={firstImage.resized_url} alt="product image" />
|
<img className="img-responsive" src={firstImage.resized_url} alt="product image" />
|
||||||
@@ -40,14 +42,22 @@ var SingleItem = React.createClass({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</a>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
stopPropagation: function(e){
|
||||||
|
e.stopPropagation();
|
||||||
|
e.nativeEvent.stopImmediatePropagation();
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
itemClick: function(e) {
|
itemClick: function(e) {
|
||||||
NavigationActions.goToItemDetails(this.props.item);
|
NavigationActions.goToItemDetails(this.props.item);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -53,8 +53,13 @@ var NavigationStore = _.extend({}, EventEmitter.prototype, {
|
|||||||
} else {
|
} else {
|
||||||
return false;
|
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;
|
||||||
|
|||||||
Reference in New Issue
Block a user