let's say I have :
var Book = Backbone.Model.extend(); var Collection = Backbone.Collection.extend({ model: Book, url: '/books', initialize: function(){ this.fetch(); }) })
How can I change the Collection
's url
when instantiating a new collection ?
var AdventureBooks = new Books({ url: '/books/adventure' })
does not work
var AdventureBooks = new Books({ category: 'adventure' })
and in the Collection definition:
url : '/books/' + this.category
does not work either.
Thanks.
Step 1: Go to Shopify Admin > Products > All products or Shopify Admin > Products > Collections and then select your preferred one. Step 2: Under the Search engine listing preview section, click on “Edit website SEO.” Enter your preferred URL in the URL and handle field.
From your Shopify admin, go to Products. Click the product that you want to add to a collection. In the Collections section, select one or more existing collections. Click Save to add the product to all the selected collections.
Change the name or description of a collectionFrom your Shopify admin, go to Products > Collections. Click the name of the collection that you want to update. On the collection details page, enter a new title or a new description. Click Save.
The following should work:
var AdventureBooks = new Books(); AdventureBooks.url = '/books/adventure';
var Book = Backbone.Model.extend({ "url": function() { return '/books/' + this.get("category"); } });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With