Template Changes in 1.2

This guide highlights each of the template changes made in the Shopp 1.2 built-in template files compared to how they existed up to Shopp 1.1.9 to help make the transition to Shopp 1.2 easier.

Guide Conventions

In order to clearly and completely detail what has changed this article will use the following conventions:

  • Each changeset is shown in reverse order working from the bottom of the template file back up to the top to help preserve line number references as accurately as possible.
  • The original default template lines are shown under the heading Original followed by the relative line numbers.
  • Line numbers are relative to the original default templates shipped with the Shopp 1.1.9 release. Custom markup or other code may shift the actual lines, in which case the original tag will need to be located to determine the proper location of the change.
  • Templates are listed in the order of functional importance so that you begin making the absolute minimum changes necessary to prevent functionality issues.
  • Change sets that are labelled with localization are only needed if translation to other languages is needed in the templates, otherwise they may be completely skipped (if English is the only language needed for the storefront).

New Template Files in 1.2

Shopp 1.2 introduces a number of new built-in templates. For themes that have Shopp content templates installed and enabled, when any of the new templates are missing the built-in templates in the Shopp plugin files are used automatically. To customize the new templates they will need to be copied to your theme. The easiest way to copy the new templates to your theme is from the WordPress Admin under ShoppSetupPresentation settings. Under the Theme Templates setting, Shopp will detect the missing theme files and provide a Re-install Missing Templates button. Click the button to copy only the missing template files to your theme, your other template files will remain untouched.

The following are the new templates added in 1.2:

  • account-downloads.php
  • account-orders.php
  • account-profile.php
  • email-order.php
  • email-shipped.php
  • email.css
  • login-recover.php

Discontinued Templates

In addition to adding new template files, the following template files are no longer used by Shopp in version 1.2:

  • notify.php
  • order.php

account.php

The account.php template now splits the different account dashboard views into their own template files including the new account-downloads.php, account-orders.php and account-profile.php. With the new Developer API added in 1.2, it is easy to register new account pages that will automatically use account-{name}.php structured template names to make it much easier to add new pages and customize their function and layout.

Preserving Customizations

In Shopp 1.1, the account.php template uses if() conditions to determine which layout to show. If you have customized those sections, it is best to copy your changes, section-by-section, into the corresponding new account-{name}.php template file.

To make these instructions easier to follow, the following walkthroughs are written to assume that you have used the Re-install Missing Templates process described above. Following the conventions of this guide, remember to work from the bottom of the file to the top.

Account Order History

  1. Locate the code in the following conditional section:
<?php if ("history" == shopp('customer','process','return=true')): ?>
    /* ... order history layout code ... */
<?php endif; // end history ?>
  1. Copy the entire code from below the if (...): line to above the endif; line.
  2. Paste the copied code into the account-orders.php template file.
  3. Remove the entire section (including the if() and endif; lines) from the account.php.

Account Downloads

  1. Locate the code in the following conditional section:
<?php if ("downloads" == shopp('customer','process','return=true')): ?>
    /* ... order history layout code ... */
<?php endif; // end downloads ?>
  1. Copy the entire code from below the if (...): line to above the endif; line.
  2. Paste the copied code into the account-downloads.php template file.
  3. Remove the entire section (including the if() and endif; lines) from the account.php.

Account Profile

  1. Locate the code in the following conditional section:
<?php if ("account" == shopp('customer','process','return=true')): ?>
    /* ... account profile layout code ... */
<?php endif; // end account ?>
  1. Copy the entire code from below the if (...): line to above the endif; line.
  2. Paste the copied code into the account-profile.php template file.
  3. Remove the entire section (including the if() and endif; lines) from the account.php.

Remove the <form> elements

Remaining in the file are two <form> element lines that can be removed from the account.php template file as they are no longer necessary. The line numbers below refer to the remaining line numbers from the default account.php from Shopp 1.1.9 after removing the above sections.

Remove the following lines (-lines 9-16):
-
-<?php return true; endif; ?>
-
-

<form action="<?php shopp('customer','action'); ?>" method="post" class="shopp validate" autocomplete="off">
-
-
-</form>


-

Replace shopp('customer','management) lines

The shopp('customer','management') tags can be left as is as they are still available in Shopp 1.2. For a complete upgrade that will keep your customizations working in future releases, you should replace the customer management section with the new shopp('storefront','account-menu') template tags.

Remove the following from the original account.php (- lines 5-6, reference lines start at line 4):
<ul class="shopp account">
-<?php while (shopp('customer','menu')): ?>
-   <li><h3><a href="<?php shopp('customer','management','url'); ?>"><?php shopp('customer','management'); ?></a></h3></li>
<?php endwhile; ?>
</ul>
1.2 Updates

Add the following new lines (+ starting at line 5, reference lines start at line 4)



<ul class="shopp account">
+<?php while (shopp('storefront','account-menu')): ?>
+   <li>
+       <a href="<?php shopp('storefront','account-menuitem','url'); ?>"><?php shopp('storefront','account-menuitem'); ?></a>
+   </li>
<?php endwhile; ?>
</ul>


Remove the unnecessary process conditional

The first line of the Shopp 1.1.9 account.php template file is no longer necessary and needs to be removed.

-<?php if (!shopp('customer','process','return=true')): ?>

cart.php

The change to cart.php is an optional label change that is recommended for shopper usability, but is not required.

Replace the Shipping subtotal label with Estimated Shipping to clarify that the figures are an estimated cost, not a final cost.

Locate the correct line and remove/replace it (- line 55, reference lines begin at line 53):
<?php if (shopp('cart','needs-shipped')): ?>
<tr class="totals">
-   <th scope="row"><?php shopp('cart','shipping','label=Shipping'); ?></th>
    <td class="money"><?php shopp('cart','shipping'); ?></td>
</tr>
<?php endif; ?>
1.2 Updates
<?php if (shopp('cart','needs-shipped')): ?>
<tr class="totals">
+   <th scope="row"><?php shopp('cart','shipping','label=Estimated Shipping'); ?></th>
    <td class="money"><?php shopp('cart','shipping'); ?></td>
</tr>
<?php endif; ?>

You must be logged in to post a comment.

© Ingenesis Limited. Shopp™ is a registered trademark of Ingenesis Limited.

Skip to toolbar