Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Changing module into related items

Changing module into related items 3 years 1 month ago #994

Hi.
My company bought JCF few months ago, and we like it.
Couple weeks ago we started thinking about new options- for example image of category in this module (I've made it and I can sent you new version of this module).
But the newest option is too much for me.
I've tried to make Related Adverts Module.
For example you have site with some adverts in main content section. In your sidebar you want add some adverts from category which the user is actually browse. It's quite difficult, but...

1st:
var_dump($params);
to see what i should change.
OK. I have:
["catid"]=> string(1) "1"

2nd:
Now the catid must be like catid of category which I'm browsing.
So i must get the ID of category.
But how?
I'm not a super-developer, but I'm quite good in abstract thinking :)
So i've get my site address!
i used:
$cateID = $_SERVER['PHP_SELF'];
And I get:
/index.php/component/jomclassifieds/category/2-categoryname?Itemid=134
ID of category is 2. I've used this:
$kategoria = substr($cateID, 45, 1);
It give me exactly what I want

3th:
And here is the problem...
I can't change value of catid...
I make this:
function moduj($params){
	$cateID = $_SERVER['PHP_SELF'];
		$kategoria = substr($cateID, 45, 1);
		$params->catid = $kategoria;
		}
and then I've tried (for example):
class JoomrelatedHelper {
function moduj($params){
	$cateID = $_SERVER['PHP_SELF'];
		$kategoria = substr($cateID, 45, 1);
		$params->catid = $kategoria;
		}
    public static function getItems( $params ) {								
		$db = JFactory::getDBO();		
		$query  = "SELECT a.*, c.title as category, c.alias as catalias FROM #__jomcl_adverts AS a";
		$query .= " LEFT JOIN #__jomcl_categories AS c ON a.catid=c.id";
						
	    $where = array();
		$where[] = "a.published=1";
		
		$catid = $params->get('catid');
			[b]$catid = moduj($params);[/b]
		if($params->get('isrelated') == 1) {
			$view = JRequest::getCmd('view');
			$id = JRequest::getInt('id');
			
			if($view == 'category') {
				$catid = $id;
			} else if($view == 'advert') {
				$catid = JomclUtils::getColumn('adverts', 'catid', $id);
			}
		}
		
		if($catid > 0) {
			$catids = JomclUtils::getChildren('categories', $catid, $params->get('inclsubcats'));
			$where[] = "a.catid IN (".implode(',', $catids).")";
		}
		$filterby = $params->get("filterby");	
		if($filterby == 'featured') {				
			$where[] = 'a.featured=1';
		}
		$where = count( $where ) ? ' WHERE '. implode( ' AND ', $where ) : '';
		$query .= $where;	
		
   	    switch($params->get('orderby')) {
			case 'latest' :
				$query .=  ' ORDER BY a.id DESC';
				break;
			case 'created' :
				$query .= ' ORDER BY a.id ASC';
				break;
			case 'price_lh' :
				$query .= ' ORDER BY a.price ASC';
				break;
			case 'price_hl' :
				$query .= ' ORDER BY a.price DESC';
				break;
			case 'popular' :
				$query .=  ' ORDER BY a.views DESC';
				break;
			case 'random' :
				$query .=  ' ORDER BY RAND()';
				break;
			case 'a_z' :
			default :
				$query .=  ' ORDER BY a.title ASC';
		}
		$query .= " LIMIT ".$params->get('limit');
		
		$db->setQuery( $query );
	   	$items = $db->loadObjectList();				
					     
		return $items;
    }	
}

I need some help...
The administrator has disabled public write access.

Changing module into related items 3 years 1 month ago #995

  • Super User
  • Super User's Avatar
  • Offline
  • Administrator
  • Posts: 2760
  • Thank you received: 292
  • Karma: 40
Hi,

The related adverts feature is already available i n our Jom Classifieds adverts module. To enable it, go to Extensions-->Module Manager--Jom Classifieds Adverts.

In this module parameters. please select select "YES" in the "Show related adverts" field and save it and check.

Thanks
The administrator has disabled public write access.

Changing module into related items 3 years 1 month ago #996

yeah, I saw it.
But I want only related items module (not adverts from category module and some related items) in different position.
For example we have 2 different positions: left (in sidebar) and right for component.
In component we have normal JCF with adverts. When we see advert from category 1 in left position we can see module with adverts from category 1. If we see advert from category 2- in left position is module with adverts from category 2. It must be automatically.

For example- if you watching some product you see in sidebar few other products from category of this product.
You are watching advert with cactus named Echinopsis mamillosa, and in sidebar you see other ccacti. Then you go to advert with blue chair, and in sidebar you see other chairs.

Maybe polish and english language aren't similiar but I think that I explained my problem.


I need something elastic/flexible not rigid/inflexible, I need something working automatically
Last Edit: 3 years 1 month ago by Kamil Rogala.
The administrator has disabled public write access.

Changing module into related items 3 years 1 month ago #998

  • Super User
  • Super User's Avatar
  • Offline
  • Administrator
  • Posts: 2760
  • Thank you received: 292
  • Karma: 40
Yeah i got it. This cannot be achieved by using Jom Classifieds Advert module. But you have related adverts feature in the component itself. Kindly check it under Components-->Jomclassifieds--> General Configuration.
Here under Layout settings, select "YES" in the "Show related adverts" field and check.

But the related adverts only can be displayed at the bottom of the page.

Thanks
The administrator has disabled public write access.

Changing module into related items 3 years 1 month ago #999

I know about option in component, but I want module because I want to place the information about other products in actual category in one, declared by me, position.

I know that this module in 'raw state" is not able to show information in this way what I want.
And because of that i'm changing it.
I know that I must change $params->catid. I know how to take category from the www address.
The only thing what I can't make is change value of $params->catid.

If I will get solution I will do it. And then I will give you finished module- better module or worse module but working.
The administrator has disabled public write access.

Changing module into related items 3 years 1 month ago #1004

  • Super User
  • Super User's Avatar
  • Offline
  • Administrator
  • Posts: 2760
  • Thank you received: 292
  • Karma: 40
Hi,

Its already possible with our component. Kindly send the below details to This email address is being protected from spambots. You need JavaScript enabled to view it. with your exact requirement. So that we will do it for you.

1. Joomla admin username and password.
2. Your site FTP details.

Thanks
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Time to create page: 0.203 seconds