Get params value from component Joomla 3.0 - joomla

I have saved value like this in my component table fields params.
unique=1
default_value=Default
validate=Validate
validate_error_msg=Validate error messag
searchable=1
Now i want to get value in my component.So I am passing values in my component's view.html.php
in this way
$params = new JForm($row->params); but its not working.
Now I want to get value so I am taking like this
$this->params->getValue('default_value');
But its not work where as in Joomla 2.5 ,we can get value like this
$this->params->get('default_value');

Try like this
For Ex.
$param = JComponentHelper::getParams('com_users');
$default = $param->get('default_value');

Have you tried to use
$params->get('your_parameter_value_name');
instead of
$this->params->get('your_parameter_value_name');
It should work.

Related

Laravel update query use

I used this query to update the status column.
$val="1";
vehicles::where('id' , '=' , $veh_status)->update(['status' => $val]);
But when I submitted the status value doesn't change.
you can trace your query by using ->toSql() method !
try this to find whats happening in back
Not sure what the problem is there because you haven't given much info to work with, but you can check these suggestions:
Check if the column is set to be mass assignable in the model class, that is, it is in the fillable[] array.
make sure the id you pass to the where() function is valid.
Try using another function, save() which will achieve the same results you seek, like this;
// filter the vehicle
$vehicle = vehicles::where('id', '=', $veh_id)->first();
or
$vehicle = vehicles::find($veh_id);
$vehicle->status = 1;
$vehicle->save();
Lastly, I noticed your id variable you pass to the where the () function is called $veh_status "presumably - vehicle status" and not $veh_id, "presumably - vehicle id" so probably check that out.
Ref: Laravel Model Update documentation

Get Attribute Value - Magento

I have created a new attribute on magento 1.9 and called category_grouped. Now I am trying to get it's value on catalog page by using getAttributeRawValue but all I am getting is an ID. How could I get the value name rather than the ID? Below is my code. Thanks
<?php $attributeId = Mage::getResourceModel('catalog/product')-
>getAttributeRawValue($_product->getID(), 'category_grouped', $storeId);?>
The getAttributeText gets the value / name of the given attribute while getAttributeText return in this case the ID.
$attributeValue = Mage::getModel('catalog/product')
->load($_product->getID())
->getAttributeText('category_grouped');
You can set attribute value by using below code
$product->CategoryGrouped();
Thanks

laravel paginate passing additional var

let say i have url like this
http://localhost:8080/myweb/listproduct?idcategory=3
but when i used laravel pagination link, my passing variabel by url disappear like this
http://localhost:8080/myweb/listproduct?page=2
i want laravel paginate to pass my url variable too like this
http://localhost:8080/myweb/listproduct?idcategory=3&page2
so far i already try to set baseurl like this
$listproduct = DB::table('product')->paginate(15);
$users->setBaseUrl('listproduct?idcategory=3');
but the result is like this (? not &)
http://localhost:8080/myweb/listproduct?idcategory=3?page2
i used laravel 4.2
you can use setPath()
$users->setPath('listproduct?idcategory=3');
or if you only want to add to the query string you may use
$users->appends(['idcategory' => '3'])
You can use this method to append more arguments to your pagination link:
$listproduct->appends(['idcategory' => $id])->links();

ALERT SESSION VALUE FROM first page to 2nd page using JQuery,ajax, or javascript

hi guyz this is my first time here. ahmmm i'd like to ask some question regarding session. ahmm
how i cant alert session value from first page to 2nd page using jquery,ajax, or javascript??
please help, im new on that language. ):
You can pass value from one page to other using url query string.
one link to second page add data as parameter like http://your-url.com?data=user-session-value
in the second page call the below javascript function in onload or where you need value
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
you can alert the value like alert(getParameterByName('data'));
In this way your data will show in url. if you don't want to show it then use localstorage. But you need to be in same domain. I mean u can't pass data from one website to other.
In page one just set the data in local storage like localStorage.setItem('data', 'user-session-value');To alert the data in second page call alert(localStorage.getItem('data'));
Hope this can solve your issue... Happy coding...

How do I get attribute set name?

I am trying to get attribute set name in Magento product view template. I can get attribute value by $_product->getAttributeText('attribute'), but how do I get attribute set name?
I would like to display an attribute only if it is belong to a certain attribute set.
Whenever you have a product object, you can access its attribute set like this:
$attributeSetModel = Mage::getModel("eav/entity_attribute_set");
$attributeSetModel->load($product->getAttributeSetId());
$attributeSetName = $attributeSetModel->getAttributeSetName();
This will give you the name of the attribute set, which you can then compare using strcmp:
if(0 == strcmp($attributeSetName, 'My Attribute Set')) {
print $product->getAttributeText('attribute');
}
For more sexyness you can shorten it to:
$attributeSetName = Mage::getModel('eav/entity_attribute_set')->load($_product->getAttributeSetId())->getAttributeSetName();
Try the following code:
$entityTypeId = Mage::getModel('eav/entity')
                ->setType('catalog_product')
                ->getTypeId();
$attributeSetName   = 'Default';
$attributeSetId     = Mage::getModel('eav/entity_attribute_set')
                    ->getCollection()
                    ->setEntityTypeFilter($entityTypeId)
                    ->addFieldToFilter('attribute_set_name', $attributeSetName)
                    ->getFirstItem()
                    ->getAttributeSetId();
echo $attributeSetId;
Find more info about Attribute Set in the following article.
Thanks
Joe's answer requires a couple of alterations in order for it to work.
Firstly it should be $_product not $product, and secondly there is an erroneous ')' in the last line.
The following code should be correct:
$attributeSetModel = Mage::getModel("eav/entity_attribute_set");
$attributeSetModel->load($_product->getAttributeSetId());
$attributeSetName = $attributeSetModel->getAttributeSetName();
Comparing to a text value can have problems if users decide to later change that text - which is easy to do in Magento for attribute sets. One other option is to use the underlying id instead which is never going to change.
You can get this by looking up the value of the attribute_set_id column in the database using
select * from eav_attribute_set;
This number is also in the edit link in admin which is in bold below
http://.../index.php/admin/catalog_product_set/edit/id/10/key/6fe89fe2221cf2f80b82ac2ae457909ce04c92c51716b3e474ecad672a2ae2f3/
Your code would then simply use that property of the product. Base on the id of 10 in the link above this would just be
if (10 == $_product->getAttributeSetId()) {
//Do work
}

Resources