News - CrystalCommerce Liquid Documentation for Designers

News

Allow Multiple Tags in tagged_with filter

Jan 8, 2012 Allow Multiple Tags in tagged_with filter

You can now specify multiple tags in the tagged_with block, delimited by a comma.

{% tagged_with 'Hot Seller,Awesome Stuff' do products %}
  <table border="0" class="invisible-table" width="100%">
    {% include 'product' with products %}
  </table>
{% endtagged_with %}

Customer's Locale

Dec 2, 2011 Customer's Locale

We’ve added locale select to the user account page. For stores with multiple locales (like Cardhaus) the user is associated with the locale of the theme they are viewing when they signup. This is used for emails generated and sent to the user regarding their account. The user may change their locale with the new option in the user_account.liquid.

The option for a different locale only appears if the store has more than one theme.


Infinite Qty Variants

Nov 20, 2011 Infinite Qty Variants

We have added a requested feature for variants with infinite qty. This is for items that the client intends to drop ship and thus does not have to worry about their qty on hand. The rule of thumb is that whenever you are making a template conditionally show a product/variant as being available for purchase, you should use in_stock? which is now available on the product and variant drops. There is also an infinite_qty? attribute now as well on the variant drop and a has_variants_with_infinite_qty? attribute on the product.

The default templates have been updated to make use of these attributes so be sure to check them out.

Here are some guidelines:

  1. If a variant has infinite qty, do not display the qty.
  2. If a variant has infinite qty, show the buy button and allow the customer to purchase it.
  3. Use in_stock? wherever possible instead of qty > 0 because it takes into account infinite qty for you.

Default Templates ZIP

Nov 16, 2011 Default Templates ZIP

Every time frontend is deployed, a zip of the current default templates is generated. The link to download this ZIP file is on the right.



Custom Fields

Nov 15, 2011 Custom Fields

We have added support in the admin to add custom fields for the customer account form on the frontend. This allows clients to add fields such as “Company Name” or special ID numbers to gather more information about clients.

A parial, customerfield.liquid has been added to aid in adding the necessary fields to the customer’s edit account page. This has not been added to the default template because it does require an additional database hit when used and is most likely going to be used by only a select fiew clients (read Cardhaus). See the partial’s documentation for an example on how to use it.


Conditionally Displaying Price & Quantity

Nov 15, 2011 Conditionally Displaying Price & Quantity

You can conditionally display the price and/or quantity for a product by using the logged-in-ness of a customer. An example, from _product.liquid:

{% if site.logged_in? %}
<td class="price">
  {% unless product.buylist_mode? %}
    {% if product.msrp_to_f > variant.sell_price_to_f %}
      <span class="msrp price">{{ product.msrp }}</span>
    {% endif %}
  {% endunless %}
  {{ variant.price }}
</td>
<td class="qty">x {{ variant.qty }}</td>
<td class="buy_button">
  {% if site.may_add_to_cart? %}
    {% if product.preorder? %}
      {{ "Preorder Now" | link_to_add_cart_with_qty: product, variant }}
    {% else %}
      {{ "Buy" | link_to_add_cart_with_qty: product, variant }}
    {% endif %}
  {% endif %}
</td>
{% elsif %}
<td colspan="3">Login to view price and quantity</td>
{% endif %}

The important part being the {% if site.logged_in? %} tag.


Customer Approval

Nov 14, 2011 Customer Approval

Clients can now require approval for new customer accounts. This feature is useful for distributors. The Site Drop now has a method to check if the customer is allowed to add items to their cart site.may_add_to_cart?. When this feature is enabled, the cart add action will also return an error if the customer tries to add an item to their cart but they are not logged in.


Mobile Site

Oct 11, 2011 Mobile Site

Clients can now enable a Mobile Site from their admin. If they have the mobile site enabled, it will look for the theme.liquid in their mobile/ directory (like how dev/ works), and templates for mobile in the mobile/templates directory. You can see an example of the default mobile site at http://store.arux.net.

If the Mobile Site is enabled for a client, you can view it from a non-mobile browser using the param enable_mobile=1. This will set your session to use the mobile views. If you set the param disable_mobile=1 it will disable the mobile views for your session.

To link to the mobile site from the full site, use a link like this:

<a href="{{ site.enable_mobile_url }}">Mobile Site</a>

See the Page documentation on the right for the default mobile themes for each page.


JQuery API

Oct 1, 2011 JQuery API

We’re also working on a jquery API for the whole frontend. The mobile themes use it. Essentially all of the actions that hit the server will return JSON. Check out jquery.cc-api-qtip.js. We’ll add additional documentation to it later. The jquery API is in beta.