How to remove time from dateTime in kunena1.7 - joomla

I use kunena in my site and I want remove time from datetime in latest post by user in main page or in post page.
I delete %H:%i from its variable in language file but time is shown still.
How can I remove this?

Edit code of kunena core.
For example in this path:
components/com_kunena/template/yourTemplate/view/message.php
I edited this:
<span class="kmsgdate kmsgdate-left" title="<?php echo CKunenaTimeformat::showDate($this->msg->time, 'config_post_dateformat_hover') ?>">
<?php echo CKunenaTimeformat::showDate($this->msg->time, 'config_post_dateformat'); ?>
</span>
To:
<span class="kmsgdate kmsgdate-left" title="<?php echo CKunenaTimeformat::showDate($this->msg->time, 'config_post_dateformat_hover') ?>">
<?php
$dateTime = CKunenaTimeformat::showDate($this->msg->time, 'config_post_dateformat');
$date = explode(" ", $dateTime);
echo $date[1];
?>
</span>
And just date will be shown.

In the Joomla backend:
Go to the Kunena Configuration page
Go to the "Frontend" tab
There is a parameter called "Message Time Format" which you can set to "hide"
Update:
Having said that, I realised I am using Kunena 2.0.x which you should also do. So I recommend upgrading to the latest version of Kunena, which is still Joomla 1.5 compatible.

Related

How to change currency code abbrevation with currency symbol in Magento

I have a slight problem with Magento here.
If you look at this page
MY DEMO PAGE
You will see RED BUTON with title KUPI and price as 9 BAM.
BAM is my currency code, not my currency symbol. I need to replace this "BAM" with "KM".
On checkout everything is fine, all prices are in "KM" not in "BAM".
Code of this part (with button KUPI) is:
<div class="pull-right" id="deal-show-vitals-buy">
<a onclick="submitform();" data-deal_id="<?php echo $_product->getId();?>" href="#"
data-toggle="modal" class="btn btn-large btn-g font-large"
id="buy-button">
<strong>KUPI</strong> <?php echo $this->getPriceCurrency($_product->getPrice()); ?> </a>
</div>
Problem is in this part of code, i think:
<?php echo $this->getPriceCurrency($_product->getPrice()); ?>
Please, any help appreciated
The core helper ( Mage::helper('core') ) has a method in it which you can use to format the currency.
<?php echo Mage::helper('core')->currency($_product->getPrice()) ?>
As an alternative, you are able to get the currency symbol as a stand alone option as well.
$symbol = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
echo $symbol;
My recommendation is to use the first option (the core helper) since it is the primary purpose of using helpers.
References
Magento Core Helper Documentation

Magento shows attribute if value is left blank

I have a drop down magento attribute for warranty_labour. I'm pulling in the attribute using my themes product/view.phtml and then attaching an icon to show what warranty you get.
Ive used this code which successfully works:
<?php $warranty=$_product->getAttributeText('warranty_labour'); echo '<img style="padding-top: 10px;" src="/images/warrantylabour/'.str_replace(' ', '_',$warranty).'.png" alt="'.$warranty.'">'; ?>
The problem I find when a product doesn't have a warranty attribute set (left blank on the backend) I still get the code inserted on to the product source code on the frontend like this:
<img style="pad`ding-top: 10px;" src="/images/warrantylabour/.png" alt="">`
Is there a way I can stop this happening when a value isn't set in the attribute?
Don't forget logic! :-) Just test that $warranty has a value Using typical Magento template conventions:
<?php if($warranty=$_product->getAttributeText('warranty_labour')): ?>
<?php echo sprintf('<img style="padding-top: 10px;" src="/images/warrantylabour/%s.png" alt="%s"/>', str_replace(' ', '_',$warranty),$warranty) ?>
<?php endif; ?>
This kind of syntax might justify encapsulating this logic and string building into a helper method, I think.

open a modal windows in a server

Hi everyone I have a modal windows in joomla 3.0!
I pass the router to javascript like this
<?php $link =JURI::root().'index.php?option=com_projects&view=proyectos&format=raw&task=todosProyecto&id='. $item->id;?>
<li class="item" data-id="id-<?php echo $item->id ?>" data-type="<?php echo $item->categoria ?>">
<a href="#modal" id="<?php echo $link;?>" role="<?php echo $item->id ?>" class="picture" data-toggle="modal">
<img src="<?php echo JURI::root()?><?php echo $item->imagen_portada; ?>"/></a>
<p class="titulo"><?php echo $item->nombre; ?></p>
<p> <?php echo $item->municipio; ?>(<?php echo $item->pais; ?>)<br><?php echo $item->year; ?>
</p>
In local when I open the modal windows it work well, but in the server the modal windows show me the index.php view of this component.
I think that my problem is here, when I take the request for the model I have this.
public function elegirSeleccionados(){
$this->pagination = $this->get('pagination');
$this->items = $this->get('recientes');
$this->list = $this->get('list');
parent::display();
}
But $this->get('list'); is null so I have to asigned a null value to list.
I changed by that..
$this->list = $this->items;
but dont work to!
Any idea!!!
Where is this code?
First part looks like a Layout (views\proyectos\tmpl\default.php) and the second one like a View (views\proyectos\view.html.php).
If it is so, I'd say you are not really loading items in View from the Model. Try using $this->items = $this->get('Items');
But this doesn't explain different results on server and local host.
Hi everyone I solved the problem... the name of my view hava a Camelcase for example itemId and joomla try to find itemid, so donĀ“t find the view and show the default view in the modal.
So I change the name of file without camelCase and now work.!

Magento - Unable to Refresh Product Stock Status on the Product Page

One of our Vendors has a real time inventory system and we would like to implement it into our site. When a person clicks on the product, it should check the inventory and update as necessary. This works ok at best. The problem is when the product switches to in/out of stock. It updates properly in the backend, but I am unable to get the addtocart button to be added/removed. This is my code for updating the stock:
//$_stockQTY is the realtime inventory result
$stockData = Mage::getModel('cataloginventory/stock_item');
$stockData->loadByProduct($_product->getId());
$stockData->setData('qty', $_stockQTY);
$stockData->setData('is_in_stock',($_stockQTY > 0) ? 1 : 0);
if ($stockData->dataHasChangedFor('qty')) {
$stockData->save();
$_product = Mage::getModel('catalog/product')->load($_product->getId());
}
As you can see, I am force reloading the product when qty is changed. This seems to work for everything but the addtocart button. It shows the previous result (In stock or out of stock before the reload.)
I have 2 questions:
Is there a better way to reload a product other than reassigning it as I am doing above:
$_product = Mage::getModel('catalog/product')->load($_product->getId());
And why is it that everything is updating properly, but the addtocart which uses the same
$_product->isSaleable()
call that our availability, etc uses.
Compare:
<?php if($_product->isSaleable()): ?>
<p class="availability in-stock"><img src="<?php echo $this->getSkinUrl('images/stock.png') ?>"> <span><?php echo $this->__('In stock') ?></span>
...
?>
To
<?php if($_product->isSaleable()): ?>
<?php echo $this->getChildHtml('addtocart') ?>
<?php endif; ?>
<?php echo $this->getChildHtml('alert_urls') ?> //Only Shows up if addtocart does not.
Refreshing the page will update the product properly, but doing a meta refresh or anything of the sorts is out of the question. I appreciate any advice that could be given as I would like to get this resolved and on to the next task.
Unless I'm misunderstanding your question, it appears the thorn in your side is the stock status index.
Try this:
Mage::getSingleton('cataloginventory/stock_status')->updateStatus($_product->getId());
(I haven't tested this, but it looks like it ought to work)

Magento share cart between websites

I have a Magento store which needs different prices for each site, which restricts me to using different websites for each, as stores or views won't let me set different prices for the same items.
However, I need to be able to allow the customer to switch store, and for their current basket to stay with them. This would include updating the prices to those in the new website.
I've set Share Customer Accounts to Global and Catalog Price Scope to Website.
I also have an initial changer:
<?php $websites=Mage::app()->getWebsites();?>
<?php if(count($websites)>1): ?>
<fieldset class="store-switcher">
<label for="select-store"><?php echo $this->__('Select Store') ?>:</label>
<select id="select-store" onchange="location.href=this.value">
<?php foreach ($websites as $website): ?>
<?php $_selected = ($website->getCode() == Mage::app()->getWebsite()->getCode()) ? ' selected="selected"' : '' ?>
<option value="<?php echo $website->getDefaultStore()->getBaseUrl()?>"<?php echo $_selected ?>><?php echo $this->htmlEscape($website->getName()) ?></option>
<?php endforeach; ?>
</select>
</fieldset>
<?php endif; ?>
Is this achievable? Or is it back to the drawing board?
Info: Magento ver. 1.6.2.0
Also: The websites I wish to share the cart between are on the same domain, and have the same frontend cookie value. (which I assume is the SID).
This is an old fix to share cart contents (1.3 or 1.4) I used and may no longer be valid for 1.6, but give it a shot.
Edit the following template for your theme: template/page/switch/stores.phtml
Add to stores.phtml
$sessionID = Mage::getModel('core/session')->getSessionId();
Paste the new option value I included below over the the existing option value
<option value="<?php if(strpos($_group->getHomeUrl(),"?")===false){ echo $_group->getHomeUrl()."?SID=".$sessionID; }else{ if(strpos($_group->getHomeUrl(),"&SID=")===false){ echo $_group->getHomeUrl()."&SID=".$sessionID; }else{ echo $_group->getHomeUrl();}} ?>" <?php echo $_selected ?>><?php echo $this->htmlEscape($_group->getName()) ?></option>
Then create or modify a template to include static links to the individual stores to switch back and forth (eg: in the header). This fix did not work for the store switcher itself, but worked fine with these links.
You are in store A. Goto Store B.
As best I can tell it is not possible to share carts between websites by design. Though by store within a website works fine.

Resources