I have a new job where I strictly work on Magento everyday now. I have no prior experience with Magento so it's been a challenge to say the least so far!
Let me explain briefly the extension we are building.
It will allow us to show a Popup/Modal window. The Modal's HTML content will be stored in
a Static Block
ADMIN PAGE
So the Admin panel consist of a new Tab under System/Confuration/
NEW TAB
The admin panel allows you to select in a drop down list on that NEW TAB PAGE the default Static Block
to use for these sections...
HOME PAGE
or HOME PAGE w/Items in Shopping Cart
ALL CATEGORY PAGES
or ALL CATEGORY PAGES w/Items in Shopping Cart
ALL PRODUCTS PAGES
or ALL PRODUCTS PAGES w/Items in Shopping Cart
ALL CMS PAGES
or ALL CMS PAGES w/Items in Shopping Cart
SHOPPING CART PAGE
or SHOPPING CART PAGE w/Items in Shopping Cart
DEFAULT OVER-RIDES
Next the actual CMS, CATEGORY, and PRODUCT pages all allow the same settings that the Admin Panel page has, except they allow you to set a STATIC BLOCK
on a per-item basis and over-ride the default setting that we had in the admin settings above.
So far we have the admin side of the extension done. We have all the admin tabs for each section... product, category, CMS, and Configuration page.
Next step will be to add on to the same extension and make a Static Block
insert into the page. This Static Block
will be responsible for... Showing the correct Static Block
on each page based on the settings that were set in the above mentioned areas.....
- Determining the page we are on, and the page type (cms, product, home, category)
- It will then have to read all the custom settings that were set in the above mentioned areas.
- If it is determined we are on a
Category
page, we will then have to get the actual specifiv Category we are on. For exampleCategory 3
. We will then see if there is a specific setting for that specific category. If it saysEnabled
we will then look for whichStatic Block
is saved for that category and show it in our mainStatic Block
on the page! - If the above Specific Category is set as
Disabled
for ourModal Window
then we will look higher up in the more global settings for the Modal and see if a Modal is Enabled for all categories. If yes, then we will see whichStatic Block
is set to be shown to all categories. - In addition to all this, it will do this process for each of out main page types (product, categories, cms, home, cart)
- We will also have to check if the shopping cart is empty or not. IF not empty...then we will have to take that into consideration above when wqe are checking which
Static Block
to show for that page as each setting allows for aStatic Block
to be set for empty cart and 1 for not empty cart! (I know this is a massive hard and large undertaking but we have the admin side done mostly. Just need to do the part that takes all those into account in determining whichStatic Block
to show on which particular page.
So to get me in the right direction I have a couple of smaller questions...
- How can I inside my
Static Block
code (the PHP part) determine which TYPE of PAGE I am on. Like I mentioned I need to know if I am on.... HOME PAGE, a CMS PAGE, a CATEGORY PAGE, a PRODUCT PAGE, or the SHOPPING CART PAGE ? - In addition to the PAGE TYPE I need to get the actual page. So if I am on Product id 1234 then I need to be able to get the setting (static block set for that page) for that particular page.
I know this has been a long and possibly confusing post. If you made it this far, thank you for taking your time to read this =)
If you can assist with my question, each little chunk will get me closer to the end goal
Below is a Flow chart I made of how my module will need to work to determine which static block to insert into the page
Mage_Widget
module, right?Mage_Widget
? I need to look into that as well