Building Magento - how to keep code and CMS in sync - magento

We are developing with Magento 1.7.0.2, we are having problem of keeping our code and our CMS page in sync. Let say I have a branch that task include
Create a new CMS page
Use jQuery slider to display products on this new CMS page
We create a new CMS page in Magento admin. We then add jquery.js and js for slider, and write js function to slide all products inside the main div of the new CMS page. However, when we check code into our branch, we only able to checkin the js files. So people are assigned to review this task, they only able to pull the js code, but not the CMS page, which I think locate inside the database. Therefore, they are unable to test, since I dont have the CMS page. I am thinking of couples way:
Passing the db around. This is not a solution, because it is big, and will take long time to import.
point db connection in app/etc/local.xml to the remote db that contain the CMS page. Also not a valid solution, because magento store url in database under web/unsecure/base_url. So I will always get redirect to the other machine ip address instead of my local ip address.
So how do I resolve this issue? What are industry accepted method for this?Please help? THank you very much

Did you try to place full content outside of block code and use only its template?
Let's say you have static page 'Slider-2014'. In WYSIWYG editor you place
{{widget type="cms/widget_block" template="customjs/slider-2014.phtml"}}
In app/design/frontend/base/default/template/ create folder 'customjs'
In folder customjs create file slider-2014.phtml and place anything you need to show in slideshow:
<div class="slider"></div>
Clear cache if needed. Then reload /slider-2014.html page and you'll get all content from that file. Now you can share folder customjs

Related

Url Rewrite of a CMS page in Magento

As a new magento developer I'm using a theme to develop my store. I want to change the URL key of CMS page about. I followed the steps written here but I can't find my layout file for about page on the theme directory or base directory for change XML URL tag.
How can I edit the layout file? Can anyone help me?
Actually that tutorial is a little confusing because there, they are showing an example of changing a URL for two different type of pages (CMS and system).
For changing the URL of a CMS page, like about in your case, it's enough that you proceed until point 12. In short:
First. you change the URL from: (main menu) CMS/Pages/Your_Page -> Url Key: newURL
Then, find the blocks that it is used (e.g footer) and change the URL accordingly.
Plus, in general working in Magento after changing things like page URLs you need to do a reindex and in case of using cache you have to refresh/remove your cached data. Both could be found under System tab (Cache Management & Index Management).

Create admin front with a simple form via a module [Magento]

I am pretty new to Magento and am trying to understand how to create admin (backend) page. I have figured how to create/define the controller and action (along with editing the config.xml).
But now the next problem at hand is to display a simple form in that page. I understand that, I have an option to create blocks and mention the blocks in a layout.xml. But from what I figure is that layout.xml needs to be present in the theme folder. Which I can't do as my magento extension will be installed and I have no access to the user's system.
So the doubt is. How to display a simple from in a backend (admin) page
without having to make any changes to the theme's layout ?
For the admin panel module you don't need to mention the block in the layout.xml of your theme, you only need it to be defined in config.xml file in your "app/code/local///etc/" and a layout file is created in "app/design/adminhtml/default/default/".inside the Block create a folder named "Adminhtml" inside it your can create your form.
Refer this
http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/how_to_create_an_admin_form_module

Magento home page

I am working with a Magento install that I did not set up and am pretty green when it comes to its operation... There is a default page serving as the "home page" when there is already a page defined in the back-end as the "home page". The path in the URL reads as: DOMAIN/index.php but when I try to find said index file using google developer mode, I can find no such file that would generate the layout. I suppose I just don't have enough overall knowledge to figure out what is at work here. Can someone help me figure out why it's using the default home page instead of mine?
On most webshops I've worked on the CMS home page wasn't really used. Instead of the CMS home it can be easier to use a custom template to setup the homepage with static blocks and what not.
If this is also the case for you, there might be two places you can find this custom template:
In the layout xml files, search forcms_index_index?
In backend, navigate to the CMS home page and go to the Design tab
About the index.php part: this is because you probably because you haven't enabled mod_rewrite in your server configuration

Magento: Update several pages with a different tracking code

I have to put some Tracking code on several pages: some category pages, homepage, cart and success page. Whats the best way to accomplish that?
I thought:
homepage --> place the code in CMS -> pages -> home
success --> edit the success.phtml
cart --> edit the cart.phtml
categories -> create a CMS block --> place layout update in the concerning category page to load CMS block
But it looks like it is just a mess because for every code I have another solution. What would you suggest to get it done? Did I miss a better solution?
Thank you,
Hannes
If it's the same tracking code for each one, you could
Create a .phtml file containing the code
Add the file to the relevant hard pages (success, cart) using your layout xml files
Add the file to the relevant soft pages (home, categories) using the custom design tab / custom layout update area.
If the code changes based on the page, then you may need to create a new module with a block that alters the tracking code according to a parameter you include in the layout.
You can include a tracking script using the available Magento configurations fields.
Go to System > Configuration > Design
Under the HTML Head section, insert your tracking script into the Miscellaneous Scripts field.
Save Config, and clear your Magento caches.
Alternatively if you want it in the Footer instead, look under the Footer section and use the Miscellaneous HTML box there.

Magento Multi Store themes calling same login.phtml file

I'm new to magento. Currently i'm developing two ecommerce sites using multi-store option in magento. Both the sites are 90% over, last night when i planned to customize the login page i was shocked. The reason is the changes made in first store login page also reflecting in second store also. The login page is curently calling from
frontend/default/default/template/persistent/customer/form/login.phtml
Is it possible to give any custom login page? PLz guide me magento experts......
Please update your post with your frontend/ folder structure down to each theme template folder. It might be that you don't have a copy of login.phtml in the second theme. Moreover you should follow templates best practices as:
Always create for a new shop different packaga. So not
frontend/default
but
frontend/yourcustompackage
Always have default theme left as much untouched, as possible. So in the
frontend/package/default
Should be some basic changes and rules of your package. It means for example in the putting reset.css for all of your themes. Or something like this.
As for me, each store view should have own theme. So, for example, storeview1
frontend/package/storeview1/
There you copy and change files specific for this theme. So, for example, in default you might have login.phtml. But you want storeview1 to have another login.phtml and in storeview2 it should be the same as in default. Therefore you copy the login.phtml from default to storeview1 and change it there. Don't forget to change package and theme in System->Configuration->Design. Package should be change for whole shop and theme should be specified for every store view or left untouched for default.
P.S. Magento theme fallbacks
P.P.S. Try this tutorial or google another one
P.P.P.S. I hope, you got the answer for your question.

Resources