create select in joomla - joomla

I have a little confused with joomla 2.5
I have a component (product) with name, description and category.
I want to do a select to find a product selecting the category...
In the view of the front-end I show all the product, and I put a select here
<?php echo JHTML::_('select.genericlist', $options,'myfilter', 'class="inputbox"','value','text'); ?>
<?php if($this->items) : ?>
<div class="items">
<ul class="items_list">
<?php foreach ($this->items as $item) :?>
<li><?php echo $item->nombre; ?></li>
<li><?php echo $item->descripcion; ?></li>
<li><?php echo $item->nivel; ?></li>
<?php endforeach; ?>
but I donĀ“t know how to call the controller and model if I select one item of select

You would need to:
Wrap your <select> with a <form> tag
replace first line of your code with:
< ?php echo JHTML::_('select.genericlist', $options, 'myfilter', 'class="inputbox" onchange="this.form.submit()"' ,'value', 'text'); ?>
Write your Controller and Model. A good tutorial can be found at:
http://docs.joomla.org/Developing_a_Model-View-Controller_Component/2.5/Introduction
set appropriate parameters in order to point joomla to the right controller. eg:
<input type="hidden" name="option" value="com_helloworld" />
<input type="hidden" name="task" value="updhelloworld.submit" />

Related

Magento Save Value in Custom Attribute of Customer from one page checkout (billing.phtml)

I have made one attribute for customer registration. It is working fine on registration. I am getting problem on one page checkout. Like normal registration, i am also taking value from customer during one step checkout registration but problem is that it doesn't store the value in attribute. thank you in advance
code of billing.phtml which display textbox for attribute to take value from user
<li class="fields">
<div class="field">
<label for="<?php echo $attribute->getAttributeCode(); ?>" <?php if($attribute->getIsRequired()):?>class="required"><em>*</em> <?php else :?>><?php endif;?><?php echo $this->__($frontEndLabel) ?></label>
<div class="input-box">
<?php if($attribute->getFrontendInput()== 'text'):?>
<input type="text" name="billing[test]" id="billing:<?php echo $attribute->getAttributeCode(); ?>" title="<?php echo $this->__($frontEndLabel); ?>" class="input-text <?php echo $fieldRequiredClass; ?> <?php echo $fieldFrontendClass ;?>" />
<?php endif ?>
</div>
</div>
<?php endif ?>
<?php endforeach ?>
</li>
Just Update following code in your config.xml and check it
<fieldsets>
<checkout_onepage_quote>
<attributename>
<to_customer>*</to_customer>
</attributename>
</checkout_onepage_quote>
</fieldsets>

Magento missing translation

This is a very simple question: What do I need to change in order to translate this?? Is it hard-coded somewhere? Inside database?
The code bellow creates this tabs and can be found at this file app\design\frontend\rwd\default\template\catalog\product\view.phtml#175:
<div class="product-collateral toggle-content tabs">
<?php if ($detailedInfoGroup = $this->getChildGroup('detailed_info', 'getChildHtml')):?>
<dl id="collateral-tabs" class="collateral-tabs">
<?php foreach ($detailedInfoGroup as $alias => $html):?>
<dt class="tab"><span><?php echo $this->escapeHtml($this->getChildData($alias, 'title')) ?></span></dt>
<dd class="tab-container">
<div class="tab-content"><?php echo $html ?></div>
</dd>
<?php endforeach;?>
</dl>
<?php endif; ?>
</div>
It does not follow the $this->__('Recurring Profile') pattern. My app/locale/pt_BR/Mage_Sales.csv already have the key/value "Recurring Profiles","Perfis Recorrentes".
This is the page of a recurring profile product running in a Magento 1.9 instance.
Look up to
app/locale/pt_BR/Mage_Sales.csv
There would be something like
"Recurring Profiles","Perfiles Repetitivos"
If the file doesnt exists, copy the one from app/locale/en_US/Mage_Sales.csv and replace with your desired translations.
Thanks #scrowler. Magento is missing the proper localization method call. The code at app\design\frontend\rwd\default\template\catalog\product\view.phtml#175 should be changed to:
<div class="product-collateral toggle-content tabs">
<?php if ($detailedInfoGroup = $this->getChildGroup('detailed_info', 'getChildHtml')):?>
<dl id="collateral-tabs" class="collateral-tabs">
<?php foreach ($detailedInfoGroup as $alias => $html):?>
<dt class="tab"><span><?php echo $this->escapeHtml($this->__( $this->getChildData($alias, 'title'))) ?></span></dt>
<dd class="tab-container">
<div class="tab-content"><?php echo $html ?></div>
</dd>
<?php endforeach;?>
</dl>
<?php endif; ?>
</div>
Just added the $this->__(...) and check for proper localization in .csv files.

How can I remove the drop down listbox "editor" from the basic settings of the form were user edits his profile?

How can I remove the drop down listbox "Editor (optional)" from the basic settings of the form were user edits his profile?
I don't need it.
Here is the code of the com_users/views/profile/tmpl/edit.php view file.
<?php
/**
* #package Joomla.Site
* #subpackage com_users
* #copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* #license GNU General Public License version 2 or later; see LICENSE.txt
* #since 1.6
*/
defined('_JEXEC') or die;
JHtml::_('behavior.keepalive');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
JHtml::_('behavior.noframes');
//load user_profile plugin language
$lang = JFactory::getLanguage();
$lang->load( 'plg_user_profile', JPATH_ADMINISTRATOR );
?>
<div class="profile-edit<?php echo $this->pageclass_sfx?>">
<?php if ($this->params->get('show_page_heading')) : ?>
<h1><?php echo $this->escape($this->params->get('page_heading')); ?></h1>
<?php endif; ?>
<form id="member-profile" action="<?php echo JRoute::_('index.php?option=com_users&task=profile.save'); ?>" method="post" class="form-validate" enctype="multipart/form-data">
<?php foreach ($this->form->getFieldsets() as $group => $fieldset):// Iterate through the form fieldsets and display each one.?>
<?php $fields = $this->form->getFieldset($group);?>
<?php if (count($fields)):?>
<fieldset>
<?php if (isset($fieldset->label)):// If the fieldset has a label set, display it as the legend.?>
<legend><?php echo JText::_($fieldset->label); ?></legend>
<?php endif;?>
<dl>
<?php foreach ($fields as $field):// Iterate through the fields in the set and display them.?>
<?php if ($field->hidden):// If the field is hidden, just display the input.?>
<?php echo $field->input;?>
<?php else:?>
<dt>
<?php echo $field->label; ?>
<?php if (!$field->required && $field->type!='Spacer' && $field->name!='jform[username]'): ?>
<span class="optional"><?php echo JText::_('COM_USERS_OPTIONAL'); ?></span>
<?php endif; ?>
</dt>
<dd><?php echo $field->input; ?></dd>
<?php endif;?>
<?php endforeach;?>
</dl>
</fieldset>
<?php endif;?>
<?php endforeach;?>
<div>
<button type="submit" class="validate"><span><?php echo JText::_('JSUBMIT'); ?></span></button>
<?php echo JText::_('COM_USERS_OR'); ?>
<?php echo JText::_('JCANCEL'); ?>
<input type="hidden" name="option" value="com_users" />
<input type="hidden" name="task" value="profile.save" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>
</div>
I don't think it is possible to disable only the Editor parameter. You can however remove the entire Basic Settings, by following these steps:
In the Joomla backend, go to User Manager
Go to Options
Set the Frontend User Parameters to hide
Remove only the Editor parameter, the only method I can think of without hacking core code is to use CSS to hide it.

magento show tab if content exists

i'm using the tab.phtml from the modern theme to create product tabs, however i've switched this to using jquery and jquery-ui as i needed to link to a tab directly.
So in a nut shell the code is pretty much the same as the one found in the modern theme.
<div id="tabs">
<ul>
<?php foreach ($this->getTabs() as $_index => $_tab): ?>
<?php if($this->getChildHtml($_tab['alias'])): ?>
<li class="<?php echo !$_index?' active first':(($_index==count($this->getTabs())-1)?' last':'')?>"><?php echo $_tab['title']?></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<div class="clearer"></div>
<?php foreach ($this->getTabs() as $_index => $_tab): ?>
<?php if($this->getChildHtml($_tab['alias'])): ?>
<div class="product-tabs-content" id="<?php echo $_tab['alias'] ?>"><?php echo $this->getChildHtml($_tab['alias']) ?></div>
<?php endif; ?>
<?php endforeach; ?>
</div>
and i'm adding the custom tabs using the same method under catalog.xml:
<action method="addTab" translate="title" module="catalog"><alias>how-to-use</alias><title>How to Use</title><block>catalog/product_view</block><template>catalog/product/view/how-to-use.phtml</template></action>
however i've noticed that the tab 'upsells' only appears when there are upsell products assigned. I'm wanting to use this same functionality to display a custom product attribute if there is content to display.
So what i'm asking is how does the upsell detect that there are no products assigned so no tab is displayed so i can do this for my custom tab. my custom tab phtml file looks like this:
<?php $_howtouse = $this->getProduct()->getHowToUse(); ?>
<?php if ($_howtouse): ?>
<div class="std">
<?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_howtouse, 'howtouse') ?>
</div>
any help greaty received thanks :)
The first line of code in upsell.phtml controls the appearance:
<?php if(count($this->getItemCollection()->getItems())): ?>
I am speculating your code is simply evaluating to true and always showing that section. What is your output from $this->getProduct()->getHowToUse() ?
It turned out i had 1 line above my:
<?php $_howtouse = $this->getProduct()->getHowToUse(); ?>
which meant it registered as there being some content all be it white space.
got rid of the whitespace it now works.

Magento: Storeview Access

Situation right now:
I've got a live-system and its running very well.
I DO NOT have a testing system.
Our live-system is a multi-store with several storeviews on one website.
PROBLEM:
I need to to add one more storeview and work on that within that livesystem. How can I restrict access to this storeview, so that no customer, whether logged in or not, can see this store? Is this even possible?
I need just an admin (me) to access this storeview.
Sure, I could disable all storeswitcher in the other live-stores but I don't think, this would be a nice solution to my problem. :)
If you do not want to show up currently edited store (view) on your language dropdown select field, do the following:
Add a new customer-group called "admins" to your shop and remember the id which appears in the list.
If not already done, add a new customer for the admin and assign it to the just created customer-group
Go to system->store-view and click on the link in the StoreView Name - column which you dont want to show up on the frontend and klick it, you'll see the StoreView id in the url /index.php/admin/system_store/editStore/store_id/3/key/, remember it
Now edit the file: app/design/frontend/default/your_shop/template/page/switch/languages.phtml
from:
<?php if(count($this->getStores())>1): ?>
<div class="form-language">
<label for="select-language"><?php echo $this->__('Your Language:') ?></label>
<select id="select-language" title="<?php echo $this->__('Your Language') ?>" onchange="window.location.href=this.value">
<?php foreach ($this->getStores() as $_lang): ?>
<?php $_selected = ($_lang->getId() == $this->getCurrentStoreId()) ? ' selected="selected"' : '' ?>
<option value="<?php echo $_lang->getCurrentUrl() ?>"<?php echo $_selected ?>><?php echo $this->htmlEscape($_lang->getName()) ?></option>
<?php endforeach; ?>
</select>
</div>
<?php endif; ?>
to:
<?php
// StoreView-Ids we dont want to show on frontend
$stores = array(3);
// Set admin group id with access to the above storeviews
$frontendAdminGroupId = 5;
// Get current user group id
$currentGroupId = $this->helper('customer')->getCurrentCustomer()->group_id;
?>
<?php if(count($this->getStores())>1): ?>
<div class="form-language">
<label for="select-language"><?php echo $this->__('Your Language:') ?></label>
<select id="select-language" title="<?php echo $this->__('Your Language') ?>" onchange="window.location.href=this.value">
<?php foreach ($this->getStores() as $_lang): ?>
<?php foreach ($stores as $_adminStore) : ?>
<?php /* Admin Store! */?>
<?php if($_adminStore == $_lang->getId() ) : ?>
<?php if($currentGroupId == $frontendAdminGroupId) : ?>
<?php $_selected = ($_lang->getId() == $this->getCurrentStoreId()) ? ' selected="selected"' : '' ?>
<option value="<?php echo $_lang->getCurrentUrl() ?>"<?php echo $_selected ?>><?php echo $this->htmlEscape($_lang->getName()) ?></option>
<?php endif; ?>
<?php else: ?>
<?php /* Normal User! */?>
<?php $_selected = ($_lang->getId() == $this->getCurrentStoreId()) ? ' selected="selected"' : '' ?>
<option value="<?php echo $_lang->getCurrentUrl() ?>"<?php echo $_selected ?>><?php echo $this->htmlEscape($_lang->getName()) ?></option>
<?php endif; ?>
<?php endforeach; ?>
<?php endforeach; ?>
</select>
</div>
<?php endif; ?>
you also have to edit the checkout and any other part of magento which shows up a select field for the store view, that's just a half solution. good luck :-)
If you use Magento Enterprise you are given a staging site where you would be able to make these changes before pushing them out to production.
Or, you can do as #Anton S above said and create a development site. You would use Magento's export functionality to move changes over. NOT a full database dump/import. That way you won't lose any customer and order information.

Resources