How To Get Current Page Parameters And Properties of Joomla 3.1 - joomla

I want to create a module for joomla 3.1 for my own site. I need to know how to get current category id, parent category id, current page id. Please some one tell me how to do that. Thanks for your advance

going from memory here, please bear with some inaccuracies but it should be enough to get you going.
$input = JFactory::getApplication()->input;
// should be article, categories, featured, blog...
$view = $input->get('view');
// if it's a category view, this will be the category id, else the article id
$id = $input->getInt('id');
// in an article view, this will be the cat id.
$catid = $input->getInt('catid');
// this is the menu item id i.e. what you call page id I guess.
$Itemid = $input->getInt('Itemid');

Related

magento variable for product detail view

is there a variable to check if the product detail view (view.phtml) is used?
Why do I need this?
Price.phtml is used in product overview and product detail view also. I want to add a ifelse function when the price is shown on product detail view cause I want some more information.
Regards
Matt
Yup this is quite easy to achieve;
$pageIdentifier = Mage::app()->getFrontController()->getAction()->getFullActionName();
if($pageIdentifier == 'catalog_product_view') {
// Do something on product view page only
echo 'This is a product view page';
}

To disable url for particular subcategory in magento cart

just got handed a magento site to update. No experience with the cart, so I hope these questions aren't too simplistic. Did search around a bit and haven't been able to find straightforward answers
=> For Some of my accessories showing in magento cart i does not want link on their title and image so how i made this dynamically.
Any help is appreciable
I have create a function in /app/code/core/Mage/Checkout/Block/Cart/Item/Renderer.php
public function getCustumcatId()
{
$proid=$this->getProduct()->getId();
$categoryIds=$this->getProduct()->getCategoryIds($proid);
foreach($categoryIds as $categoryId)
{
$category = Mage::getModel('catalog/category')->load($categoryId);
}
return $category->getName();
}
and call it on default.phtml of cart
after getting name i use if and else to remove link thanks for help and comment

How can I get the CMS page id of a particular page in Magento

In magento by using this code:
$currentPageId =$this->getRequest()->getParam('page_id');
we can get the current page id.
But how can I get the page id of a particular page?
For example, I have a page with URL key about-fruit-store.
I want to get its page id. How can I get it?
Either
$model = Mage::getModel('cms/page')->load('about-fruit-store','identifier');
var_dump($model->getData());
var_dump($model->getPageId());
or
$model = Mage::getModel('cms/page')->getCollection()
->addFieldTofilter('identifier','about-fruit-store')
->getFirstItem();
var_dump($model->getData());
var_dump($model->getPageId());
should do it.

Display New Products, Filter by Category Ids: in Magento

i have magento 1.5 and i want to display new products Filter by Category Ids. I had try by ->addCategoryFilter($categoryId);
But not working...
I also try this tips, which exactly i want by (Category ids). but it give me error of: "Invalid attribute Category_ids"...
SO can any one display new products in magento by list of Category ids....?
See my reply here How to get all product from a category including its subcategories in Magento?
To filter with Category you need to pass category model data rather then category ID. As like
below.
$category_id = 10;
$catagory_model = Mage::getModel('catalog/category')->load($category_id);
$collection->addCategoryFilter($catagory_model);
Please see this link for more detail http://way2discuss.blogspot.in/2012/07/magento-show-all-products-from-specific.html

How can I get current category id of Virtue Mart

I want to change the default Featured Products module of Virtue Mart. I would like to this module show just the current category's featured product. So I need to get the current category id.
How can I get it?
Thanks!
JRequest::getInt(category_id);
$input = JFactory::getApplication()->input;
// should be article, categories, featured, blog...
$view = $input->get('view');
// if it's a category view, this will be the category id, else the article id
$id = $input->getInt('id');
// in an article view, this will be the cat id.
$catid = $input->getInt('catid');
// this is the menu item id i.e. what you call page id I guess.
$Itemid = $input->getInt('Itemid');
I hope this will help you.. :)

Resources