Can Image assets be used as ecommerce items?


(Robin Bilney) #1

I've been playing around with the ecommerce package in Matrix, trying to get Image assets to become purchasable items but I keep getting the Matrix notice:

  File:

			[SYSTEM_ROOT]/packages/ecommerce/form/form_ecommerce/form_ecommerce.inc
		
			Line:
		
			295
	
			Message:
		
			This item cannot be purchased
	<p>&#160;<p>I've followed the steps in the Manuals - <a data-ipb='nomediaparse' href='https://manuals.matrix.squizsuite.net/e-commerce/chapters/using-other-assets'>https://manuals.matrix.squizsuite.net/e-commerce/chapters/using-other-assets</a>- and I've tried setting up an Ecommerce Form Page as well as trying to do Checkout/Cart option. <p>&#160;<p>Is it possible to have images as purchasable items?&#160;&#160;<p>&#160;<p>Can you have Other Assets as Items work with a checkout/cart?<p>&#160;<p>Thanks,<p>Robin.<p>&#160;<p>&#160;<p>&#160;

(Bart Banda) #2

Hi Robin, not sure if images can be used, never tried using them. 

 

What version of Matrix did  you try this on?


(Robin Bilney) #3

We are on v5.0.4.0 at the moment.

 

Are you aware of any situations where Matrix has been used to sell digital products - e.g. images or documents?


(Bart Banda) #4

I think we've done that in the past,  but I think product assets have always been used and the images/pdfs linked under the product asset itself. I'll see if I can get a dev to review this. 


(Edison Wang) #5

HI Robin,

 

You should be able to use other items are ecommerce purchase-able products.

The trick is, you have to set the "Price Source" setting in the ecommerce form details screen to give the asset a price.

Normally you would apply a metadata schema to the target assets, and put a metadata keyword here as Price Source.

 

The error you got is just because Matrix try to evaluate the Price Source on the asset, but it couldn't get a valid numeric value as the price, hence it throws that error.

 

 

Edison


(Luke Wright) #6

Hi Robin,

 

The two assets you had tried to use have different definitions of how a purchasable product is defined:

  • Ecommerce Cart: Acceptable assets are either Donation assets, or assets which extend the "Buyable" interface (which includes Product). Although the base Image assets can't be bought through Ecommerce Cart by themselves, it would likely be possible to write a custom asset that does not much more than go "class ImageProduct extends Image implements Buyable".
  • Ecommerce Form: Any asset can theoretically be purchased, but whether an asset can be purchased or not depends on the "asset_price_source" attribute in the form - if the result of this definition on an asset (after replacing keywords) is numeric, the product is purchasable. This accepts keywords, so a typical method of defining this is through adding a metadata field on your potential product. (Other metadata fields could typically then be used to mark whether the product is with/without tax, etc.)

Which method works better for you would depend on your individual circumstances obviously - I suspect that in current circumstances Ecommerce Form would be more likely suitable, but I'm not sure how simple it would be in either case to directly serve the purchased asset out - this would be a bit more complex, not in the least permissions-wise.


(Robin Bilney) #7

Thanks for the responses.  I've recreated the Ecommerce Form Page and it's now working. I think I was getting the errors because I had a default amount set (5.00) for the Price metadata field, and the image's metadata field had 'use default' set.  It didn't seem to like that.

 

 

Luke, so we'd need to get Squiz to develop us a custom asset for us to use images in a shopping cart? 

 

Thanks,

Robin.