Skip to content

Commit b6b68a9

Browse files
committed
Changed sort options
1 parent 7e0a96b commit b6b68a9

7 files changed

Lines changed: 24 additions & 15 deletions

File tree

src/admin/client/modules/settings/general/components/form.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,9 @@ class GeneralSettings extends React.Component {
184184
<div className="col-xs-7">{messages.settings_defaultProductSorting}</div>
185185
<div className="col-xs-5">
186186
<Field component={SelectField} autoWidth={true} fullWidth={true} name="default_product_sorting">
187-
<MenuItem value="price_asc" primaryText={messages.settings_sortByPriceAsc}/>
188-
<MenuItem value="price_desc" primaryText={messages.settings_sortByPriceDesc}/>
189-
<MenuItem value="default" primaryText={messages.settings_sortByDefault}/>
187+
<MenuItem value="stock_status,price" primaryText={messages.settings_sortByPriceAsc}/>
188+
<MenuItem value="stock_status,-price" primaryText={messages.settings_sortByPriceDesc}/>
189+
<MenuItem value="stock_status,price,position" primaryText={messages.settings_sortByDefault}/>
190190
</Field>
191191
</div>
192192
</div>

src/api/server/services/settings/settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class SettingsService {
1919
'default_shipping_country': 'SG',
2020
'default_shipping_state': '',
2121
'default_shipping_city': '',
22-
'default_product_sorting': 'price_asc',
22+
'default_product_sorting': 'stock_status,price,position',
2323
'weight_unit': 'kg',
2424
'length_unit': 'cm'
2525
}

src/store/shared/actions.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {push} from 'react-router-redux';
22
import * as t from './actionTypes'
3+
import {PAGE, PRODUCT_CATEGORY, PRODUCT, RESERVED} from './pageTypes'
34
import clientSettings from '../client/settings'
45
import api from 'cezerin-client'
56
api.initAjax(clientSettings.ajaxBaseUrl);
@@ -247,15 +248,15 @@ const getCategories = () => {
247248
}
248249

249250
const getProducts = (currentPage, filter) => {
250-
if (currentPage.type === 'product-category') {
251+
if (currentPage.type === PRODUCT_CATEGORY) {
251252
return api.ajax.products.list(filter).then(({status, json}) => json)
252253
} else {
253254
return Promise.resolve([]);
254255
}
255256
}
256257

257258
const getProduct = currentPage => {
258-
if (currentPage.type === 'product') {
259+
if (currentPage.type === PRODUCT) {
259260
return api.ajax.products.retrieve(currentPage.resource).then(({status, json}) => json)
260261
} else {
261262
return Promise.resolve();
@@ -267,7 +268,7 @@ const getCart = cookie => {
267268
}
268269

269270
const getPage = currentPage => {
270-
if (currentPage.type === 'page') {
271+
if (currentPage.type === PAGE) {
271272
return api.ajax.pages.retrieve(currentPage.resource).then(pageResponse => {
272273
return pageResponse.json;
273274
})
@@ -280,7 +281,7 @@ const getCommonData = (req, currentPage, productsFilter) => {
280281
const cookie = req.get('cookie');
281282
return Promise.all([getCategories(), getProduct(currentPage), getProducts(currentPage, productsFilter), getCart(cookie), getPage(currentPage)]).then(([categories, product, products, cart, page]) => {
282283
let categoryDetails = null;
283-
if (currentPage.type === 'product-category') {
284+
if (currentPage.type === PRODUCT_CATEGORY) {
284285
categoryDetails = categories.find(c => c.id === currentPage.resource);
285286
}
286287
return {
@@ -327,7 +328,7 @@ export const getInitialState = (req, checkoutFields, currentPage, settings) => {
327328
}
328329
}
329330

330-
if (currentPage.type === 'product-category') {
331+
if (currentPage.type === PRODUCT_CATEGORY) {
331332
initialState.app.productsFilter.category_id = currentPage.resource;
332333
}
333334

src/store/shared/pageTypes.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export const PAGE = 'page'
2+
export const PRODUCT_CATEGORY = 'product-category'
3+
export const PRODUCT = 'product'
4+
export const RESERVED = 'reserved'

src/store/shared/routes.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react'
22
import {Route, IndexRoute} from 'react-router'
33
import clientSettings from '../client/settings'
44
import {fetchProduct, fetchProducts, fetchPage, setCategory, receiveSitemap} from './actions'
5+
import {PAGE, PRODUCT_CATEGORY, PRODUCT, RESERVED} from './pageTypes'
56

67
import api from 'cezerin-client';
78
api.initAjax(clientSettings.ajaxBaseUrl);
@@ -38,18 +39,18 @@ function getComponent(nextState, cb) {
3839

3940
getSitemap(nextState.location.pathname, state, dispatch).then(({currentPage, currentPageAlreadyInState}) => {
4041
if (currentPage) {
41-
if (currentPage.type === 'product-category') {
42+
if (currentPage.type === PRODUCT_CATEGORY) {
4243
dispatch(setCategory(currentPage.resource))
4344
if(!currentPageAlreadyInState){
4445
dispatch(fetchProducts());
4546
}
4647
cb(null, props => <CategoryContainer {...props}/>);
47-
} else if (currentPage.type === 'product') {
48+
} else if (currentPage.type === PRODUCT) {
4849
if(!currentPageAlreadyInState){
4950
dispatch(fetchProduct(currentPage.resource))
5051
}
5152
cb(null, props => <ProductContainer {...props}/>);
52-
} else if (currentPage.type === 'page') {
53+
} else if (currentPage.type === PAGE) {
5354
if(!currentPageAlreadyInState){
5455
dispatch(fetchPage(currentPage.resource))
5556
}

themes/current/locales/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,7 @@
2020
"relatedProducts": "Related products",
2121
"filterProducts": "Filter products",
2222
"sort": "Sort",
23+
"title404": "Page not found",
24+
"text404": "The page you requested does not exist. Click here to continue shopping.",
2325
"footerCopyright": "Copyright © 2017 Demo Drone Store. All Rights Reserved. EN. "
2426
}

themes/current/src/containers/notfound.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import React from 'react'
22
import Helmet from 'react-helmet'
3+
import text from '../lib/text'
34

45
const NotFoundContainer = (props) => (
56
<div>
6-
<Helmet title="Page not found"/>
7+
<Helmet title={text.title404}/>
78
<section className="section">
89
<div className="container">
910
<div className="content">
10-
<h1>Page not found</h1>
11-
The page you requested does not exist. Click here to continue shopping.
11+
<h1>{text.title404}</h1>
12+
{text.text404}
1213
</div>
1314
</div>
1415
</section>

0 commit comments

Comments
 (0)