Jump to content
thirty bees forum

[Free Module] Additional Product Functionality


mwrouse

Recommended Posts

Since I've been making modules to make ThirtyBees work for me I've come up with one that adds extra variables on to $product for use in your templates.

I call it Extra Product Functionality (link to GitHub).

 

It adds this tab to the product edit page in the back office:

image.png.edc54404838c4b3e0de0912c175e7b8d.png

 

Setting these values will add/update variables on the $product in your template. So if your product is a service, you could show a contact button, or list the price as a starting at price.

If your product is coming soon, you can use $product->coming_soon to add an additional label. (setting coming soon to Yes will automatically hide the price and make it not available to order).

I added the force new option because I can definitely see where someone wants to list a product as new even though it's not new (in terms of date it was created).

 

You can add it to your theme by adding this at the top of your product.tpl file:

{hook h='actionModifyProductForExtraFunctionality' product=$product}

 

And to get these values to be set in your product list, add this to wherever for-loops through your products:

{capture name="newProduct"}
    {hook h='actionModifyProductForExtraFunctionality' product=$product capture=true}
{/capture}
{assign var="product" value=unserialize($smarty.capture.newProduct)}

 

That might look dumb, but I tried for several hours to get my hook to be able to modify $product when inside of a for-loop (or wherever it is an array and not an object) and I couldn't. Nothing I was setting in smarty was getting out of my module. So I came up with this clever capture method.

 

This module definitely has potential and I look forward to expanding it. If anyone has any suggestions, let me know.

Edited by mwrouse
  • Like 1
  • Thanks 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...