forgeos_commerce 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +339 -0
- data/COPYING.LESSER +165 -0
- data/Gemfile +2 -0
- data/LICENSE +2 -0
- data/MIT-LICENSE +20 -0
- data/README.textile +27 -0
- data/app/assets/images/forgeos/admin/favicon.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/association_product/bubble-quantity-products.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/association_product/check-checked.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/association_product/check-unchecked.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/association_product/context.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/association_product/create.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/association_product/dark-blue-minus.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/association_product/dark-blue-plus.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/association_product/dot.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/association_product/f.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/association_product/fminus.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/association_product/fminus_rtl.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/association_product/folder.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/association_product/fplus.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/association_product/fplus_rtl.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/association_product/lastli.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/association_product/lastli_rtl.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/association_product/li.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/association_product/remove.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/association_product/rename.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/association_product/throbber.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/product-types/bubble-quantity-products.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/product-types/check-checked.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/product-types/check-unchecked.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/product-types/context.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/product-types/create.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/product-types/dark-blue-minus.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/product-types/dark-blue-plus.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/product-types/dot.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/product-types/drag-drop.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/product-types/f.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/product-types/fminus.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/product-types/fminus_rtl.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/product-types/folder.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/product-types/fplus.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/product-types/fplus_rtl.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/product-types/grey-drag-drop.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/product-types/lastli.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/product-types/lastli_rtl.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/product-types/li.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/product-types/remove.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/product-types/rename.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/product-types/throbber.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/product_category/brown-minus.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/product_category/brown-plus.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/product_category/bubble-quantity-products.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/product_category/context.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/product_category/create.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/product_category/dot.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/product_category/f.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/product_category/fminus.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/product_category/fminus_rtl.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/product_category/fplus.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/product_category/fplus_rtl.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/product_category/lastli.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/product_category/lastli_rtl.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/product_category/li.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/product_category/remove.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/product_category/rename.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/product_category/throbber.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/zone-tree/bubble-quantity-products.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/zone-tree/check-checked.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/zone-tree/check-unchecked.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/zone-tree/context.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/zone-tree/create.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/zone-tree/dark-blue-minus.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/zone-tree/dark-blue-plus.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/zone-tree/dot.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/zone-tree/f.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/zone-tree/fminus.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/zone-tree/fminus_rtl.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/zone-tree/folder.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/zone-tree/fplus.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/zone-tree/fplus_rtl.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/zone-tree/lastli.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/zone-tree/lastli_rtl.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/zone-tree/li.gif +0 -0
- data/app/assets/images/forgeos/jstree/themes/zone-tree/remove.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/zone-tree/rename.png +0 -0
- data/app/assets/images/forgeos/jstree/themes/zone-tree/throbber.gif +0 -0
- data/app/assets/javascripts/forgeos/admin/functions.js +3 -0
- data/app/assets/javascripts/forgeos/admin/functions/forgeos_commerce/all.js +1 -0
- data/app/assets/javascripts/forgeos/admin/functions/forgeos_commerce/attributes.js +18 -0
- data/app/assets/javascripts/forgeos/admin/functions/forgeos_commerce/cross-sellings.js +18 -0
- data/app/assets/javascripts/forgeos/admin/functions/forgeos_commerce/orders.js +88 -0
- data/app/assets/javascripts/forgeos/admin/functions/forgeos_commerce/products.js +46 -0
- data/app/assets/javascripts/forgeos/admin/functions/forgeos_commerce/rules.js +98 -0
- data/app/assets/javascripts/forgeos/admin/functions/forgeos_commerce/transporters.js +60 -0
- data/app/assets/javascripts/forgeos/admin/functions/forgeos_commerce/trees.js +35 -0
- data/app/assets/javascripts/forgeos/admin/functions/forgeos_commerce/uploads.js +10 -0
- data/app/assets/javascripts/forgeos/admin/inits.js +3 -0
- data/app/assets/javascripts/forgeos/admin/inits/forgeos_commerce/all.js +1 -0
- data/app/assets/javascripts/forgeos/admin/inits/forgeos_commerce/clicks.js +25 -0
- data/app/assets/javascripts/forgeos/admin/inits/forgeos_commerce/cross-sellings.js +69 -0
- data/app/assets/javascripts/forgeos/admin/inits/forgeos_commerce/customer.js +64 -0
- data/app/assets/javascripts/forgeos/admin/inits/forgeos_commerce/orders.js +83 -0
- data/app/assets/javascripts/forgeos/admin/inits/forgeos_commerce/overlays.js +45 -0
- data/app/assets/javascripts/forgeos/admin/inits/forgeos_commerce/products.js +103 -0
- data/app/assets/javascripts/forgeos/admin/inits/forgeos_commerce/settings.js +15 -0
- data/app/assets/javascripts/forgeos/admin/inits/forgeos_commerce/special-offers.js +23 -0
- data/app/assets/javascripts/forgeos/admin/inits/forgeos_commerce/trees.js +71 -0
- data/app/assets/stylesheets/forgeos/admin/base.css.sass +3 -0
- data/app/assets/stylesheets/forgeos/admin/forgeos_commerce/_all.css.sass +9 -0
- data/app/assets/stylesheets/forgeos/admin/forgeos_commerce/_attributes.css.sass +59 -0
- data/app/assets/stylesheets/forgeos/admin/forgeos_commerce/_customer.css.sass +84 -0
- data/app/assets/stylesheets/forgeos/admin/forgeos_commerce/_delivery.css.sass +81 -0
- data/app/assets/stylesheets/forgeos/admin/forgeos_commerce/_dropdowns.css.sass +171 -0
- data/app/assets/stylesheets/forgeos/admin/forgeos_commerce/_order.css.sass +208 -0
- data/app/assets/stylesheets/forgeos/admin/forgeos_commerce/_payment.css.sass +34 -0
- data/app/assets/stylesheets/forgeos/admin/forgeos_commerce/_products.css.sass +341 -0
- data/app/assets/stylesheets/forgeos/admin/forgeos_commerce/_special_offers.css.sass +198 -0
- data/app/assets/stylesheets/forgeos/admin/forgeos_commerce/_transporters.css.sass +5 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/association_product/style.css.sass +50 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/product-types/style.css.sass +129 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/product_category/style.css.sass +109 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/zone-tree/style.css.sass +103 -0
- data/app/controllers/addresses_controller.rb +51 -0
- data/app/controllers/admin/attributes_controller.rb +161 -0
- data/app/controllers/admin/base_controller.rb +5 -0
- data/app/controllers/admin/brands_controller.rb +119 -0
- data/app/controllers/admin/forms_controller.rb +66 -0
- data/app/controllers/admin/geo_zones_controller.rb +74 -0
- data/app/controllers/admin/import_controller.rb +50 -0
- data/app/controllers/admin/orders_controller.rb +248 -0
- data/app/controllers/admin/product_types_controller.rb +122 -0
- data/app/controllers/admin/products_controller.rb +204 -0
- data/app/controllers/admin/special_offers_controller.rb +236 -0
- data/app/controllers/admin/statistics_controller.rb +64 -0
- data/app/controllers/admin/transporter_rules_controller.rb +307 -0
- data/app/controllers/admin/users_controller.rb +100 -0
- data/app/controllers/admin/vouchers_controller.rb +207 -0
- data/app/controllers/application_controller.rb +75 -0
- data/app/controllers/order_controller.rb +229 -0
- data/app/helpers/admin/payment_fields_helper.rb +31 -0
- data/app/helpers/application_helper.rb +7 -0
- data/app/helpers/cart_helper.rb +40 -0
- data/app/helpers/category_helper.rb +36 -0
- data/app/helpers/product_helper.rb +118 -0
- data/app/helpers/routes_helper.rb +60 -0
- data/app/helpers/wishlist_helper.rb +142 -0
- data/app/models/address_delivery.rb +2 -0
- data/app/models/address_invoice.rb +2 -0
- data/app/models/attribute.rb +38 -0
- data/app/models/attribute_category.rb +3 -0
- data/app/models/attribute_value.rb +10 -0
- data/app/models/brand.rb +22 -0
- data/app/models/brand_category.rb +3 -0
- data/app/models/cart.rb +190 -0
- data/app/models/cart_item.rb +21 -0
- data/app/models/checkbox_attribute.rb +2 -0
- data/app/models/country.rb +4 -0
- data/app/models/cross_sellings_product.rb +4 -0
- data/app/models/currencies_exchanges_rate.rb +2 -0
- data/app/models/currency.rb +13 -0
- data/app/models/date_attribute.rb +2 -0
- data/app/models/dynamic_attribute.rb +6 -0
- data/app/models/dynamic_attribute_value.rb +5 -0
- data/app/models/form.rb +7 -0
- data/app/models/form_attribute.rb +3 -0
- data/app/models/geo_zone.rb +6 -0
- data/app/models/longtext_attribute.rb +2 -0
- data/app/models/number_attribute.rb +2 -0
- data/app/models/order.rb +483 -0
- data/app/models/order_detail.rb +129 -0
- data/app/models/order_shipping.rb +25 -0
- data/app/models/pack.rb +9 -0
- data/app/models/picklist_attribute.rb +2 -0
- data/app/models/product.rb +294 -0
- data/app/models/product_attribute.rb +4 -0
- data/app/models/product_category.rb +9 -0
- data/app/models/product_link.rb +9 -0
- data/app/models/product_price_variation.rb +3 -0
- data/app/models/product_sold_counter.rb +2 -0
- data/app/models/product_sweeper.rb +30 -0
- data/app/models/product_type.rb +27 -0
- data/app/models/product_type_category.rb +3 -0
- data/app/models/product_viewed_counter.rb +2 -0
- data/app/models/products_wishlist.rb +25 -0
- data/app/models/radio_attribute.rb +2 -0
- data/app/models/radiobutton_attribute.rb +2 -0
- data/app/models/setting.rb +46 -0
- data/app/models/size.rb +5 -0
- data/app/models/special_offer_category.rb +3 -0
- data/app/models/special_offer_rule.rb +21 -0
- data/app/models/text_attribute.rb +2 -0
- data/app/models/text_field_attribute.rb +2 -0
- data/app/models/transporter_category.rb +3 -0
- data/app/models/transporter_rule.rb +3 -0
- data/app/models/url_attribute.rb +2 -0
- data/app/models/user.rb +45 -0
- data/app/models/user_address.rb +6 -0
- data/app/models/voucher_category.rb +3 -0
- data/app/models/voucher_rule.rb +3 -0
- data/app/models/wishlist.rb +134 -0
- data/app/views/admin/addresses/_form.html.haml +42 -0
- data/app/views/admin/attributes/_categories.html.haml +7 -0
- data/app/views/admin/attributes/_choice.html.haml +24 -0
- data/app/views/admin/attributes/_date.html.haml +5 -0
- data/app/views/admin/attributes/_form.html.haml +36 -0
- data/app/views/admin/attributes/_longtext.html.haml +5 -0
- data/app/views/admin/attributes/_number.html.haml +5 -0
- data/app/views/admin/attributes/_tabs.html.haml +6 -0
- data/app/views/admin/attributes/_text.html.haml +5 -0
- data/app/views/admin/attributes/_url.html.haml +5 -0
- data/app/views/admin/attributes/destroy.js.erb +1 -0
- data/app/views/admin/attributes/edit.html.haml +2 -0
- data/app/views/admin/attributes/index.html.haml +33 -0
- data/app/views/admin/attributes/index.json.erb +24 -0
- data/app/views/admin/attributes/new.html.haml +2 -0
- data/app/views/admin/attributes/show.html.haml +51 -0
- data/app/views/admin/brands/_form.html.haml +29 -0
- data/app/views/admin/brands/_tabs.html.haml +6 -0
- data/app/views/admin/brands/destroy.js.erb +1 -0
- data/app/views/admin/brands/edit.html.haml +2 -0
- data/app/views/admin/brands/index.html.haml +15 -0
- data/app/views/admin/brands/index.json.erb +23 -0
- data/app/views/admin/brands/new.html.haml +2 -0
- data/app/views/admin/dashboard/index.html.haml +230 -0
- data/app/views/admin/forms/_form.html.haml +38 -0
- data/app/views/admin/forms/_tabs.html.haml +6 -0
- data/app/views/admin/forms/destroy.js.erb +1 -0
- data/app/views/admin/forms/edit.html.haml +2 -0
- data/app/views/admin/forms/index.html.haml +11 -0
- data/app/views/admin/forms/index.json.erb +20 -0
- data/app/views/admin/forms/new.html.haml +2 -0
- data/app/views/admin/geo_zones/_form.html.haml +20 -0
- data/app/views/admin/geo_zones/_list.html.haml +9 -0
- data/app/views/admin/geo_zones/edit.html.haml +3 -0
- data/app/views/admin/geo_zones/index.html.haml +49 -0
- data/app/views/admin/geo_zones/new.html.haml +3 -0
- data/app/views/admin/geo_zones/show.html.haml +4 -0
- data/app/views/admin/import/create_product.html.haml +2 -0
- data/app/views/admin/menus/_types_popups.html.haml +22 -0
- data/app/views/admin/orders/_address_form.html.haml +29 -0
- data/app/views/admin/orders/_form.html.haml +198 -0
- data/app/views/admin/orders/_list.html.haml +29 -0
- data/app/views/admin/orders/_products_popup.html.haml +15 -0
- data/app/views/admin/orders/create.html.haml +1 -0
- data/app/views/admin/orders/destroy.js.erb +1 -0
- data/app/views/admin/orders/edit.html.haml +1 -0
- data/app/views/admin/orders/index.html.haml +24 -0
- data/app/views/admin/orders/index.json.erb +48 -0
- data/app/views/admin/orders/show.html.haml +130 -0
- data/app/views/admin/product_types/_form.html.haml +46 -0
- data/app/views/admin/product_types/_list.html.haml +6 -0
- data/app/views/admin/product_types/_options_categories.html.haml +19 -0
- data/app/views/admin/product_types/_tabs.html.haml +6 -0
- data/app/views/admin/product_types/destroy.js.erb +1 -0
- data/app/views/admin/product_types/edit.html.haml +3 -0
- data/app/views/admin/product_types/index.html.haml +14 -0
- data/app/views/admin/product_types/index.json.erb +24 -0
- data/app/views/admin/product_types/new.html.haml +3 -0
- data/app/views/admin/product_types/show.html.haml +23 -0
- data/app/views/admin/products/_attributes.html.haml +37 -0
- data/app/views/admin/products/_cross_popup.html.haml +56 -0
- data/app/views/admin/products/_cross_sell_tr.html.haml +13 -0
- data/app/views/admin/products/_cross_sells.html.haml +1 -0
- data/app/views/admin/products/_form.html.haml +26 -0
- data/app/views/admin/products/_general.html.haml +153 -0
- data/app/views/admin/products/_list.html.haml +18 -0
- data/app/views/admin/products/_prices.html.haml +17 -0
- data/app/views/admin/products/_products_popup.html.haml +41 -0
- data/app/views/admin/products/_seo.html.haml +75 -0
- data/app/views/admin/products/_shippings.html.haml +0 -0
- data/app/views/admin/products/_sizes.html.haml +23 -0
- data/app/views/admin/products/_tabs.html.haml +2 -0
- data/app/views/admin/products/activate.js.erb +1 -0
- data/app/views/admin/products/destroy.js.erb +1 -0
- data/app/views/admin/products/edit.html.haml +1 -0
- data/app/views/admin/products/index.html.haml +20 -0
- data/app/views/admin/products/index.json.erb +65 -0
- data/app/views/admin/products/new.html.haml +1 -0
- data/app/views/admin/products/show.html.haml +158 -0
- data/app/views/admin/settings/_colissimo.html.haml +7 -0
- data/app/views/admin/settings/_godfather.html.haml +11 -0
- data/app/views/admin/settings/_google_shopping.html.haml +5 -0
- data/app/views/admin/settings/_payment.html.haml +63 -0
- data/app/views/admin/settings/_tabs.html.haml +5 -0
- data/app/views/admin/settings/edit.html.haml +33 -0
- data/app/views/admin/special_offers/_form.html.haml +88 -0
- data/app/views/admin/special_offers/_patterns.html.haml +151 -0
- data/app/views/admin/special_offers/_tabs.html.haml +5 -0
- data/app/views/admin/special_offers/_top_links.html.haml +6 -0
- data/app/views/admin/special_offers/activate.js.erb +1 -0
- data/app/views/admin/special_offers/destroy.js.erb +1 -0
- data/app/views/admin/special_offers/edit.html.haml +4 -0
- data/app/views/admin/special_offers/index.html.haml +15 -0
- data/app/views/admin/special_offers/index.json.erb +28 -0
- data/app/views/admin/special_offers/new.html.haml +2 -0
- data/app/views/admin/special_offers/show.html.haml +28 -0
- data/app/views/admin/special_offers/special_offer.html.haml +166 -0
- data/app/views/admin/statistics/index.html.haml +158 -0
- data/app/views/admin/transporter_rules/_delivery_rules.html.haml +83 -0
- data/app/views/admin/transporter_rules/_form.html.haml +90 -0
- data/app/views/admin/transporter_rules/_left_sidebar.html.haml +9 -0
- data/app/views/admin/transporter_rules/_sidebar.html.haml +10 -0
- data/app/views/admin/transporter_rules/_tabs.html.haml +8 -0
- data/app/views/admin/transporter_rules/activate.js.erb +1 -0
- data/app/views/admin/transporter_rules/destroy.js.erb +1 -0
- data/app/views/admin/transporter_rules/edit.html.haml +1 -0
- data/app/views/admin/transporter_rules/index.html.haml +13 -0
- data/app/views/admin/transporter_rules/index.json.erb +30 -0
- data/app/views/admin/transporter_rules/new.html.haml +1 -0
- data/app/views/admin/transporter_rules/show.html.haml +30 -0
- data/app/views/admin/users/_fields_for_addresses_deliveries.html.haml +38 -0
- data/app/views/admin/users/_fields_for_addresses_invoices.html.haml +34 -0
- data/app/views/admin/users/_form.html.haml +88 -0
- data/app/views/admin/users/edit.json.erb +35 -0
- data/app/views/admin/users/index.html.haml +12 -0
- data/app/views/admin/users/index.json.erb +32 -0
- data/app/views/admin/users/index2.html.haml +33 -0
- data/app/views/admin/users/show.html.haml +72 -0
- data/app/views/admin/vouchers/_form.html.haml +92 -0
- data/app/views/admin/vouchers/_tabs.html.haml +3 -0
- data/app/views/admin/vouchers/activate.js.erb +1 -0
- data/app/views/admin/vouchers/destroy.js.erb +1 -0
- data/app/views/admin/vouchers/index.html.haml +15 -0
- data/app/views/admin/vouchers/index.json.erb +28 -0
- data/app/views/admin/vouchers/new.html.haml +2 -0
- data/config/locales/activerecord/en.yml +6 -0
- data/config/locales/activerecord/fr.yml +18 -0
- data/config/locales/admin/address/en.yml +3 -0
- data/config/locales/admin/address/fr.yml +3 -0
- data/config/locales/admin/attribute/en.yml +76 -0
- data/config/locales/admin/attribute/fr.yml +75 -0
- data/config/locales/admin/brands/en.yml +24 -0
- data/config/locales/admin/brands/fr.yml +27 -0
- data/config/locales/admin/dashboard/en.yml +6 -0
- data/config/locales/admin/dashboard/fr.yml +6 -0
- data/config/locales/admin/order/en.yml +54 -0
- data/config/locales/admin/order/fr.yml +54 -0
- data/config/locales/admin/product/en.yml +105 -0
- data/config/locales/admin/product/fr.yml +106 -0
- data/config/locales/admin/settings/en.yml +90 -0
- data/config/locales/admin/settings/fr.yml +87 -0
- data/config/locales/admin/special_offer/en.yml +59 -0
- data/config/locales/admin/special_offer/fr.yml +60 -0
- data/config/locales/admin/transporter/en.yml +36 -0
- data/config/locales/admin/transporter/fr.yml +36 -0
- data/config/locales/admin/voucher/en.yml +3 -0
- data/config/locales/admin/voucher/fr.yml +3 -0
- data/config/locales/admin/wishlist/en.yml +89 -0
- data/config/locales/admin/wishlist/fr.yml +89 -0
- data/config/locales/common/en.yml +424 -0
- data/config/locales/common/fr.yml +422 -0
- data/config/routes.rb +109 -0
- data/config/search.example.yml +8 -0
- data/db/fixtures/currencies.yml +10 -0
- data/db/fixtures/currencies_exchanges_rates.yml +9 -0
- data/db/fixtures/page_translations.yml +11 -0
- data/db/fixtures/pages.yml +5 -0
- data/db/fixtures/people.yml +11 -0
- data/db/fixtures/product_type_translations.yml +11 -0
- data/db/fixtures/product_types.yml +2 -0
- data/db/migrate/20091009134433_create_attribute_values.rb +15 -0
- data/db/migrate/20091009134440_create_attribute_values_products.rb +14 -0
- data/db/migrate/20091009134448_create_attributes.rb +17 -0
- data/db/migrate/20091009134455_create_attributes_product_types.rb +14 -0
- data/db/migrate/20091009134525_create_carts.rb +15 -0
- data/db/migrate/20091009134532_create_cart_items.rb +14 -0
- data/db/migrate/20091009134609_create_cross_sellings_products.rb +11 -0
- data/db/migrate/20091009134616_create_currencies.rb +15 -0
- data/db/migrate/20091009134624_create_currencies_exchanges_rates.rb +13 -0
- data/db/migrate/20091009134631_create_dynamic_attribute_values.rb +17 -0
- data/db/migrate/20091009134659_create_order_details.rb +24 -0
- data/db/migrate/20091009134706_create_order_shippings.rb +16 -0
- data/db/migrate/20091009134714_create_orders.rb +21 -0
- data/db/migrate/20091009134721_create_packs_products.rb +13 -0
- data/db/migrate/20091009134805_create_product_types.rb +11 -0
- data/db/migrate/20091009134813_create_products.rb +37 -0
- data/db/migrate/20091009134821_create_products_wishlists.rb +13 -0
- data/db/migrate/20091009134947_create_wishlists.rb +12 -0
- data/db/migrate/20100323143123_create_geo_zones_transporter_rules.rb +12 -0
- data/db/migrate/20100414090950_create_brands.rb +15 -0
- data/db/migrate/20100414091706_create_sizes.rb +15 -0
- data/db/migrate/20100928123009_add_patronage_to_people.rb +20 -0
- data/db/migrate/20101007074306_create_product_price_variations.rb +13 -0
- data/db/migrate/20110311111210_create_forms.rb +13 -0
- data/db/migrate/20110311112646_attributes_forms.rb +13 -0
- data/db/migrate/20110322165950_add_payment_methods_to_settings.rb +13 -0
- data/db/migrate/20110405084454_add_colissimo_methods_to_settings.rb +13 -0
- data/db/migrate/20110516075553_add_google_infos_to_settings.rb +11 -0
- data/db/migrate/20110831164213_add_order_fields_to_addresses.rb +9 -0
- data/lib/CMCIC_Config.rb +16 -0
- data/lib/CMCIC_Tpe.rb +227 -0
- data/lib/forgeos/commerce.rb +9 -0
- data/lib/forgeos/commerce/admin_menu.rb +28 -0
- data/lib/forgeos/commerce/engine.rb +11 -0
- data/lib/forgeos/commerce/float.rb +10 -0
- data/lib/forgeos/commerce/statistics.rb +62 -0
- data/lib/forgeos/commerce/version.rb +5 -0
- data/lib/forgeos_commerce.rb +1 -0
- data/lib/special_offer.rb +61 -0
- data/lib/tasks/install.rake +9 -0
- data/lib/transporter.rb +26 -0
- data/lib/voucher.rb +41 -0
- data/recipes/deploy.rb +15 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +9 -0
- data/test/dummy/app/assets/stylesheets/application.css +7 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +42 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +27 -0
- data/test/dummy/config/environments/production.rb +51 -0
- data/test/dummy/config/environments/test.rb +39 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/forgeos_commerce_test.rb +7 -0
- data/test/test_helper.rb +10 -0
- metadata +539 -0
@@ -0,0 +1,74 @@
|
|
1
|
+
# This Controller Manage GeoZones
|
2
|
+
class Admin::GeoZonesController < Admin::BaseController
|
3
|
+
before_filter :new_geo_zone, :only => [:create, :new, :add_element]
|
4
|
+
before_filter :get_geo_zone, :except => [:create, :new, :index]
|
5
|
+
|
6
|
+
# List GeoZones like a Tree.
|
7
|
+
def index
|
8
|
+
@geo_zones = GeoZone.find_all_by_parent_id(nil)
|
9
|
+
end
|
10
|
+
|
11
|
+
def new
|
12
|
+
render :layout => false
|
13
|
+
end
|
14
|
+
|
15
|
+
# Create a GeoZone
|
16
|
+
# ==== Params
|
17
|
+
# * geo_zone = Hash of GeoZone's attributes
|
18
|
+
#
|
19
|
+
# The GeoZone can be a child of another GeoZone.
|
20
|
+
def create
|
21
|
+
if @geo_zone.save
|
22
|
+
flash[:notice] = I18n.t('geo_zone.create.success').capitalize
|
23
|
+
else
|
24
|
+
flash[:error] = I18n.t('geo_zone.create.failed').capitalize
|
25
|
+
end
|
26
|
+
render :action => 'new', :layout => false
|
27
|
+
end
|
28
|
+
|
29
|
+
def add_element
|
30
|
+
render :text => @geo_zone.update_attribute(:transporter_rule_ids, @geo_zone.transporter_rule_ids << params[:element_id].to_i)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Edit a GeoZone
|
34
|
+
# ==== Params
|
35
|
+
# * id = GeoZone's id to edit
|
36
|
+
# * geo_zone = Hash of GeoZone's attributes
|
37
|
+
#
|
38
|
+
# The GeoZone can be a child of another GeoZone.
|
39
|
+
def edit
|
40
|
+
render :layout => false
|
41
|
+
end
|
42
|
+
|
43
|
+
def update
|
44
|
+
if @geo_zone.update_attributes(params[:geo_zone])
|
45
|
+
flash[:notice] = I18n.t('geo_zone.update.success').capitalize
|
46
|
+
else
|
47
|
+
flash[:error] = I18n.t('geo_zone.update.failed').capitalize
|
48
|
+
end
|
49
|
+
render :action => 'edit', :layout => false
|
50
|
+
end
|
51
|
+
# Destroy a GeoZone
|
52
|
+
# ==== Params
|
53
|
+
# * id = ProductGeoZone's id
|
54
|
+
# ==== Output
|
55
|
+
# if destroy succed, return the GeoZones list
|
56
|
+
def destroy
|
57
|
+
if @geo_zone.destroy
|
58
|
+
flash[:notice] = I18n.t('geo_zone.destroy.success').capitalize
|
59
|
+
else
|
60
|
+
flash[:error] = I18n.t('geo_zone.destroy.failed').capitalize
|
61
|
+
end
|
62
|
+
end
|
63
|
+
private
|
64
|
+
def get_geo_zone
|
65
|
+
unless @geo_zone = GeoZone.find_by_id(params[:id])
|
66
|
+
flash[:error] = I18n.t('geo_zone.not_exist').capitalize
|
67
|
+
return redirect_to([forgeos_commerce, :admin, :geo_zones])
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def new_geo_zone
|
72
|
+
@geo_zone = GeoZone.new(params[:geo_zone])
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
load File.join(Gem.loaded_specs['forgeos_cms'].full_gem_path, 'app', 'controllers', 'admin', 'import_controller.rb')
|
2
|
+
|
3
|
+
Admin::ImportController.class_eval do
|
4
|
+
before_filter :commerce_models, :only => :index
|
5
|
+
|
6
|
+
map_fields :create_product, (Product.new.attributes.keys.sort + ProductType.all.map(&:product_attributes).flatten.uniq.map(&:access_method).sort + Product.reflections.stringify_keys.keys.sort)
|
7
|
+
def create_product
|
8
|
+
create_model(Product,'sku')
|
9
|
+
end
|
10
|
+
|
11
|
+
map_fields :create_brand, Brand.new.attributes.keys.sort
|
12
|
+
def create_brand
|
13
|
+
create_model(Brand,'code')
|
14
|
+
end
|
15
|
+
|
16
|
+
map_fields :create_product_type, ProductType.new.attributes.keys.sort
|
17
|
+
def create_product_type
|
18
|
+
create_model(ProductType,'name')
|
19
|
+
end
|
20
|
+
|
21
|
+
map_fields :create_address, Address.new.attributes.keys.sort
|
22
|
+
def create_address
|
23
|
+
create_model(Address,'person_id')
|
24
|
+
end
|
25
|
+
|
26
|
+
map_fields :create_product_category, ProductCategory.new.attributes.keys.sort
|
27
|
+
def create_product_category
|
28
|
+
create_model(ProductCategory,'name')
|
29
|
+
end
|
30
|
+
|
31
|
+
map_fields :create_order, Order.new.attributes.keys.sort
|
32
|
+
def create_order
|
33
|
+
create_model(Order,'reference')
|
34
|
+
end
|
35
|
+
|
36
|
+
map_fields :create_order_detail, OrderDetail.new.attributes.keys.sort
|
37
|
+
def create_order_detail
|
38
|
+
create_model(OrderDetail,'sku')
|
39
|
+
end
|
40
|
+
|
41
|
+
map_fields :create_attribute_value, AttributeValue.new.attributes.keys.sort
|
42
|
+
def create_attribute_value
|
43
|
+
create_model(AttributeValue,'name')
|
44
|
+
end
|
45
|
+
private
|
46
|
+
|
47
|
+
def commerce_models
|
48
|
+
@models << 'product' << 'product_type' << 'product_category' << 'order' << 'order_detail' << 'attribute_value' << 'address' << 'brand'
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,248 @@
|
|
1
|
+
require 'ruleby'
|
2
|
+
|
3
|
+
class Admin::OrdersController < Admin::BaseController
|
4
|
+
include Ruleby
|
5
|
+
before_filter :new_order, :only => [:new, :create]
|
6
|
+
before_filter :get_order, :only => [:show, :edit, :update, :destroy, :pay, :accept, :sent, :total]
|
7
|
+
before_filter :get_civilities_and_countries, :only => [:new, :edit, :create, :update]
|
8
|
+
before_filter :get_available_transporters, :only => [:edit]
|
9
|
+
|
10
|
+
after_filter :render_list, :only => [:pay, :accept, :sent]
|
11
|
+
def index
|
12
|
+
respond_to do |format|
|
13
|
+
format.html
|
14
|
+
format.json do
|
15
|
+
sort
|
16
|
+
render(:layout => false)
|
17
|
+
end
|
18
|
+
format.csv do
|
19
|
+
params[:iDisplayLength] = 1000000
|
20
|
+
sort
|
21
|
+
csv_string = FasterCSV.generate({:force_quotes => true}) do |csv|
|
22
|
+
titles = ['user']
|
23
|
+
titles << 'user mail'
|
24
|
+
titles << 'total'
|
25
|
+
@orders.first.attributes.keys.collect{ |key| titles << key }
|
26
|
+
|
27
|
+
csv << titles
|
28
|
+
|
29
|
+
@orders.each do |record|
|
30
|
+
values = [record.user.fullname]
|
31
|
+
values << record.user.email
|
32
|
+
values << record.total()
|
33
|
+
record.attributes.values.collect{ |val| values << val }
|
34
|
+
|
35
|
+
csv << values
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
send_data csv_string,
|
40
|
+
:type => 'text/csv; charset=utf-8; header=present',
|
41
|
+
:disposition => "attachment; filename=#{controller_name}.csv"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def show
|
47
|
+
end
|
48
|
+
|
49
|
+
def new
|
50
|
+
render(:action => 'create')
|
51
|
+
end
|
52
|
+
|
53
|
+
def create
|
54
|
+
if @order.save
|
55
|
+
flash[:notice] = t('order.create.success').capitalize
|
56
|
+
redirect_to([forgeos_commerce, :edit, :admin, @order])
|
57
|
+
else
|
58
|
+
flash[:error] = t('order.create.failed').capitalize
|
59
|
+
render(:action => 'edit')
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def edit
|
64
|
+
end
|
65
|
+
|
66
|
+
def update
|
67
|
+
if @order.update_attributes(params[:order])
|
68
|
+
flash[:notice] = t('order.update.success').capitalize
|
69
|
+
return render(:text => true) if request.xhr?
|
70
|
+
else
|
71
|
+
flash[:error] = t('order.update.failed').capitalize
|
72
|
+
return render(:text => false) if request.xhr?
|
73
|
+
end
|
74
|
+
render(:action => 'edit')
|
75
|
+
end
|
76
|
+
|
77
|
+
def destroy
|
78
|
+
if @order.destroy
|
79
|
+
flash[:notice] = t('order.destroy.success').capitalize
|
80
|
+
else
|
81
|
+
flash[:error] = t('order.destroy.failed').capitalize
|
82
|
+
end
|
83
|
+
respond_to do |wants|
|
84
|
+
wants.html do
|
85
|
+
redirect_to([forgeos_commerce, :admin, :orders])
|
86
|
+
end
|
87
|
+
wants.js
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def pay
|
92
|
+
flash[:notice] = t('order.pay.success').capitalize if @order.pay! == true
|
93
|
+
end
|
94
|
+
|
95
|
+
def accept
|
96
|
+
flash[:notice] = t('order.accept.success').capitalize if @order.accept! == true
|
97
|
+
end
|
98
|
+
|
99
|
+
def sent
|
100
|
+
flash[:notice] = t('order.send.success').capitalize if @order.start_shipping! == true
|
101
|
+
end
|
102
|
+
|
103
|
+
def get_product
|
104
|
+
product = Product.find_by_id(params[:product_id])
|
105
|
+
@products = Product.all
|
106
|
+
render(:partial => 'form_details', :locals => { :order_detail => OrdersDetail.new(
|
107
|
+
{ :name => product.name, :description => product.description, :price => product.price, :rate_tax => product.rate_tax }
|
108
|
+
), :products => @products })
|
109
|
+
end
|
110
|
+
|
111
|
+
def total
|
112
|
+
if @order.nil?
|
113
|
+
@order = Order.new
|
114
|
+
@order.order_shipping = OrderShipping.new
|
115
|
+
end
|
116
|
+
# clone order and order_shipping
|
117
|
+
editing_order = @order.clone
|
118
|
+
editing_order.order_shipping = @order.order_shipping.clone
|
119
|
+
# get order_details ids
|
120
|
+
|
121
|
+
if order_details = params[:order][:order_details_attributes]
|
122
|
+
detail_ids = order_details.values.collect{ |detail| detail['id'].to_i if detail['id'] && detail['_destroy'].to_i != 1 }.uniq.compact
|
123
|
+
editing_order.order_detail_ids = detail_ids
|
124
|
+
end
|
125
|
+
|
126
|
+
# update attributes for order and order_shipping
|
127
|
+
editing_order.attributes = params[:order]
|
128
|
+
editing_order.order_shipping.attributes = params[:order][:order_shipping_attributes]
|
129
|
+
|
130
|
+
@transporter_ids = []
|
131
|
+
if params[:transporter][:rebuild].to_i == 1
|
132
|
+
# get new available transporters
|
133
|
+
@order = editing_order
|
134
|
+
engine :transporter_engine do |e|
|
135
|
+
rule_builder = Transporter.new(e)
|
136
|
+
rule_builder.transporter_ids = @transporter_ids
|
137
|
+
rule_builder.order = @order
|
138
|
+
rule_builder.rules
|
139
|
+
@order.order_details.each do |order_detail|
|
140
|
+
e.assert order_detail.product
|
141
|
+
end
|
142
|
+
e.assert @order
|
143
|
+
e.match
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
@available_transporters = TransporterRule.find_all_by_id(@transporter_ids.uniq)
|
148
|
+
|
149
|
+
#total(with_tax=false, with_currency=true,with_shipping=true,with_special_offer=false)
|
150
|
+
|
151
|
+
# calculate total, subtotal and taxes
|
152
|
+
total = editing_order.total
|
153
|
+
subtotal = editing_order.total(false,true,false,false,false)
|
154
|
+
#taxes = editing_order.taxes
|
155
|
+
|
156
|
+
return render(:json => { :result => 'success', :id => @order.id, :total => total, :subtotal => subtotal, :available_transporters => @available_transporters, :rebuild_transporter => params[:transporter][:rebuild].to_i}) #, :taxes => taxes}
|
157
|
+
end
|
158
|
+
|
159
|
+
private
|
160
|
+
|
161
|
+
def get_order
|
162
|
+
@order = Order.find_by_id(params[:id])
|
163
|
+
end
|
164
|
+
|
165
|
+
def new_order
|
166
|
+
@order = Order.new(params[:order])
|
167
|
+
user = User.find_by_id(params[:user_id])
|
168
|
+
if user
|
169
|
+
@order.user = user
|
170
|
+
@order.address_delivery = user.address_delivery
|
171
|
+
@order.address_invoice = user.address_invoice
|
172
|
+
end
|
173
|
+
@available_transporters = TransporterRule.find_all_by_active(true)
|
174
|
+
end
|
175
|
+
|
176
|
+
def get_civilities_and_countries
|
177
|
+
@civilities = t('civility.select')
|
178
|
+
@countries = Country.all :order => 'name ASC'
|
179
|
+
end
|
180
|
+
|
181
|
+
def get_available_transporters
|
182
|
+
@transporter_ids = []
|
183
|
+
begin
|
184
|
+
engine :transporter_engine do |e|
|
185
|
+
rule_builder = Transporter.new(e)
|
186
|
+
rule_builder.transporter_ids = @transporter_ids
|
187
|
+
rule_builder.order = @order
|
188
|
+
rule_builder.rules
|
189
|
+
@order.order_details.each do |order_detail|
|
190
|
+
e.assert order_detail.product
|
191
|
+
end
|
192
|
+
e.assert @order
|
193
|
+
e.match
|
194
|
+
end
|
195
|
+
rescue Exception
|
196
|
+
end
|
197
|
+
@available_transporters = TransporterRule.find_all_by_id(@transporter_ids.uniq)
|
198
|
+
end
|
199
|
+
|
200
|
+
def render_list
|
201
|
+
index
|
202
|
+
render(:partial => 'list', :locals => { :orders => @orders })
|
203
|
+
end
|
204
|
+
|
205
|
+
def sort
|
206
|
+
columns = %w(id reference sum(order_details.price) count(order_details.id) created_at people.lastname status)
|
207
|
+
|
208
|
+
per_page = params[:iDisplayLength].to_i
|
209
|
+
offset = params[:iDisplayStart].to_i
|
210
|
+
page = (offset / per_page) + 1
|
211
|
+
|
212
|
+
Order.per_page = per_page
|
213
|
+
conditions = Order.page(page)
|
214
|
+
|
215
|
+
case params[:filter]
|
216
|
+
when 'status'
|
217
|
+
conditions = conditions.where(:status => params[:status])
|
218
|
+
when 'user'
|
219
|
+
conditions = conditions.where(:user_id => params[:user_id])
|
220
|
+
else
|
221
|
+
conditions = conditions.where{ status << %w(unpaid closed) }
|
222
|
+
end
|
223
|
+
|
224
|
+
order_column = params[:iSortCol_0].to_i
|
225
|
+
includes = []
|
226
|
+
group_by = []
|
227
|
+
|
228
|
+
case order_column
|
229
|
+
when 2, 3
|
230
|
+
group_by << 'orders.id'
|
231
|
+
includes << :order_details
|
232
|
+
when 5
|
233
|
+
includes << :user
|
234
|
+
end
|
235
|
+
|
236
|
+
order = "#{columns[order_column]} #{params[:sSortDir_0].upcase if params[:sSortDir_0]}"
|
237
|
+
|
238
|
+
conditions = conditions.group(group_by.join(', ')) unless group_by.empty?
|
239
|
+
conditions = conditions.includes(includes) unless includes.empty?
|
240
|
+
conditions = conditions.order(order) unless order.squeeze.blank?
|
241
|
+
|
242
|
+
if params[:sSearch] && !params[:sSearch].blank?
|
243
|
+
@orders = conditions.search(params[:sSearch], { :star => true })
|
244
|
+
else
|
245
|
+
@orders = conditions
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
# This Controller Manage Products and his association with
|
2
|
+
# ProductDetail
|
3
|
+
class Admin::ProductTypesController < Admin::BaseController
|
4
|
+
# List ProductType
|
5
|
+
before_filter :get_product_type, :only => [:show, :edit, :update, :destroy]
|
6
|
+
before_filter :new_product_type, :only => [:new, :create]
|
7
|
+
|
8
|
+
def index
|
9
|
+
respond_to do |format|
|
10
|
+
format.html
|
11
|
+
format.json do
|
12
|
+
sort
|
13
|
+
render :layout => false
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def show
|
19
|
+
end
|
20
|
+
|
21
|
+
def new
|
22
|
+
end
|
23
|
+
|
24
|
+
# Create a ProductType
|
25
|
+
# ==== Params
|
26
|
+
# * product_type = Hash of ProductType's attributes
|
27
|
+
def create
|
28
|
+
if @product_type.save
|
29
|
+
flash[:notice] = I18n.t('product_type.create.success').capitalize
|
30
|
+
redirect_to([forgeos_commerce, :edit, :admin, @product_type])
|
31
|
+
else
|
32
|
+
flash[:error] = I18n.t('product_type.create.failed').capitalize
|
33
|
+
render :action => :new
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def edit
|
38
|
+
end
|
39
|
+
|
40
|
+
# Update a ProductType
|
41
|
+
# ==== Params
|
42
|
+
# * id = ProductType's id
|
43
|
+
def update
|
44
|
+
if @product_type.update_attributes(params[:product_type])
|
45
|
+
flash[:notice] = I18n.t('product.update.success').capitalize
|
46
|
+
else
|
47
|
+
flash[:error] = I18n.t('product.update.failed').capitalize
|
48
|
+
end
|
49
|
+
render :action => 'edit'
|
50
|
+
end
|
51
|
+
|
52
|
+
# Destroy a ProductType
|
53
|
+
# ==== Params
|
54
|
+
# * id = ProductType's id
|
55
|
+
def destroy
|
56
|
+
if @product_type.destroy
|
57
|
+
flash[:notice] = I18n.t('product.destroy.success').capitalize
|
58
|
+
else
|
59
|
+
flash[:error] = I18n.t('product.destroy.failed').capitalize
|
60
|
+
end
|
61
|
+
respond_to do |wants|
|
62
|
+
wants.html do
|
63
|
+
redirect_to([forgeos_commerce, :admin, :product_types])
|
64
|
+
end
|
65
|
+
wants.js
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
def get_product_type
|
71
|
+
unless @product_type = ProductType.find_by_id(params[:id])
|
72
|
+
flash[:error] = I18n.t('product_type.found.failed').capitalize
|
73
|
+
return redirect_to([forgeos_commerce, :admin, :product_types])
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def new_product_type
|
78
|
+
@product_type = ProductType.new(params[:product_type])
|
79
|
+
end
|
80
|
+
|
81
|
+
def sort
|
82
|
+
columns = %w('' product_type_translations.name count(products.id) '')
|
83
|
+
|
84
|
+
if params[:sSearch] && !params[:sSearch].blank?
|
85
|
+
columns = %w('' name count(products.id) '')
|
86
|
+
end
|
87
|
+
|
88
|
+
per_page = params[:iDisplayLength].to_i
|
89
|
+
offset = params[:iDisplayStart].to_i
|
90
|
+
page = (offset / per_page) + 1
|
91
|
+
order = "#{columns[params[:iSortCol_0].to_i]} #{params[:sSortDir_0].upcase}"
|
92
|
+
|
93
|
+
|
94
|
+
conditions = {}
|
95
|
+
includes = [:translations]
|
96
|
+
options = { :page => page, :per_page => per_page }
|
97
|
+
#joins = [:translations]
|
98
|
+
|
99
|
+
includes << :products if params[:iSortCol_0].to_i == 2
|
100
|
+
|
101
|
+
if params[:category_id]
|
102
|
+
conditions[:categories_elements] = { :category_id => params[:category_id] }
|
103
|
+
includes << :categories
|
104
|
+
joins = []
|
105
|
+
end
|
106
|
+
|
107
|
+
options[:conditions] = conditions unless conditions.empty?
|
108
|
+
options[:include] = includes unless includes.empty?
|
109
|
+
options[:order] = order unless order.squeeze.blank?
|
110
|
+
options[:joins] = joins
|
111
|
+
|
112
|
+
if params[:sSearch] && !params[:sSearch].blank?
|
113
|
+
options[:index] = "product_core.product_#{ActiveRecord::Base.locale}_core"
|
114
|
+
options[:sql_order] = options.delete(:order)
|
115
|
+
options[:joins] += options.delete(:include)
|
116
|
+
options[:star] = true
|
117
|
+
@product_types = ProductType.search(params[:sSearch],options)
|
118
|
+
else
|
119
|
+
@product_types = ProductType.paginate(options)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|