Jump to content

Guide To Adding New Boxes (Assigned as {$YOUR_BOX}


Big Spender

Recommended Posts

First make your declaration in your skin via /templates/main.php: -

{$YOUR_BOX}


Then open /classes/gui.class.php

Find this text:


 * Display random products box


You will find the code for this box, simply copy all the code and paste to create a new box.

In the code you have just pasted you will need to change:



	private function _displayRandomProduct() {



to 	
private function _displayYourBox() {



You also need to change: -



			$content = $GLOBALS['smarty']->fetch('templates/box.featured.php');

			$GLOBALS['smarty']->assign('RANDOM_PROD', $content);



To:



			$content = $GLOBALS['smarty']->fetch('templates/box.yourbox.php');

			$GLOBALS['smarty']->assign('YOUR_BOX', $content);



And create the file: templates/box.yourbox.php

You can strip out the random products PHP code as you'll probably just want to edit the template to display static content like I did, but it's upto you.  You can do this like this: -


	/**

	 * Display test box

	 */

	private function _displayYourBox() {

			$content = $GLOBALS['smarty']->fetch('templates/box.yourbox.php');

			$GLOBALS['smarty']->assign('YOUR_BOX', $content);

	}

Link to comment
Share on other sites

Just a warning...

If you edit the gui.class.php file, you will need to make the same modifications each time you update CubeCart to the latest release. CC5 has a plugin system, which would certainly be the preferred method of adding any additional features - or indeed changing existing behaviours. The class.gui.display hook may be used for this purpose.

However, if you don't need to pass any new PHP variables to your sidebox, you can utilize SMARTY's {include} tag. So, instead of adding {$YOUR_BOX}, you can add the following to the main.php template file:

{include file="skins/{$SKIN_FOLDER}/templates/box.yourbox.php"}

Either of these methods will allow you to easily update CubeCart when the next release comes along.

Link to comment
Share on other sites

Just a warning...

If you edit the gui.class.php file, you will need to make the same modifications each time you update CubeCart to the latest release. CC5 has a plugin system, which would certainly be the preferred method of adding any additional features - or indeed changing existing behaviours. The class.gui.display hook may be used for this purpose.

However, if you don't need to pass any new PHP variables to your sidebox, you can utilize SMARTY's {include} tag. So, instead of adding {$YOUR_BOX}, you can add the following to the main.php template file:

{include file="skins/{$SKIN_FOLDER}/templates/box.yourbox.php"}




Either of these methods will allow you to easily update CubeCart when the next release comes along.

Since I'm very much a newbie and my extra boxes are static I just added them straight into main.php. You can see these two boxes at http://dirtybutter.com/plushcatalog/ . I made my own version of kurouto with its own name, so my modifications don't get overwritten with upgrades. I just make line changes from the file difference information with each upgrade.

<div>

<h3>Embroidery Available</h3>

</br>

<a href="http://dirtybutter.com/plushcatalog/embroidery-of-name-up-to-10-characters.html">Custom Embroidery</a>

</div>



<div>

  <h3>Optional Gift Card</h3>

<br/>

<center>

<p class="image">

	<a href="http://dirtybutter.com/plushcatalog/optional-gift-card-available.html" title="Order a Gift Card with Your Purchase">

	  <img src="http://dirtybutter.com/plushcatalog/images/cache/giftcardfront.138.jpg" alt="Order a Gift Card with Your Purchase" />

	</a>

  </p>

</center>

  <a href="http://dirtybutter.com/plushcatalog/optional-gift-card-available.html">Order a Gift Card with Your Purchase</a>

   </div>
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...