3

I build a coupon page what lists all available coupons on the store.

Of course, I go to CMS -> Pages then create a page.

But, I'm considering about what to use, html content or layout update.

Option 1:

I write fully html code somewhere then put into content box, such as:

<h1 class="page-heading">Coupons</h1>
<p class="page-description">...</p>
<section class="section section-offers">
   <h2 class="section-heading section-heading-offers">Current Offers</h2>
    <ul class="list-offers">
        <li class="offer">
            <div class="offer-content offer-content-info">
                <h3 class="offer-heading">Coupon Code</h3>
                <p class="offer-description">Coupon Description</p>
                <p class="offer-coupon">CODE</p>
            </div>
        </li>
    </ul>
</section>

Option 2:

I create a custom block what fetch all available coupons then apply into its template file. I use this block for the page with layout update, such as:

<reference name="root">
    <block type="my_sales/coupons" name="content" template="page/static/coupons.phtml"/>
</reference>

With option 2, I don't need to do anything afterwards, I just change the coupon in Catalog Shopping Cart Rules then the page automatically changes as well.

But in my website, there's a few coupon codes (1 or 2 at a time), and they don't change frequently. So option 1 is reasonable.

I know that both options, the system must load data from database, regardless getting coupon collection or cms page content.

But what considering me is which option costs me much loading time than the other? Assume that this coupon page is also a landing page for a marketing campaign, which option should I choose?

1

Off course the first one is faster for data fetch and render.

First is taken on get data from cms_page model and only one specific cms page datal and This cms page is already load whenever controller dispatch.

But Whenever you have using option 2: It take more time.

you have run Sales ruls collection and getting data by foreach loop.That make data redundant and take time more time then the option one and another block is my_sales/coupons call.

foreach($collection as eachCouponOb):

endif;

So my suggestion option 1 is better

  • I prefered the option 1 at the first place, but I need more suggestion to ensure, so I ask this question. Thank you. – Tran Dinh Khanh Jul 16 '15 at 5:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.