News:

AbanteCart v1.4.2 is released.

Main Menu

pop up Newsletter

Started by ymaster, January 10, 2016, 06:32:30 AM

Previous topic - Next topic

ymaster

Dear Sir,
             how can i make Newsletter popup for my site front page
Please reply soon as possible

eCommerce Core

As soon as possible?  :o

See if this will help you:
http://stackoverflow.com/questions/19707236/show-popup-after-page-load

You can add this code as new block or add it into header/footer template (.tpl)
"If you're in the luckiest one per cent of humanity, you owe it to the rest of humanity to think about the other 99 per cent."
― Warren Buffett

Trendslink

i need this also. Anybody can teach how to do that? i'm nooby

abantecart

There is a quick and right approach to implement new code.

Quick and dirty approach is to integrate your HTML and JavaScript that opens popup into header of the storefront.
Code can be added into following template file:
storefront/view/default/template/common/header.tpl

For right approach will require creation of the block to be used in the layout. This can be done in the core or as an extension:

Overview:
1. Create new block in SQL that can be enabled in the layout
2. Create controller/template files for the block
3. Add Javascripts and css if needed.
4. Build extension if needed.
Note: the block now can be included in to any place in the layout. Since this block will occupy no space and will only show popup, it can be included in any location on the layout.

1. To insert block into the system you can perform 2 ways.
a. Create block with series of SQL insert statements (I will not bother here, Feel free to check tables).
b. Create block with running XML for layout.
Check this manual for layout/block section
http://docs.abantecart.com/pages/developer/template_customization_or_development_guide.html

Basically you need to run below code 1 time or include in extension installation file
                        
$file = DIR_EXT . 'layout.xml';
$layout = new ALayoutManager('default');
$layout->loadXml(array('file' => $file));
                        
Where layout.xml is file with new block:

                <block>
                    <block_txt_id>newsletter_popup</block_txt_id>
                    <controller>blocks/newsletter_popup </controller>
                    <templates>
                        <template>
                            <parent_block>header</parent_block>
                            <template_name>blocks/newsletter_popup.tpl</template_name>
                        </template>
                    </templates>
                </block>
                        
2. Create 2 new files
Controller:

storefront/controller/blocks/newsletter_popup.php

Tempalte:

storefront/view/default/template/blocks/newsletter_popup.tpl

Now you can code your controller and template.

3. JavaScripts and CSS are going to
/storefront/view/default/javascript
and
/storefront/view/default/stylesheet

You can include them with methods addScript(), addScriptBottom and addStyle() in the controller or you can include them in the head.tpl

4. You can build extension with Devtools
http://docs.abantecart.com/pages/developer/template_dev_tools.html


Note: Allot of information about architecture, layouts and blocks can be located in the manuals:
http://docs.abantecart.com/pages/developer/architecture.html
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

Forum Rules Code of conduct
AbanteCart.com 2010 -