I'm looking for a way to remove the product(s) link in the mod_virtuemart_cart. I want the product name - just no link. I'm stuck on line 34 of the default.php page under mod_virtuemart_cart/tmpl/:
<div class="product_row">
<span class="quantity"><?php echo $product['quantity'] ?></span> x <span class="product_name"><?php echo $product['product_name'] <-- RIGHT HERE ?></span>
</div>
Any ideas? Below is an URL to an image to help better show what I'm trying to accomplish.
http://superiordash.com/images/templatehelp.png
Thanks,
Michael
in file JRoot/components/com_virtuemart/helpers/cart.php
on line 1663:
change this:
$this->data->products[$i]['product_name'] = JHTML::link($url, $product->product_name);
to this:
$this->data->products[$i]['product_name'] = $product->product_name;
or other method is to use jQuery to remove the link.
FYI adding the following code at about line 20 to an override module template file in your template directory:
/templates/(name)/html/mod_virtuemart_cart/default.php
will result in a better manner to avoid breaking in the future:
// Remove links from products
foreach ( $data->products as &$product ) {
$product['product_name'] = strip_tags( $product['product_name'] );
}
Pull the default.php file from your /modules/mod_virtuemart_cart/tmpl folder and copy it to your template/html folder and edit.
Related
I'm working on a website that is using Woocommerce (and its plugin Sensei, which supports courses, lessons, quizzes, etc.). I'm running into trouble changing a small piece of info.
Within the Sensei plugin there if a file (woothemes-sensei > includes > class-sensei-course.php). In this file, there is one line of code that I want to change without editing the core file. I understand that I probably need to do this in my child theme's functions.php files, but I'm not quite sure what to do. I need to change the $course_page_url to a custom url in the following code:
<div id="active-courses">
<?php if ( '' != $active_html ) {
echo $active_html;
} else { ?>
<div class="sensei-message info">
<?php echo $no_active_message; ?>
<a href="<?php echo $course_page_url; ?>">
<?php _e( 'Start a Course!', 'woothemes-sensei' ); ?>
</a>
</div>
<?php } // End If Statement ?>
</div>
Can anyone tell me the best way to go about doing that? I don't know how to hook into a filter to change that url.
And the entire class-sensei-course.php file can be found here. The code that I included above begins on line 1596.
I have a Wordpress website with Virtue theme. And I want the page titles on every page (except the homepage) give a typing effect. I installed this plugin and it wrotes I just need to insert this code:
<?php echo do_shortcode( '[typed string0="Projects" typeSpeed="40" startDelay="0" backSpeed="40" backDelay="500"]' ) ?>
into the .php file in the theme where I need it. I just need to change the "Projects" to the actual page's title.
Where should I insert it?
You should concatenate that string with get_the_title():
<?php echo do_shortcode( '[typed string0="' . get_the_title() . '" typeSpeed="40" startDelay="0" backSpeed="40" backDelay="500"]' ) ?>
I could find the solution! I had to insert it in page-header.php like:
<?php echo do_shortcode( '[typed string0="'. apply_filters('kadence_page_title', kadence_title() ) .'" typeSpeed="40" startDelay="0" backSpeed="40" backDelay="500"]' ); ?>
I would like to make a custom module with a list of tags. When a tag is clicked the visitor would be navigated to a category page that would show articles with that tag.
I am not a joomla expert, I was thinking about a solution like a hyperlink like this that I would add to the tags inside the module:
href="http://mywebsite.com/index.php/itemlist/tag/tokio%20city?category=places"
Is this possible? Or how could I achieve this result?
Thanks!
This is a bit more complicated than just a query string in the URL as you also need to tweak a template.
If you want to keep it as simple as possible, I'd would recommend creating a new K2 template using template overrides and editing the category template so that it would read the query string parameters and show only articles already filtered by the category and furthermore by the tag via a query string.
That's just a brief how-to, now with a lil bit more details:
1) Create a new K2 template using template overrides.
In your template, if it doesn't exist already, create a folder structure /templates/your_template/html/com_k2/templates/default. The "default" can be replaced with any name if you want to have more K2 templates, but you have to set the new template to each category you have manually.
Now take the content from "/components/com_k2/templates/default" and copy it to the new folder in your template. Now, K2 is using the templates from your /templates/your_template/html/com_k2/ folder. Feel free to google more details if you don't understand template overrides, it's pretty important thing when customizing a template.
2) Edit your category view file to accommodate the list to your query strings
The file that interests you now is in /templates/your_template/html/com_k2/templates/default/category.php. Open this file and try to understand what's important there:
Line 141
<?php foreach($this->leading as $key=>$item): ?>
Line 169
<?php foreach($this->primary as $key=>$item): ?>
Line 197
<?php foreach($this->secondary as $key=>$item): ?>
Line 226
<?php foreach($this->links as $key=>$item): ?>
This is what matters. In these four foreach loops, there are all the items. Then, you can wrap the content of each of these loops into an if-condition to check whether it has the desired tag that is specified in the URL.
To show you an example, this is the code for <div id="itemListPrimary">. You can replace this whole div in the category.php file with the following code and it will work flawlessly. I've just written and tested it.
<div id="itemListPrimary">
<?php foreach ($this->primary as $key=>$item): ?>
<?php
# Get the value of the "tag" query string
$jInput = JFactory::getApplication()->input;
$myTag = $jInput->get('tag', null, 'STRING'); // Joomla 1.6+
//$myTag = JRequest::getVar('tag'); // for Joomla 1.5
# If the tag is empty, the query string is not specified and we'll go standard way without any tag filter
if (empty($myTag)) {
// Define a CSS class for the last container on each row
if ((($key+1)%($this->params->get('num_secondary_columns'))==0) || count($this->secondary)<$this->params->get('num_secondary_columns'))
$lastContainer= ' itemContainerLast';
else
$lastContainer='';
?>
<div class="itemContainer<?php echo $lastContainer; ?>"<?php echo (count($this->secondary)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_secondary_columns'), 1).'%;"'; ?>>
<?php
// Load category_item.php by default
$this->item=$item;
echo $this->loadTemplate('item');
?>
</div>
<?php if(($key+1)%($this->params->get('num_secondary_columns'))==0): ?>
<div class="clr"></div>
<?php endif;
# Otherwise the tag is set so we'll filter the articles by the tag
} else {
# Get an array of all the tags that the current article in the loop has
$articleTags = array();
foreach ($item->tags as $tag) {
$articleTags[] = $tag->name;
}
# Check if the article has the tag specified in the URL as a query string
if (in_array($myTag, $articleTags)) {
# Now the default content of the foreach loop comes as written in the default K2 category.php template
// Define a CSS class for the last container on each row
if ((($key+1)%($this->params->get('num_secondary_columns'))==0) || count($this->secondary)<$this->params->get('num_secondary_columns'))
$lastContainer= ' itemContainerLast';
else
$lastContainer='';
?>
<div class="itemContainer<?php echo $lastContainer; ?>"<?php echo (count($this->secondary)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_secondary_columns'), 1).'%;"'; ?>>
<?php
// Load category_item.php by default
$this->item=$item;
echo $this->loadTemplate('item');
?>
</div>
<?php if(($key+1)%($this->params->get('num_secondary_columns'))==0): ?>
<div class="clr"></div>
<?php endif;
}
} ?>
<?php endforeach; ?>
</div>
3) Understand how the URLs will work
My typical category URL is:
http://mywebsite.com/category-name
To show only articles with a specified tag, use:
http://mywebsite.com/category-name?tag=your-tag
For instance, if you want to show only articles with the "Tokio City" tag, use:
http://mywebsite.com/category-name?tag=Tokio City
Done.
That's the basics of what you needs. It's all you need if you use primary articles only (no leading and secondary or links). Of course there are plenty more things you might want to take care of:
a notice if there is no article with the specified tag
no redundant code, I've written it like this for the sake of simplicity and readability
SEO - spaces and special characters in URLs
making sure no empty div will be printed
But that would be way more code and I wanted to keep it simple & readable for you. I think I gave you more than enough for a start, so go ahead and get it done, good luck :)
i want to highlight only the pressed menu item in magento, can it be done?
i have tried to achieve this in many ways but none of them succeeded (i can list some of them here if it helps)
thank you
1 tried php get url and compare it to the text written inside the a tag
2 tried built-in methodes/id specific to magento
i have made some progress -i added this code to my template file -2columns-left.phtml
<?php
$routeName = Mage::app()->getRequest()->getRouteName();
echo $routeName;
$body_class = $this->getLayout()->getBlock('root')->getBodyClass();
echo $body_class;
if(strpos(strtolower($body_class),strtolower($routeName)) !== false){
$nav_active = "class = 'nav_active'";
}
?>
now i have added $nav_active to the body tag in the same file ,have tried this but it didnt work
<body<?php echo $this->getBodyClass()?' class="'.$this->getBodyClass().'"':'' ?><?php if(strpos(strtolower($body_class),strtolower($routeName)) !== false):?> echo $nav_active ;?>>
you can try with my alternative solution
it is working at my end
just do it like this
<?php if (strpos(Mage::helper('core/url')->getCurrentUrl(),'your_category_name') != false ) :?> active<?php endif;?>
hope this will sure help you.
I wonder if its possible to change the description of one category to be just after the products.
Example here:
http://www.theprinterdepo.com/refurbished-printers/monochrome-laser-refurbished-printers
I suppose there is one phtml file somewhere that I could change easily for this
I found the file, and the code is as follow
<?php if($_description=$this->getCurrentCategory()->getDescription()): ?>
<div class="category-description std">
<?php
//$currentPage = $this->getCollection()->getCurPage();
echo $_helper->categoryAttribute($_category, $_description, 'description')
?>
</div>
<?php endif; ?>
Howver the getCurPage gives an error
// get category id
$category = $category->load($category_id);
// get collection
$category->getProductCollection()->addCategoryFilter($category)->addAttributeToSelect('*');
// print out the description
echo $category->getDescription();
// get current page
$currentPage = $this->getCollection()->getCurPage();
if($currentPage = 1) {
// show Description Here
echo $category->getDescription();
} else {
// Show category name instead of description
echo $category->getName();
-- EDIT --
try this instead of above
$currentPage->getSelect()->getCurPage();
the file you are looking for is located in theme folder under catelog/category/view.phtml. so if have any custom theme installed locate the file first in your theme, if the file is not there then you can copy the file from the base folder and put in your theme folder, be sure to put the file in the correct folder otherwise it will not going to work. Like
if file is located in
app/design/frontend/base/default/template/catalog/category/view.phtmlput the file in
app/design/frontend/default/YOUR_THEME/template/catalog/category/view.phtml.This way if you upgrade the magento to newer version, the changes you made will not be over written by the system
If you want to put Category description after product listing, you just need to move elements around.
The template you need to modify is this:
app/design/frontend/{package}/{theme}/template/catalog/category/view.phtml.
Take this code:
<?php if($_description=$this->getCurrentCategory()->getDescription()): ?>
<div class="category-description std">
<?php echo $_helper->categoryAttribute($_category, $_description, 'description') ?>
</div>
<?php endif; ?>
and move it at the bottom of the file. That's it.