Procházet zdrojové kódy

Fix Variant to support accessing both nested variants with a product prefix as well as top level variants directly by variant_id.

Dennis Theisen před 14 roky
rodič
revize
a729c91b2b
1 změnil soubory, kde provedl 4 přidání a 0 odebrání
  1. 4 0
      lib/shopify_api.rb

+ 4 - 0
lib/shopify_api.rb

@@ -302,6 +302,10 @@ module ShopifyAPI
   
   class Variant < Base
     self.prefix = "/admin/products/:product_id/"
+    
+    def self.prefix(options={})
+      options[:product_id].nil? ? "/admin/" : "/admin/products/#{options[:product_id]}/"
+    end
   end
   
   class Image < Base