Developers Corner | Developer

Developer

This example to show you override edit action from ProductController.php is located app/code/core/Mage/Adminhtml/controllers/Catalog

Step 1: Create new module from app/etc/JPK_New.xml

<?xml version="1.0"?>
<config>
<modules>
<JPK_New>
<active>true</active>
<codePool>local</codePool>
</JPK_new>
</modules>
</config>

Step 2: Make config.xml from app/code/local/JPK/New/etc/config.xml

<?xml version="1.0"?>
<config>

<modules>
<JPK_New>
<version>0.0.1</version>
</JPK_New>
</modules>

<admin>
<routers>
<adminhtml>
<args>
<modules>
<JPK_New before="Mage_Adminhtml">JPK_New</JPK_New>
</modules>
</args>
</adminhtml>
</routers>
</admin>

</config>

Using above code you want to override any action from any adminhtml controller. Only you need to make controller file for that.

Step 3: Make controller file from app/code/local/JPK/New/controllers/Catalog/ProductController.php

And first include your default controller class file then write new controller class for update then extends your new controller file to your default controller class like here extends with “Mage_Adminhtml_Catalog_ProductController”.

<?php
include_once("Mage/Adminhtml/controllers/Catalog/ProductController.php");
class JPK_New_Catalog_ProductController extends Mage_Adminhtml_Catalog_ProductController
{
public function saveAction(){
echo "Testing";exit;
}
}
?>

Notice : Check the name of routers path is same for which module you are going to override. here it is adminhtml (After  <admin><routers> )
But instead of adminhtml some custom downloaded modules seems to be using other names like admin_catalog or admin_blog etc..
So ensure that name need to gave after <admin><routers><—custom name same origianl config.xml—->

To be able to use Fluid within Typo3 4.5, we must install the Extension named ‘fluid’. ‘fluid’ itself is dependent on the Extension ‘extbase’, so we must install the ‘extbase’ Extension first.

In order for that we have to do the following steps within the Typo3 Backend:
1. Navigate to “ADMIN TOOLS’ -> ‘Extension Manager’ (show image)
2. Navigate in the topmost select box to ‘Import Extensions’
3. Search about ‘extbase’ (show image)
4. Install the ‘extbase’ by clicking on the brick stone (show image)
5. In the next step, click ‘make all updates’

So, if you become the message ‘The extension “extbase” has been installed.’ we can continue with the fluid extension:

7. Navigate once again in the topmost select box to ‘Import Extensions’
8. Search about ‘fluid’ (show image)
9. Install the ‘fluid’ by clicking on the brick stone

page = PAGE
page {
    10 = FLUIDTEMPLATE
    10 {
        file = fileadmin/templates/Home.html
        partialRootPath = fileadmin/templates/Partials/
        layoutRootPath = fileadmin/templates/Layouts/
        variables {
            pageTitle = TEXT
            pageTitle.data = page:title
            leftColumn < styles.content.getLeft
            content < styles.content.get
        }
    }
}

May be some confused with the direct modification of template template/customer/form/login.phtml not taking any effect in front end.

Its because of the Persistent Shopping Cart module from version 1.6
The persistent shopping cart module explains like below
“The persistent behaviour feature reduces consumer frustration when they try to access their shopping cart from multiple browser sessions. This feature also enables merchants to provide promotion, according to pre-defined segmentation rules, encouraging consumers to add items to the shopping cart and complete their purchase. “

So you can try to modify the below file…

template/persistent/customer/form/login.phtml

You can disable this feature from below section in backend:

System -> Configuration -> Customers -> Persistent Shopping Cart -> General Options -> Enable Persistence = No

If the above doesn’t work then you can directly disable the module by editing the file: app/etc/modules/Mage_Persistent.xml

 

A website with a teaser image or a slideshow above, including a single,two-or three-column layout – that you can now display in the TYPO3 backend (without TemplaVoilá) easy. Ever since the TYPO3 Verion 4.5. Can now assign each page the property back layout.

Steps to create backend layout …follow screenshots from 1-4

For creating the backend layouts , take list page.

1.

Backend Layout from List page

Backend Layout from List page

2.

Create the Grid View Wizard

Create the Grid View Wizard

3.

Here in this example we creating two layouts, 3 column and 1 column with single row.

Create layout columns and rows

Create layout columns and rows

4.

Select backend layout during page creation

Select backend layout during page creation

So if we creates more than one backend layouts, it will appear in 4th screenshot drop down. From there we can decide the required layout for each page.

Now in typoscript with a case statement we can decide which layout need load…

temp.3col = COA
temp.3col {
10 = COA
10 < styles.content.get
10.select.where = colPos=0
10.slide = -1
10.wrap = <section id="leftContent">|</section>

20 = COA
20 < styles.content.get
20.select.where = colPos=1
20.wrap = <section id="middleContent">|</section>

30 = COA
30 < styles.content.get
30.select.where = colPos=2
30.slide = -1
30.wrap = <section id="rightContent">|</section>

}

temp.1col = COA
temp.1col < temp.3col
temp.1col.10 >  // remove left part
temp.1col.20.wrap = |  // write center part
temp.1col.30 > // remove right part

// creating the page with a case statement
// case statement checking the backend layout selected for each page
// Here 1,2 are IDs of backend layouts. It can select from List->Backend Layout

page {
20 = COA
20 {
10 < temp.header
20 = CASE
20 {
// Find page back to root with TO defined
key.data = levelfield:-1,backend_layout_next_level,slide
key.override.field = backend_layout

default = 1
default < temp.3col
// 1 is the id of backend layout three column
1 < temp.3col
// 2 is the id of backend layout one column
2 < temp.1col

}
wrap = <div id="container">|</div>
}

}

By adding proper element id or class we can manage the styles…

 

 

Programmatically we can create search module by below code

$query = Mage::helper('catalogSearch')->getQuery();
 $query->setStoreId(Mage::app()->getStore()->getId());
 $query->setQueryText(Mage::helper('catalogsearch')->getQuery()->getQueryText());

 $collection = $query->getSearchCollection();
 $collection->addSearchFilter(Mage::helper('catalogsearch')->getQuery()->getQueryText());
 $collection->addAttributeToSelect('*');
 $collection->addAttributeToFilter('status', 1);

Ensure the search key name is ‘q’ .

PhoneGap Build makes apps in the cloud for multiple platforms including iOS, Andriod, webOS, Symbian, BlackBerry .
By using Javascript, HTML and CSS and then builds apps with phonegap.
Can create an app for your website in simple steps.

Also we can use the jQuery mobile version for Javascript and CSS

For more details visiti : http://www.phonegap.com/

Here i am write the tip to block the frontend username conversion to lowercase even though we are typing capital letters in username text boxes…

Write down below line of code in typo3conf/extTables.php

$GLOBALS['TCA']['fe_users']['columns']['username']['config']['eval'] = 'nospace,unique,required';

Please let me know if getting any issues with it…

Getting 404 for checkout controllers from 1.6, but it was working fine with 1.5

Try by removing the entire rewrite part from config.xml, then use frontend routers like below.

Remove below code

    <global>
        <rewrite>
            <MyNameSpace_MyModule_cart>
                <from><![CDATA[#^/checkout/cart#]]></from>
                <to>MyNameSpace_MyModule/cart</to>
                <override_actions>false</override_actions>
            </MyNameSpace_MyModule_cart>
        </rewrite>
    </global>

Use below code only…

    <frontend>
        <routers>
            <checkout>
                <args>
                    <modules>
                        <MyNameSpace_MyModule before="Mage_Checkout">MyNameSpace_MyModule</MyNameSpace_MyModule>
                    </modules>
                </args>
            </checkout>
        </routers>
    </frontend>

It working for me.. let me know if have any suggetions…

Assume we have the following two tables. Table A is on the left, and Table B is on the right. We’ll populate them with four records each.

 

id name       id  name
-- ----       --  ----
1  Pirate     1   Rutabaga
2  Monkey     2   Pirate
3  Ninja      3   Darth Vader
4  Spaghetti  4   Ninja

Let’s join these tables by the name field in a few different ways and see if we can get a conceptual match to those nifty Venn diagrams.

 

SELECT * FROM TableA
INNER JOIN TableB
ON TableA.name = TableB.name

id  name       id   name
--  ----       --   ----
1   Pirate     2    Pirate
3   Ninja      4    Ninja

Inner join produces only the set of records that match in both Table A and Table B.

 

SELECT * FROM TableA
FULL OUTER JOIN TableB
ON TableA.name = TableB.name

id    name       id    name
--    ----       --    ----
1     Pirate     2     Pirate
2     Monkey     null  null
3     Ninja      4     Ninja
4     Spaghetti  null  null
null  null       1     Rutabaga
null  null       3     Darth Vader

Full outer join produces the set of all records in Table A and Table B, with matching records from both sides where available. If there is no match, the missing side will contain null.

SELECT * FROM TableA
LEFT OUTER JOIN TableB
ON TableA.name = TableB.name

id  name       id    name
--  ----       --    ----
1   Pirate     2     Pirate
2   Monkey     null  null
3   Ninja      4     Ninja
4   Spaghetti  null  null

Left outer join produces a complete set of records from Table A, with the matching records (where available) in Table B. If there is no match, the right side will contain null.

SELECT * FROM TableA
LEFT OUTER JOIN TableB
ON TableA.name = TableB.name
WHERE TableB.id IS null

id  name       id     name
--  ----       --     ----
2   Monkey     null   null
4   Spaghetti  null   null

To produce the set of records only in Table A, but not in Table B, we perform the same left outer join, then exclude the records we don’t want from the right side via a where clause.

SELECT * FROM TableA
FULL OUTER JOIN TableB
ON TableA.name = TableB.name
WHERE TableA.id IS null OR TableB.id IS null 
id    name       id    name
--    ----       --    ----
2     Monkey     null  null
4     Spaghetti  null  null
null  null       1     Rutabaga
null  null       3     Darth Vader

To produce the set of records unique to Table A and Table B, we perform the same full outer join, then exclude the records we don’t want from both sides via a where clause.

There’s also a cartesian product or cross join, which as far as I can tell, can’t be expressed as a Venn diagram:

SELECT * FROM TableA
CROSS JOIN TableB

This joins “everything to everything”, resulting in 4 x 4 = 16 rows, far more than we had in the original sets. If you do the math, you can see why this is a very dangerous join to run against large tables.

© 2014 Developers Corner Suffusion theme by Sayontan Sinha