spree_skroutz 1.1.3 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/spree/integrations/skroutz.rb +14 -0
- data/app/models/spree/product_decorator.rb +13 -0
- data/app/views/spree/admin/integrations/forms/_skroutz.html.erb +9 -0
- data/app/views/spree/admin/products/_skroutz_availability.html.erb +19 -0
- data/app/views/spree_skroutz/products.xml.builder +11 -2
- data/config/initializers/spree.rb +4 -0
- data/config/locales/el.yml +7 -0
- data/config/locales/en.yml +7 -0
- data/lib/spree_skroutz/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b92ba5a4a3916ea1e015256d338b783159f3cb54596bb6099ae9880bea4537ff
|
|
4
|
+
data.tar.gz: 8a98faeae92357eabf413c28a88f7e4512d47b495e79e61535815fce750d40cd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 34180cd7892cc020771e4e9803bb15a75ab94428022b9535d378760f1464e577553f358939ab9361f98e3258a27ec83daac10bd01186c091d793f0bd68829f02
|
|
7
|
+
data.tar.gz: 208f785301f8d4146712369a5e8d4c670324c94cef69bbd0a4812e6b8e8013e301df4e27c98b10f3d051656e8d7056c5b89296ba9e3eeb870da4e986a2fe44dc
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
module Spree
|
|
2
2
|
module Integrations
|
|
3
3
|
class Skroutz < Spree::Integration
|
|
4
|
+
OUT_OF_STOCK_AVAILABILITY_OPTIONS = [
|
|
5
|
+
'Available from 4 to 6 days',
|
|
6
|
+
'Available up to 12 days'
|
|
7
|
+
].freeze
|
|
8
|
+
|
|
9
|
+
AVAILABILITY_OPTIONS = [
|
|
10
|
+
'In Stock',
|
|
11
|
+
'Available from 1 to 3 days',
|
|
12
|
+
*OUT_OF_STOCK_AVAILABILITY_OPTIONS
|
|
13
|
+
].freeze
|
|
14
|
+
|
|
15
|
+
preference :express_delivery, :boolean, default: false
|
|
16
|
+
preference :default_availability, :string
|
|
17
|
+
|
|
4
18
|
def self.integration_group
|
|
5
19
|
'marketing'
|
|
6
20
|
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module ProductDecorator
|
|
3
|
+
def skroutz_availability
|
|
4
|
+
private_metadata['skroutz_availability'].presence
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def skroutz_availability=(value)
|
|
8
|
+
self.private_metadata = private_metadata.merge('skroutz_availability' => value.presence)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
Spree::Product.prepend self
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -4,6 +4,15 @@
|
|
|
4
4
|
<p>
|
|
5
5
|
<%= Spree.t('admin.integrations.skroutz.description') %>
|
|
6
6
|
</p>
|
|
7
|
+
<%= preference_field(@integration, form, 'express_delivery', i18n_scope: 'admin.integrations.skroutz') %>
|
|
8
|
+
|
|
9
|
+
<div class="form-group">
|
|
10
|
+
<%= form.label :preferred_default_availability, Spree.t('admin.integrations.skroutz.preferred_default_availability') %>
|
|
11
|
+
<%= form.select :preferred_default_availability,
|
|
12
|
+
options_for_select(Spree::Integrations::Skroutz::OUT_OF_STOCK_AVAILABILITY_OPTIONS, @integration.preferred_default_availability),
|
|
13
|
+
{ include_blank: Spree.t('admin.integrations.skroutz.preferred_default_availability_none') },
|
|
14
|
+
{ class: 'custom-select', data: { action: 'auto-submit#submit' } } %>
|
|
15
|
+
</div>
|
|
7
16
|
</div>
|
|
8
17
|
</div>
|
|
9
18
|
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<div class="card mb-4">
|
|
2
|
+
<div class="card-header">
|
|
3
|
+
<h6 class="mb-0"><%= Spree.t('admin.integrations.skroutz.title') %></h6>
|
|
4
|
+
</div>
|
|
5
|
+
<div class="card-body">
|
|
6
|
+
<div class="form-group">
|
|
7
|
+
<%= f.label :skroutz_availability, Spree.t('admin.products.skroutz_availability') %>
|
|
8
|
+
<%= f.select :skroutz_availability,
|
|
9
|
+
options_for_select(
|
|
10
|
+
[[Spree.t('admin.products.skroutz_availability_default'), '']] +
|
|
11
|
+
Spree::Integrations::Skroutz::OUT_OF_STOCK_AVAILABILITY_OPTIONS,
|
|
12
|
+
product.skroutz_availability.to_s
|
|
13
|
+
),
|
|
14
|
+
{},
|
|
15
|
+
{ class: 'custom-select' } %>
|
|
16
|
+
<small class="form-text text-muted"><%= Spree.t('admin.products.skroutz_availability_hint') %></small>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
xml.instruct! :xml, version: "1.0", encoding: "UTF-8"
|
|
2
2
|
|
|
3
|
+
skroutz_integration = store_integration('skroutz')
|
|
4
|
+
express_delivery = skroutz_integration&.preferred_express_delivery
|
|
5
|
+
availability_in_stock = express_delivery ? "In Stock" : "Available from 1 to 3 days"
|
|
6
|
+
default_availability = skroutz_integration&.preferred_default_availability.presence
|
|
7
|
+
|
|
3
8
|
xml.mywebstore do
|
|
4
9
|
cache [storefront_products_scope, current_currency] do
|
|
5
10
|
xml.created_at Time.current.strftime("%Y-%m-%d %H:%M")
|
|
6
11
|
|
|
7
12
|
xml.products do
|
|
8
13
|
storefront_products_scope.find_each do |product|
|
|
14
|
+
in_stock = product.master.track_inventory && product.in_stock?
|
|
15
|
+
out_of_stock_availability = product.skroutz_availability.presence || default_availability
|
|
16
|
+
next if !in_stock && out_of_stock_availability.nil?
|
|
17
|
+
|
|
9
18
|
xml.product do
|
|
10
19
|
xml.tag! "id", product.id
|
|
11
20
|
|
|
@@ -44,7 +53,7 @@ xml.mywebstore do
|
|
|
44
53
|
xml.tag! "vat", 0
|
|
45
54
|
end
|
|
46
55
|
|
|
47
|
-
xml.tag! "availability",
|
|
56
|
+
xml.tag! "availability", in_stock ? availability_in_stock : out_of_stock_availability
|
|
48
57
|
|
|
49
58
|
if product.brand_taxon.present?
|
|
50
59
|
xml.tag! "manufacturer" do
|
|
@@ -83,7 +92,7 @@ xml.mywebstore do
|
|
|
83
92
|
size_variants.each do |variant|
|
|
84
93
|
xml.variation do
|
|
85
94
|
xml.tag! "variationid", variant.id
|
|
86
|
-
xml.tag! "availability", variant.in_stock? ?
|
|
95
|
+
xml.tag! "availability", variant.in_stock? ? availability_in_stock : out_of_stock_availability
|
|
87
96
|
xml.tag! "ean", variant.barcode if variant.barcode.present?
|
|
88
97
|
xml.tag! "price_with_vat", format('%.2f', variant.display_price.to_d)
|
|
89
98
|
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
Rails.application.config.after_initialize do
|
|
2
2
|
Spree.integrations << Spree::Integrations::Skroutz
|
|
3
|
+
|
|
4
|
+
Spree::PermittedAttributes.product_attributes.push(:skroutz_availability)
|
|
5
|
+
|
|
6
|
+
Rails.application.config.spree_admin.product_form_partials << 'spree/admin/products/skroutz_availability'
|
|
3
7
|
end
|
data/config/locales/el.yml
CHANGED
|
@@ -6,3 +6,10 @@ el:
|
|
|
6
6
|
skroutz:
|
|
7
7
|
title: Skroutz
|
|
8
8
|
description: Το Skroutz είναι εργαλείο για καταχωρίσεις προϊόντων στο Skroutz Merchants
|
|
9
|
+
express_delivery: Γρήγορη παράδοση
|
|
10
|
+
preferred_default_availability: Προεπιλεγμένη διαθεσιμότητα (εκτός αποθέματος)
|
|
11
|
+
preferred_default_availability_none: "Χωρίς προεπιλογή (τα εκτός αποθέματος εξαιρούνται)"
|
|
12
|
+
products:
|
|
13
|
+
skroutz_availability: Διαθεσιμότητα Skroutz (override)
|
|
14
|
+
skroutz_availability_default: Χρήση προεπιλογής καταστήματος
|
|
15
|
+
skroutz_availability_hint: Αντικαταστήστε την προεπιλεγμένη διαθεσιμότητα για αυτό το προϊόν όταν είναι εκτός αποθέματος ή δεν παρακολουθεί απόθεμα.
|
data/config/locales/en.yml
CHANGED
|
@@ -6,3 +6,10 @@ en:
|
|
|
6
6
|
skroutz:
|
|
7
7
|
title: Skroutz
|
|
8
8
|
description: Skroutz is a channel integration for product listings on Skroutz Merchants
|
|
9
|
+
express_delivery: Express delivery
|
|
10
|
+
preferred_default_availability: Default availability (out of stock)
|
|
11
|
+
preferred_default_availability_none: "No default (out-of-stock products excluded)"
|
|
12
|
+
products:
|
|
13
|
+
skroutz_availability: Skroutz availability override
|
|
14
|
+
skroutz_availability_default: Use store default
|
|
15
|
+
skroutz_availability_hint: Override the store default availability for this product when out of stock or not tracking inventory.
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spree_skroutz
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OlympusOne
|
|
@@ -91,7 +91,9 @@ files:
|
|
|
91
91
|
- app/assets/images/integration_icons/skroutz-logo.webp
|
|
92
92
|
- app/controllers/spree/skroutz_controller.rb
|
|
93
93
|
- app/models/spree/integrations/skroutz.rb
|
|
94
|
+
- app/models/spree/product_decorator.rb
|
|
94
95
|
- app/views/spree/admin/integrations/forms/_skroutz.html.erb
|
|
96
|
+
- app/views/spree/admin/products/_skroutz_availability.html.erb
|
|
95
97
|
- app/views/spree_skroutz/products.xml.builder
|
|
96
98
|
- config/initializers/spree.rb
|
|
97
99
|
- config/locales/el.yml
|
|
@@ -107,10 +109,10 @@ licenses:
|
|
|
107
109
|
- MIT
|
|
108
110
|
metadata:
|
|
109
111
|
bug_tracker_uri: https://github.com/olympusone/spree_skroutz/issues
|
|
110
|
-
changelog_uri: https://github.com/olympusone/spree_skroutz/releases/tag/v1.
|
|
112
|
+
changelog_uri: https://github.com/olympusone/spree_skroutz/releases/tag/v1.2.0
|
|
111
113
|
documentation_uri: https://github.com/olympusone/spree_skroutz
|
|
112
114
|
homepage_uri: https://github.com/olympusone/spree_skroutz
|
|
113
|
-
source_code_uri: https://github.com/olympusone/spree_skroutz/tree/v1.
|
|
115
|
+
source_code_uri: https://github.com/olympusone/spree_skroutz/tree/v1.2.0
|
|
114
116
|
rdoc_options: []
|
|
115
117
|
require_paths:
|
|
116
118
|
- lib
|