How to determine if a product is part of a hidden collection in Shopify liquid templates? - shopify

is it possible to programmatically (in liquid templates) access the products contained in a hidden collection? Or to find out if a particular product is in a hidden collection? My attempts so far indicate that a collection that is hidden is not accessible via the collections global variable and I don't see another mechanism to do this.

I think you're right. If a collection is hidden, you're SOL. Kinda makes sense. If it's hidden, yet accessible, it's not really hidden. Imagine the outrage generated if a hidden collection was visible on a shop. People would circle the wagons for a burning...

Related

How to let users create a "custom" product and add to cart

I am developing a custom theme for a client, and the client has asked for a customizable, user-facing product "creation" form, similar in form and function to this pretty nice example from Ollie.
My problem is two-fold:
How to implement this in the BigCommerce dashboard Products section?
How to then go about building this with Stencil?
My initial thoughts are:
How to implement this in the BigCommerce dashboard Products section?
This seems pretty straightforward to me, though I am new to BigCommerce. I am imagining creating a single "Customized Kit" product with an option set containing the different variants that can arise from the customization process.
How to then go about building this with Stencil?
Here is where I'm a bit more muddy due to my lack of experience with BigCommerce and the Stencil structure. My first guess is: I create a custom form component that exposes the "Customized Kit" Product object to the context and then, on "Add Kit to Cart" click, somehow matches the attributes the user just laid out with the closest product variant. From there, however, I am unclear on the specific components that may need to be extended, which event hooks may need to be called, and how to link the whole thing into the "Add to Cart" functionality (I'm guessing I just create a separate add-customized-to-cart.html template).
Thanks, and for reference I am extending the latest Cornerstone theme (2.2.1-rc.2).

Core Data and bindings - binding checkbox to result of many-to-many relationship

Core Data model
I have a many-to-many relationship between two of the principal entities; call them Item and Tag. There will be a large number of Documents. Each may have 0 to an arbitrary number of tags.
Each Item entity relevantly has an attribute called name, and a to-many relationship to Tag called tags. Each Tag entity relevantly has an attribute called name, and a to-many relationship to Item called items.
To display them, within the same window, I have: (i) an NSTableView (itemTableView), fed by an NSArrayController (itemArrayController), showing all Items; and (ii) an NSTableView (tagTableView), fed by a different NSArrayController (tagArrayController) showing all Lists.
tagTableView
In the tagTableView, the Table View is bound to tagArrayController, with controllerKey arrangedObjects.
There is only a single table column. The textfield in it is bound to Table Cell View, to model key path objectValue.name. That works so far; it displays all of the lists as expected, and sorts properly when I add a sort descriptor.
Everything has been set up using interface builder in Xcode.
The problem
I have added a checkbox into the tagTableView, in the same table column as the textfield. I am trying to implement two things:
The checkbox should be checked if the user has previously associated the Item with the relevant Tag. If not, the checkbox should be unchecked.
If the user checks an unchecked checkbox, I want to establish a relationship between the two; if the user unchecked a checked checkbox, I want to break that relationship.
The underlying behavior pattern is that the user will not necessarily have control over the tags and may not be able to create them. They are to choose from existing tags, and therefore should be able to see which ones exist, and be able to check/uncheck those that apply.
However, I can't see how to implement this.
Part solutions so far
I can see a possible way to do at least the first task programmatically, roughly along these lines:
Monitor tableViewSelectionDidChange for itemTableView
For a change, update the data source for tagTableView manually, and work out checkbox state by checking them for those Tags which relate to the Item entity that has just been selected, and otherwise unchecking them
However, this looks likely to add complexity, and ideally I would like to do this with bindings if possible.
I have reviewed the Apple Core Data and Bindings references, all the Cocoa books I have, stack overflow and I've also done extensive googling. I have found lots of similar questions (e.g. http://lists.apple.com/archives/cocoa-dev/2011/Mar/msg00164.html) but no answers.
I've also found a way that might work programmatically, but which seems to be like my idea above, at the expense of being able to use bindings (e.g. http://www.raywenderlich.com/14742/core-data-on-ios-5-tutorial-how-to-work-with-relations-and-predicates)
The only relevant question on this site -- Core-Data Check Box Cell with many-to-many data -- is not answered to a level that I can make use of.
It would seem to me that this should be a prime candidate for bindings. I should be able to ask the itemArrayController what Tags (if any) have a relation to its selected item, and then set the checkbox to ticked if it matches the relevant Tag, and unset it if it doesn't. I would expect I should be able to do this within the bindings for the checkbox itself, in interface builder. But I can't work out what model key path or binding to use, or what to set the cocoa bindings for the checkbox to. Am I missing something obvious? Thanks

BigCommerce: How can I customize CategoryProductListing

I'm trying to customize a product in the CategoryContent panel in BigCommerce. I want to change the markup for each product in the listing, but the markup for the entire product list is trapped in an uneditable blob :%%GLOBAL_CategoryProductListing%% (I'm getting really tired of these unchangable GLOBAL variables).
Is there any way around this so that I can put my own markup on each product in the list. I'm also open, reluctantly, to reconstruct the product list using the API, but I'm not sure how I can access the API from within a BigCommerce store. Is that possible?
I was able to identify Snippets/CategoryProductsItem.html as the file containing the markup for the individual items in a category list.
I hope this saves someone the time it took me to find the file.
The Snippets/CategoryProductsItem.html is the snippet used for grid category files. If you are using the list view, the file is Snippets/CategoryProductsItemList.html.
This file represents each product listing li. It acts as a template which loops through all the %%GLOBAL_CategoryProductListing%% information for this category. To add a feature to the category ProductList li add it to the Snippet, and it will be applied to each item.
Hope this helps.

Bigcommerce product image snippet in custom panel

I'm new to Bigcommerce and hoping someone can help me figure out if I'm doing anything wrong here. I'm simply trying to create a custom template for my product pages. I created a new file called "_product.html", uploaded it via FTP, and applied it to one of my products.
Within this file I have a default panel called ProductDetails.html. This panel makes a reference to the products thumbnail images. Everything works as expected.
However, I now copy the content from the ProductDetails.html panel and place it in a new panel called ProductInformation.html. At this point, there is no difference between ProductDetails.html and ProductInformation.html, except for the name.
I then go into my _product.html template and replace the reference to the ProductDetails panel with a reference to my new ProductInformation panel. Now, none of the snippets or global variables are being populated. They print nothing to the page.
If I put the original reference to the ProductDetails panel back, everything is displayed as expected. Is there something I'm missing here? Are the snippets and global variables used in the system-created ProductDetails panel only available in that file and not available to other custom panels created for a product page?
I really appreciate any help you can provide! Thank you!
As I recall, there is a key element inside of the ProductDetails Panel that is needed to get all the variables to work on a product page. I think the order even matters.
I would recommend using Snippets to control the information you want to swap out on a custom product page.
The ProductDetails panel populates the global variables that you are trying to use. If you do not have it on the custom page then you cannot use the variables inside of it. The workaround is to place the panel inside an HTML comment:
<!-- %%Panel.ProductDetails%% -->
That way the panel will be called by the Bigcommerce template system without affecting the rest of your layout.

Propagate Line Item Properties to Checkout page

Line Item Properties (http://wiki.shopify.com/Line_Item_Properties) provides a nice way for merchants to collect extra info for line items. It's possible to edit the cart template and the email templates so that the line item properties show in /cart and order confirmation emails.
My question is - is there any way to access those properties and have them show on the checkout page? The checkout page template is not available for editing. The page becomes confusing for the customer, as properties they've selected on their products no longer show up.
I don't think this is possible. The reason is that you can collect almost anything in line item properties and cart attributes. Since merchants cannot control pages 1 and 2 of checkout, they cannot control any scripting there. Hence it would be up to Shopify to render those. Meaning some shops might be rendering poorly in the checkout, since the code would have to be generic.
For years I have just explained to my clients, the merchants, that since these attributes were clear in the cart prior to checkout, and that since they are included in the emails... it's not a big deal, but you obviously feel differently... Perhaps one day the checkout will render with some scripting added from the merchant, for the display of line items... that would be swell.