Magento design - new homepage columns - templates

I want to make a custom design for my magento store like this :
How can I proceed to do that, specially for the products from category1 and category2, I want there a new header for this list, with a little images, not like the standard category grid...
Thanks a lot for help;

Create CMS page.
Switch to the Design mode. Select Layout - 1 column.
Edit Layout Update XML
<block type="cms/block" name="block1_static">
<action method="setBlockId"><id>cms_block1-static</id></action>
</block>
<block type="page/html_wrapper" name="left.callout.wrapper" translate="label">
<action method="setElementId"><value>hompage-left-callout</value></action>
<block type="core/template" name="left.callout" template="callouts/right_col.phtml">
<action method="setImgSrc"><src>images/media/left_banner_1.gif</src></action>
</block>
</block>
<block type="page/html_wrapper" name="center.wrapper" translate="label">
<action method="setElementId"><value>hompage-center</value></action>
<block type="catalog/product_new" name="home.catalog.product.new" alias="product_new" template="catalog/product/new.phtml" after="cms_page"><action method="addPriceBlockType"><type>bundle</type><block>bundle/catalog_product_price</block><template>bundle/catalog/product/price.phtml</template></action></block>
<block type="reports/product_viewed" name="home.reports.product.viewed" alias="product_viewed" template="reports/home_product_viewed.phtml" after="product_new"><action method="addPriceBlockType"><type>bundle</type><block>bundle/catalog_product_price</block><template>bundle/catalog/product/price.phtml</template></action></block>
</block>
<block type="page/html_wrapper" name="right.callout.wrapper" translate="label">
<action method="setElementId"><value>hompage-right-callout</value></action>
<block type="core/template" name="right.callout" template="callouts/right_col.phtml">
<action method="setImgSrc"><src>images/media/right_banner_1.gif</src></action>
</block>
</block>
There is two blocks for example - viewed products and new products. There is not default block to show products from specific category in Magento. You should create this block and template for it and use this block at place of examples block.
Position of blocks you may align with css. Each block will be wrapped with div with specific ID. ElementId and ElementClass you may set wrapper block.

Related

Search and replace in only certain tags and attributes in XML file by a regular expression

I have an XML file (call it module.xml) as below opened in
an editor like Notepad++ or Geany:
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="head">
<action method="addItem"><type>skin_js</type><name>module/js/jquery.js</name></action>
<action method="addItem"><type>skin_js</type><name>module/js/module-slider.js</name></action>
<action method="addItem"><type>skin_css</type><name>module/module.css</name></action>
<action method="addItem"><type>skin_js</type><name>module/js/module-video.js</name></action>
<action method="addItem"><type>skin_js</type><name>module/js/nicEdit-latest.js</name></action>
</reference>
<reference name="left">
<block type="module/subscribe" name="module.left.subscribe" template="module/left-sidebar.phtml" />
</reference>
<reference name="right">
<block type="module/subscribe" name="module.right.subscribe" template="module/right-sidebar.phtml" before="-" />
</reference>
<reference name="top.links">
<action method="addLink" translate="label title" module="module" ifconfig="module/settings/quicklinks">
<label>Module Title</label>
<url>module</url>
<title>Module Title</title>
<prepare>true</prepare>
<urlParams/>
<position>99</position>
</action>
</reference>
<reference name="footer_links">
<action method="addLink" translate="label title" module="module" ifconfig="module/settings/quicklinks">
<label>Module Title</label>
<url>module</url>
<title>Module Title</title>
<prepare>true</prepare>
<urlParams/>
<position>99</position>
</action>
</reference>
</default>
<module_index_index>
<reference name="content">
<block type="module/list" name="module_list" template="module/list.phtml" />
</reference>
</module_index_index>
<module_create_index>
<reference name="content">
<block type="module/list" name="module.create">
<action method="setTemplate"><template>module/create.phtml</template></action>
</block>
</reference>
</module_create_index>
</layout>
Now I want to replace string module/ with mycompany/module/ in only tags and attributes containing .phtml filenames only, i.e. in content of the template attribute and <template> tag.
How can I do this with a regular expression? I am out of ideas when it comes to selective find/replace with regular expressions.
Note that this will work with properly formatted XML files.
You can use the regex (?=.*\.phtml)module\/ and replace with mycompany/module/.
This:
(?=.*\.phtml)
Is a positive lookahead: it will ensure that the regular expression will be matched in the line. module\/ is the string you want to replace with an escape on the /.
Also, you should read this well-known answer about parsing with regular expression.

Adding dynamic parameters in fremarker android studio

I am creating a template using freemarker. I want to add few parameters at runtime. How it can be done. The following is a sample template code:
<?xml version="1.0"?>
<template
minApi="7"
minBuildApi="8">
<category />
<dependency name="android-support-v4" revision="8" />
<parameter
id="packageName"
name="Package name"
type="string"
constraints="package"
default="com.mycompany.myapp" />
...
...
...
<!-- 128x128 thumbnails relative to template.xml -->
<thumbs>
<!-- default thumbnail is required -->
<thumb>thumb_file.png</thumb>
</thumbs>
<globals file="globals.xml.ftl" />
<execute file="recipe.xml.ftl" />
I want to generate a parameter while clicking a button in the template. Is it possible to do so? Is there any proper documentation available.
You can use the visibility attribute. For example, in the following:
<parameter
id="includeLayout"
name="Create layout XML?"
type="boolean"
default="true"
help="Generate a layout XML" />
<parameter
id="layoutName"
name="Layout Name"
type="string"
constraints="layout|nonempty|unique"
default="fragment_default"
visibility="includeLayout"
suggest="fragment_${camelCaseToUnderscore(className)}"
help="The name of the fragment layout to create" />
visibility="includeLayout" means that that field will only be visible when includeLayout is checked as true

Custom Android Theme for Titanium (no ActionBar, custom splashscreen)

im using Titanium SDK 3.3.0 and want to disable the "new" ActionBar in Android with the theme solution.
Besides a want to use a 9-Patch-Image as splashscreen/loadingscreen.
Referring to the docs and guides:
http://docs.appcelerator.com/titanium/3.0/#!/guide/Android_Action_Bar
http://docs.appcelerator.com/titanium/3.0/#!/guide/Android_Themes
I have the following Project-Setup:
files for splashscreens:
/platform/android/res/drawable-ldpi/splash.9.png
/platform/android/res/drawable-mdpi/splash.9.png
/platform/android/res/drawable-hdpi/splash.9.png
/platform/android/res/drawable-xhdpi/splash.9.png
theme file: /platform/android/res/values/gsgptheme.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.GSGP" parent="Theme.AppCompat">
<!-- Depending on the parent theme, this may be called android:windowActionBar instead of windowActionBar -->
<item name="android:windowActionBar">false</item>
<item name="android:windowBackground">#drawable/splash</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>
tiapp.xml:
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest android:installLocation="auto"
android:versionCode="21" android:versionName="3.1.1">
<application android:theme="#style/Theme.GSGP"/>
<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="14"/>
<supports-screens android:anyDensity="false"/>
</manifest>
</android>
The Problem is: Titanium doesn't seem to load my theme. On startup I see the default loadingscreen and still have an actionbar. Can anyone see my mistake?
Need to add something similar to the following in your tiapp.xml file under the android application node. Replace "YourApp" in .YourAppActivity with whatever your app name is.
<activity android:name=".YourAppActivity" android:label="#string/app_name" android:theme="#style/Theme.GSGP" android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

Is there a way to register your app to some URLs just like in normal Android?

I would like to register my app to foursquare URLs and user would see a Intent chooser between browser and my app. It doesn't seem to work, default browser is always launched.
I was trying to call this code:
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://foursquare.com/v/san-francisco-international-airport-sfo/41059b00f964a520850b1fe3"));
startActivity(i);
And I registered this way in manifest:
<activity android:name=".IntentActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="foursquare.com" />
</activity>
My app was never called, only browser. Are there Intent Choosers on Glass?

Magento 1.5.01 - I am unable to load a template after overriding the customer module

This is my first post here, so please forgive me in advance :)
I've been working on overriding the Customer module for some specific
functionality depending on the user group; I want to duplicate and
append to the user registration form that targets the specific user
group.
I have successfully overridden and extended my way through the
controller, model, and block classes that I would like to use, however
when I override the block class, the layout i'm pointing to is no
longer rendered.
Here's the relevant chunk of the layout code:
<customer_account_vcreate translate="label">
<label>Customer Account Registration Form</label>
<!-- Mage_Customer -->
<remove name="right"/>
<remove name="left"/>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="content">
<block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml">
<block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label">
<label>Form Fields Before</label>
</block>
</block>
</reference>
</customer_account_vcreate>
I know that it just points to the regular block/template right now, but even that isn't loading. The block loads just fine (I can output from the constructor), it just seems that the layout file is not being loaded anymore.
I've also tried to override the login form with similar problems, can anyone help?
Geoff
EDIT -
Here's a more complete question for the login block:
Here's my config:
<?xml version="1.0"?>
<config>
<modules>
<Izoox_Customer>
<version>1.0.1</version>
</Izoox_Customer>
</modules>
<frontend>
<routers>
<customer>
<args>
<modules>
<Izoox_Customer before="Mage_Customer">Izoox_Customer_Customer</Izoox_Customer>
</modules>
</args>
</customer>
</routers>
<layout>
<updates>
<customer>
<file>izooxcustomer.xml</file>
</customer>
</updates>
</layout>
</frontend>
<global>
<blocks>
<customer>
<rewrite><form_login>Izoox_Customer_Block_Form_Login</form_login>
</rewrite>
</customer>
</blocks>
</global>
</config>
It works when I remove the block code from the above config, except then I'm not getting any of my custom code from the block.
Above I have overridden the Customer module to use my own code here, and have overridden the customer_login block with my own block. I can see that the custom block loads by echoing out of the _prepareLayout() function, but the view file (login.phtml) doesn't seem to load. Here's the layout (izooxcustomer.xml), which also loads fine.
<customer_account_login translate="label">
<label>Customer Account Login Form</label>
<!-- Mage_Customer -->
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="content">
<block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml"/>
</reference>
</customer_account_login>
Am I missing something, or is this just not possible?
Thanks,
Geoff
Looks like you have your main layout tag misspelled. It should be <customer_account_create>. You have a 'v' in there before create.