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,60 @@
|
|
1
|
+
module RoutesHelper
|
2
|
+
def seo_product_type_path(*args)
|
3
|
+
forgeos_commerce.product_type_path(extract_product_type_options(args)) rescue '/'
|
4
|
+
end
|
5
|
+
|
6
|
+
def seo_product_type_url(*args)
|
7
|
+
forgeos_commerce.product_type_url(extract_product_type_options(args)) rescue '/'
|
8
|
+
end
|
9
|
+
|
10
|
+
def extract_product_type_options(args)
|
11
|
+
options = args.dup.extract_options!
|
12
|
+
object = args.first
|
13
|
+
if object.kind_of?(ProductType)
|
14
|
+
return options.merge(:product_type_url => object.url )
|
15
|
+
else
|
16
|
+
return args
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def seo_product_path(*args)
|
21
|
+
super(extract_product_options(args)) rescue '/'
|
22
|
+
end
|
23
|
+
|
24
|
+
def seo_product_url(*args)
|
25
|
+
super(extract_product_options(args))
|
26
|
+
end
|
27
|
+
|
28
|
+
def extract_product_options(args)
|
29
|
+
options = args.dup.extract_options!
|
30
|
+
object = args.first
|
31
|
+
if object.kind_of?(Product)
|
32
|
+
product_type_url = (object.product_type.nil?) ? 'articles' : object.product_type.url
|
33
|
+
return options.merge( :url => object.url, :product_type => product_type_url )
|
34
|
+
else
|
35
|
+
return args
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def product_category_path(*args)
|
40
|
+
forgeos_commerce.product_category_path(extract_product_category_options(args))
|
41
|
+
end
|
42
|
+
|
43
|
+
def product_category_url(*args)
|
44
|
+
forgeos_commerce.product_category_url(extract_product_category_options(args))
|
45
|
+
end
|
46
|
+
|
47
|
+
def extract_product_category_options(args)
|
48
|
+
options = args.dup.extract_options!
|
49
|
+
object = args.first
|
50
|
+
if object.kind_of?(ProductCategory)
|
51
|
+
return options.merge(:id => nil, :category_name => object.name)
|
52
|
+
else
|
53
|
+
return args
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def seo_product_type_product_category_path(product_type,product_category)
|
58
|
+
product_type_product_category_path(:product_type_url=>product_type.url,:category_url=>product_category.url)
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,142 @@
|
|
1
|
+
# Methods for display <i>Wishlist</i> (in totality, by product, ...).
|
2
|
+
module WishlistHelper
|
3
|
+
# Display a wishlist's product
|
4
|
+
#
|
5
|
+
# == Parameters
|
6
|
+
# * <tt>wishlist</tt> a <i>Wishlist</i> object
|
7
|
+
# * <tt>wishlists_product</tt> a <i>WishlistsProduct</i> object
|
8
|
+
# * <tt>static</tt> add action's buttons for edit this wishlist if true, false by default
|
9
|
+
def display_wishlist_by_wishlists_product(wishlist, wishlists_product, static=false, mini=false)
|
10
|
+
content = "<div class='wishlist_product_line' id='forgeos_commerce_wishlist_product_line_#{wishlists_product.product_id}'>"
|
11
|
+
content += "<div class='wishlist_name'>"
|
12
|
+
content += link_to_product(wishlists_product.product)
|
13
|
+
content += "</div>"
|
14
|
+
content += "<div class='wishlist_quantity'>"
|
15
|
+
if static
|
16
|
+
content += wishlists_product.quantity.to_s
|
17
|
+
else
|
18
|
+
content += text_field_tag "wishlist_quantity_#{wishlists_product.product_id}", wishlists_product.quantity.to_s, :size => 2
|
19
|
+
content += observe_field("wishlist_quantity_#{wishlists_product.product_id}", :frequency => 1, :loading => "$('#spinner2').show()", :complete => "$('#spinner2').hide()", :url => { :controller => 'wishlist', :action => 'update_quantity', :mini => mini }, :with => "'quantity=' + escape(value) + '&product_id=#{wishlists_product.product_id}'")
|
20
|
+
end
|
21
|
+
content += "</div>"
|
22
|
+
unless mini
|
23
|
+
content += "<div class='wishlist_price'>"
|
24
|
+
content += wishlists_product.product.price.to_s
|
25
|
+
content += "</div>"
|
26
|
+
content += "<div class='wishlist_tax'>"
|
27
|
+
content += wishlists_product.tax.to_s
|
28
|
+
content += "</div>"
|
29
|
+
content += "<div class='wishlist_price'>"
|
30
|
+
content += wishlists_product.total(wishlists_product.product).to_s + " " + current_currency.html
|
31
|
+
content += "</div>"
|
32
|
+
end
|
33
|
+
content += "<div class='wishlist_remove'>"
|
34
|
+
unless static
|
35
|
+
content += link_to_wishlist_remove_product(wishlists_product.product, mini)
|
36
|
+
end
|
37
|
+
content += "</div>"
|
38
|
+
content += "</div>"
|
39
|
+
end
|
40
|
+
|
41
|
+
# Display all products lines
|
42
|
+
#
|
43
|
+
# == Parameters
|
44
|
+
# * <tt>wishlist</tt> a <i>Wishlist</i> object
|
45
|
+
# * <tt>static</tt> add action's buttons for edit this wishlist if true, false by default
|
46
|
+
def display_wishlist_all_products_lines(wishlist, static=false, mini=false)
|
47
|
+
return I18n.t('your_wishlist_is_empty').capitalize if wishlist.nil? || wishlist.is_empty?
|
48
|
+
content = ""
|
49
|
+
wishlist.products_wishlists.each do |wishlists_product|
|
50
|
+
content += display_wishlist_by_wishlists_product(wishlist, wishlists_product, static, mini)
|
51
|
+
end
|
52
|
+
content += "<div class='wishlist_total'><b>#{I18n.t('total').capitalize} : </b>"
|
53
|
+
content += wishlist.total(true).to_s + " " + current_currency.html
|
54
|
+
content += "</div>"
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
# Display a wishlist
|
59
|
+
#
|
60
|
+
# == Parameters
|
61
|
+
# * <tt>wishlist</tt> a <i>Wishlist</i> object
|
62
|
+
# * <tt>static</tt> add action's buttons for edit this wishlist if true, false by default
|
63
|
+
def display_wishlist(wishlist, static=false, mini=false)
|
64
|
+
content = '<div class="wishlist'+(mini ? ' mini' : '')+'" id="forgeos_commerce_wishlist">'
|
65
|
+
content += "<div class='wishlist_name'>#{I18n.t('name').capitalize}</div>"
|
66
|
+
content += "<div class='wishlist_name'>#{I18n.t('quantity', :count=>1).capitalize}</div>"
|
67
|
+
unless mini
|
68
|
+
content += "<div class='wishlist_name'>#{I18n.t('unit_price').capitalize}</div>"
|
69
|
+
content += "<div class='wishlist_name'>#{I18n.t('tax', :count=>1).capitalize}</div>"
|
70
|
+
content += "<div class='wishlist_name'>#{I18n.t('total').capitalize}</div>"
|
71
|
+
end
|
72
|
+
content += "<div id='forgeos_commerce_wishlist_products'>"
|
73
|
+
content += display_wishlist_all_products_lines(wishlist, static, mini)
|
74
|
+
content += "</div>"
|
75
|
+
content += "</div>"
|
76
|
+
if mini && !wishlist.is_empty?
|
77
|
+
content += '<div class="link_empty">'
|
78
|
+
content += link_to_wishlist_empty(mini)
|
79
|
+
content += '</div>'
|
80
|
+
content += '<div class="link_send">'
|
81
|
+
content += link_to_send_wishlist(mini)
|
82
|
+
content += '</div>'
|
83
|
+
end
|
84
|
+
content += "<div class='clear'></div>"
|
85
|
+
end
|
86
|
+
|
87
|
+
# Extension of <i>link_to(name, options = {}, html_options = nil)</i> with a <i>Product</i> object of first parameter
|
88
|
+
#
|
89
|
+
# ==== Parameters
|
90
|
+
# * <tt>:product</tt> - a <i>Product</i> object
|
91
|
+
# * <tt>:name</tt> - name, <i>image_tag('forgeos_commerce/remove_product.gif')</i> by default
|
92
|
+
# * <tt>:url</tt> - url, <i>{:controller => 'wishlist', :action => 'empty'}</i> by default
|
93
|
+
# * <tt>options</tt> the html options
|
94
|
+
def link_to_wishlist_remove_product(product, mini=false, name=image_tag('forgeos_commerce/remove_product.gif'), options={:confirm => I18n.t(:confirm_remove_product)})
|
95
|
+
if mini
|
96
|
+
link_to_remote(name,{ :url=>{:controller => 'wishlist', :action => 'remove_product', :id => product}, :update => 'wishlist' }.merge(options))
|
97
|
+
else
|
98
|
+
link_to(name, {:controller => 'wishlist', :action => 'remove_product', :id => product}, options)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
# Extension of <i>link_to(name, options = {}, html_options = nil)</i>
|
103
|
+
#
|
104
|
+
# ==== Parameters
|
105
|
+
# * <tt>:name</tt> - name
|
106
|
+
# * <tt>:url</tt> - url, <i>{:controller => 'wishlist', :action => 'empty'}</i> by default
|
107
|
+
# * <tt>options</tt> the html options
|
108
|
+
def link_to_wishlist_empty(mini=false,name=I18n.t('empty_wishlist').capitalize, url={:controller => 'wishlist', :action => 'empty'}, options={:confirm => I18n.t(:confirm_empty_wishlist)})
|
109
|
+
if mini
|
110
|
+
link_to_remote name, { :update => 'wishlist', :url => url }.merge(options)
|
111
|
+
else
|
112
|
+
link_to name, url, options
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
# Extension of <i>link_to(name, options = {}, html_options = nil)</i>
|
117
|
+
#
|
118
|
+
# ==== Parameters
|
119
|
+
# * <tt>:name</tt> - name, <i>"Wishlist"</i> by default
|
120
|
+
# * <tt>:url</tt> - url, <i>{:controller => 'wishlist'}</i> by default
|
121
|
+
# * <tt>options</tt> the html options
|
122
|
+
def link_to_wishlist(name=I18n.t('wishlist',:count => 1), url={:controller => 'wishlist'}, options=nil)
|
123
|
+
wishlist = Wishlist.find_by_id(session[:wishlist_id])
|
124
|
+
unless wishlist.nil?
|
125
|
+
name = "#{name} (#{wishlist.size} #{I18n.t('product', :count => wishlist.size)})"
|
126
|
+
end
|
127
|
+
link_to name.capitalize, {:controller => 'wishlist'}, options
|
128
|
+
end
|
129
|
+
|
130
|
+
def link_to_send_wishlist(mini=false,name=I18n.t('wishlist.send.friend').capitalize, url={:controller => 'wishlist', :action => 'send_to_friend'}, options={})
|
131
|
+
if mini
|
132
|
+
link_to_remote name.capitalize, { :method => :get, :update => 'wishlist', :url => url }.merge(options)
|
133
|
+
else
|
134
|
+
link_to name.capitalize, url, options
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
def button_add_to_wishlist(product, name=I18n.t('add_to_wishlist'), options={})
|
139
|
+
url = {:controller => 'wishlist', :action => 'add_product', :id => product.id}
|
140
|
+
button_to(name, url, { :id => 'add_to_wishlist' }.merge(options))
|
141
|
+
end
|
142
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class Attribute < ActiveRecord::Base
|
2
|
+
translates :name
|
3
|
+
has_and_belongs_to_many :categories, :readonly => true, :join_table => 'categories_elements', :foreign_key => 'element_id', :association_foreign_key => 'category_id'
|
4
|
+
|
5
|
+
has_many :attribute_values, :dependent => :destroy, :order => 'position'
|
6
|
+
accepts_nested_attributes_for :attribute_values, :allow_destroy => true
|
7
|
+
has_many :dynamic_attribute_values, :dependent => :destroy
|
8
|
+
|
9
|
+
validates :name, :presence => true
|
10
|
+
validates :access_method, :presence => true, :uniqueness => true
|
11
|
+
|
12
|
+
has_and_belongs_to_many :product_types, :readonly => true
|
13
|
+
has_and_belongs_to_many :forms, :readonly => true
|
14
|
+
has_many :products, :through => :dynamic_attribute_values, :readonly => true
|
15
|
+
|
16
|
+
before_update :clear_attributes, :if => :dynamic?
|
17
|
+
|
18
|
+
define_index do
|
19
|
+
indexes access_method, :sortable => true
|
20
|
+
indexes type
|
21
|
+
end
|
22
|
+
|
23
|
+
define_translated_index :name
|
24
|
+
|
25
|
+
def clone
|
26
|
+
attribute = super
|
27
|
+
attribute.attribute_values = self.attribute_values.collect(&:clone)
|
28
|
+
%w(category_ids attachment_ids).each do |method|
|
29
|
+
attribute.send("#{method}=",self.send(method))
|
30
|
+
end
|
31
|
+
attribute
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
def clear_attributes
|
36
|
+
attribute_values.destroy_all
|
37
|
+
end
|
38
|
+
end
|
data/app/models/brand.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
class Brand < ActiveRecord::Base
|
2
|
+
acts_as_commentable
|
3
|
+
|
4
|
+
accepts_nested_attributes_for :comments
|
5
|
+
belongs_to :picture
|
6
|
+
|
7
|
+
has_many :products
|
8
|
+
belongs_to :product_type
|
9
|
+
|
10
|
+
has_and_belongs_to_many :categories, :readonly => true, :join_table => 'categories_elements', :foreign_key => 'element_id', :association_foreign_key => 'category_id'
|
11
|
+
|
12
|
+
validates :name, :presence => true
|
13
|
+
|
14
|
+
define_index do
|
15
|
+
indexes name, :sortable => true
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.modify_import_attributes(attributes)
|
19
|
+
attributes[:category_ids] = attributes.delete(:categories) unless attributes[:categories].blank?
|
20
|
+
attributes
|
21
|
+
end
|
22
|
+
end
|
data/app/models/cart.rb
ADDED
@@ -0,0 +1,190 @@
|
|
1
|
+
class Cart < ActiveRecord::Base
|
2
|
+
attr_accessor :voucher_discount, :voucher_discount_price, :voucher
|
3
|
+
attr_accessor :special_offer_discount, :special_offer_discount_price
|
4
|
+
attr_accessor :free_shipping
|
5
|
+
|
6
|
+
has_many :cart_items, :dependent => :destroy
|
7
|
+
has_many :products, :through => :cart_items
|
8
|
+
|
9
|
+
serialize :options
|
10
|
+
|
11
|
+
belongs_to :user
|
12
|
+
|
13
|
+
def add_product(product,quantity=nil)
|
14
|
+
return false if product.nil? || product.new_record?
|
15
|
+
add_product_id(product.id,quantity)
|
16
|
+
end
|
17
|
+
|
18
|
+
def add_product_id(product_id,quantity=1)
|
19
|
+
if cart_item = cart_items.find_by_product_id(product_id)
|
20
|
+
cart_item.increment(:quantity, quantity)
|
21
|
+
else
|
22
|
+
CartItem.create(:product_id => product_id, :quantity => quantity, :cart_id => self.id)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def remove_product(product,quantity=nil)
|
27
|
+
remove_product_id(product.id,quantity)
|
28
|
+
end
|
29
|
+
|
30
|
+
def remove_product_id(product_id, quantity = 1)
|
31
|
+
if cart_item = cart_items.find_all_by_product_id(product_id)
|
32
|
+
cart_item.decrement(:quantity, quantity)
|
33
|
+
cart_item.destroy if cart_item.quantity.zero?
|
34
|
+
else
|
35
|
+
false
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
# Empty this cart
|
41
|
+
def to_empty
|
42
|
+
cart_items.destroy_all
|
43
|
+
end
|
44
|
+
|
45
|
+
# Returns true if cart is empty, returns false else
|
46
|
+
def is_empty?
|
47
|
+
total_items == 0
|
48
|
+
end
|
49
|
+
|
50
|
+
def taxes
|
51
|
+
#total(true) - total(false)
|
52
|
+
end
|
53
|
+
|
54
|
+
def discount
|
55
|
+
total(:cart_voucher_discount => false, :cart_special_offer_discount => false, :product_voucher_discount => false) - total
|
56
|
+
end
|
57
|
+
|
58
|
+
def total(*args)
|
59
|
+
passed_options = args.extract_options!
|
60
|
+
options = {
|
61
|
+
:tax => true,
|
62
|
+
:cart_voucher_discount => true,
|
63
|
+
:cart_special_offer_discount => true,
|
64
|
+
:product_voucher_discount => true,
|
65
|
+
:product_special_offer_discount => true,
|
66
|
+
:patronage => true,
|
67
|
+
:cart_packaging => true,
|
68
|
+
:product_packaging=> true
|
69
|
+
}.update(passed_options.symbolize_keys)
|
70
|
+
|
71
|
+
total = 0.0
|
72
|
+
|
73
|
+
cart_items.each do |cart_product|
|
74
|
+
product_price = cart_product.product.price(
|
75
|
+
:tax => options[:tax],
|
76
|
+
:voucher_discount => options[:product_voucher_discount],
|
77
|
+
:special_offer_discount => options[:product_special_offer_discount],
|
78
|
+
:packaging => options[:product_packaging]
|
79
|
+
)
|
80
|
+
total += product_price * cart_product.quantity
|
81
|
+
end
|
82
|
+
|
83
|
+
total -= self.voucher_discount_price.to_f || 0.0 if options[:cart_voucher_discount]
|
84
|
+
total -= self.special_offer_discount_price.to_f || 0.0 if options[:cart_special_offer_discount]
|
85
|
+
total -= self.patronage_discount.to_f || 0.0 if options[:patronage]
|
86
|
+
total += self.packaging_price.to_f || 0.0 if options[:cart_packaging]
|
87
|
+
|
88
|
+
total = self.after_total(total, options) if self.respond_to?(:after_total)
|
89
|
+
|
90
|
+
total = 0.0 if total < 0
|
91
|
+
total
|
92
|
+
end
|
93
|
+
|
94
|
+
def packaging_price
|
95
|
+
#TODO get carts options from config
|
96
|
+
return 0
|
97
|
+
end
|
98
|
+
|
99
|
+
def patronage_discount
|
100
|
+
return 0 unless self.user
|
101
|
+
if self.user.has_nephew_discount?
|
102
|
+
if Setting.first.nephew_discount_percent?
|
103
|
+
self.user.patronage_discount * total(:packaging => false, :tax => false) / 100.0
|
104
|
+
else
|
105
|
+
self.user.patronage_discount
|
106
|
+
end
|
107
|
+
elsif self.user.has_godfather_discount?
|
108
|
+
if Setting.first.nephew_discount_percent?
|
109
|
+
self.user.patronage_discount * total(:packaging => false, :tax => false) / 100.0
|
110
|
+
else
|
111
|
+
self.user.patronage_discount
|
112
|
+
end
|
113
|
+
else
|
114
|
+
0
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
# Returns weight of this cart
|
119
|
+
def weight(product=nil)
|
120
|
+
if product.nil?
|
121
|
+
cart_items.map(&:weight).sum
|
122
|
+
elsif cart_item = cart_items.find_by_product_id(product.id)
|
123
|
+
cart_item.weight
|
124
|
+
else
|
125
|
+
0
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def total_items
|
130
|
+
return cart_items.size
|
131
|
+
end
|
132
|
+
|
133
|
+
def discount_cart(discount, percent=nil)
|
134
|
+
percent.nil? ? self.update_attributes(:discount => discount) : self.update_attributes(:discount => discount, :percent => 1)
|
135
|
+
end
|
136
|
+
|
137
|
+
def address_invoice
|
138
|
+
AddressInvoice.find_by_id(options[:address_invoice_id])
|
139
|
+
end
|
140
|
+
|
141
|
+
def address_delivery
|
142
|
+
AddressDelivery.find_by_id(options[:address_delivery_id])
|
143
|
+
end
|
144
|
+
|
145
|
+
def transporter
|
146
|
+
TransporterRule.find_by_id(options[:transporter_rule_id])
|
147
|
+
end
|
148
|
+
|
149
|
+
def options
|
150
|
+
read_attribute(:options)
|
151
|
+
end
|
152
|
+
|
153
|
+
def transporter_id
|
154
|
+
return 0 unless options[:transporter_rule_id]
|
155
|
+
options[:transporter_rule_id].to_i
|
156
|
+
end
|
157
|
+
|
158
|
+
def address_from_colissimo
|
159
|
+
if params = self.options[:colissimo]
|
160
|
+
case params[:DELIVERYMODE]
|
161
|
+
when 'DOM', 'RDV', 'DOS'
|
162
|
+
AddressDelivery.create(
|
163
|
+
:designation => 'So colissimo',
|
164
|
+
:civility => params['CECIVILITY'],
|
165
|
+
:name => params['CENAME'],
|
166
|
+
:firstname => params['CEFIRSTNAME'],
|
167
|
+
:city => params['CETOWN'],
|
168
|
+
:zip_code => params['CEZIPCODE'],
|
169
|
+
:address => params['CEADRESS3'],
|
170
|
+
:address_2 => params['CEADRESS4'],
|
171
|
+
:country_id => Country.find_by_name('FRANCE').id,
|
172
|
+
:form_attributes => { :other_phone => params['CEPHONENUMBER'], :phone => params['CEPHONENUMBER'],:email => params['CEEMAIL'] }
|
173
|
+
)
|
174
|
+
else
|
175
|
+
AddressDelivery.create(
|
176
|
+
:designation => 'So colissimo',
|
177
|
+
:civility => params['CECIVILITY'],
|
178
|
+
:name => params['PRNAME'],
|
179
|
+
:firstname => params['CEFIRSTNAME'],
|
180
|
+
:city => params['PRTOWN'],
|
181
|
+
:zip_code => params['PRZIPCODE'],
|
182
|
+
:address => params['PRADRESS1'],
|
183
|
+
:address_2 => params['PRADRESS2'],
|
184
|
+
:country_id => Country.find_by_name('FRANCE').id,
|
185
|
+
:form_attributes => { :colisssimo_point_id => params['PRID'], :other_phone => params['CEPHONENUMBER'], :phone => params['CEPHONENUMBER'], :email => params['CEEMAIL'] }
|
186
|
+
)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|