News Flash:
New Version of ShopClass theme 1.4.0 is Released on 13 JUNE 2018, Please upgrade your installation.

Next and Previous AD

Please post bugs you have found in tuffclassified theme. If you have fix for that post it too.
Do not post anything else, issue related to third party plugins should not be posted here.
Locked
renas
Starter
Posts: 30
Joined: Sun Jun 14, 2015 5:33 pm
Has thanked: 5 times

Next and Previous AD

Post by renas » Thu Sep 03, 2015 9:02 pm

Hi,

This doesn't work on my site.

http://www.classificadosgratis.biz/

Tks

Rendy
Starter
Posts: 36
Joined: Sun Sep 22, 2013 8:36 am
Has thanked: 1 time
Been thanked: 1 time

Re: Next and Previous AD

Post by Rendy » Fri Sep 04, 2015 4:48 am

Hi renas open this link to fix ur trouble
http://forum.tuffindia.com/viewtopic.ph ... +ads#p1696
Regards

renas
Starter
Posts: 30
Joined: Sun Jun 14, 2015 5:33 pm
Has thanked: 5 times

Re: Next and Previous AD

Post by renas » Fri Sep 04, 2015 9:05 am

Tks Rendy,

That solved the problem even so i will post an improvement to this ASAP. :)

renas
Starter
Posts: 30
Joined: Sun Jun 14, 2015 5:33 pm
Has thanked: 5 times

Re: Next and Previous AD

Post by renas » Tue Sep 08, 2015 8:15 am

Hi,

I have this query from an old template wich i could reuse on this one. Even so i do think that can be improved and well adapted to this great theme.

The structure have some basic format.

1. Saves when possible the order column and direction. If not uses default.
2. Uses Category, Region, City, Price Min and Max. I don't have Country as i use only one.

The code:

Code: Select all

		if( empty($_SESSION['vOrder'])){
			$_SESSION['vOrder'] = osc_default_order_field_at_search();
		}
		
		if( empty($_SESSION['vOrderType'])){
			$_SESSION["vOrderType"] = osc_default_order_type_at_search();
		}
		
		if($_SESSION['vOrder'] == "dt_pub_date"){
			$order_item = osc_item_pub_date();
		} else {
			$order_item = osc_item_price();
		}
	
		$mSearch = new Search();
		$mSearch->addCategory($_SESSION["vCategory"]);
		$mSearch->addRegion($_SESSION["vRegion"]);
		$mSearch->addCity($_SESSION["vCity"]);
		$mSearch->priceRange($_SESSION["vPriceMin"],$_SESSION["vPriceMax"]);
		if($_SESSION["vOrderType"] == "asc"){
			$mSearch->addItemConditions(sprintf("%st_item.".$_SESSION['vOrder']." <= '%s' ", DB_TABLE_PREFIX, $order_item));
			$mSearch->dao->where('('.sprintf("%st_item.pk_i_id < %s ", DB_TABLE_PREFIX, osc_item_id()).' || '.sprintf("%st_item.".$_SESSION['vOrder']." < '%s' ", DB_TABLE_PREFIX, $order_item).' )');
			$mSearch->order(sprintf("%st_item.".$_SESSION['vOrder'], DB_TABLE_PREFIX), "DESC");
		} else{
			$mSearch->addItemConditions(sprintf("%st_item.".$_SESSION['vOrder']." >= '%s' ", DB_TABLE_PREFIX, $order_item));
			$mSearch->dao->where('('.sprintf("%st_item.pk_i_id > %s ", DB_TABLE_PREFIX, osc_item_id()).' || '.sprintf("%st_item.".$_SESSION['vOrder']." > '%s' ", DB_TABLE_PREFIX, $order_item).' )');
			$mSearch->order(sprintf("%st_item.".$_SESSION['vOrder'], DB_TABLE_PREFIX), "ASC");
		}
		$mSearch->limit('0', '1');
Any help on how to adapt to Tufftheme will be great.

At this point i can identify that in listing page in search we have, already category, region and city. But not the remaining values.

:mrgreen:

User avatar
tuffadmin
Site Admin
Posts: 1236
Joined: Tue Jan 29, 2013 7:31 pm
Has thanked: 33 times
Been thanked: 111 times

Re: Next and Previous AD

Post by tuffadmin » Thu Sep 10, 2015 8:26 pm

renas wrote:Hi,

I have this query from an old template wich i could reuse on this one. Even so i do think that can be improved and well adapted to this great theme.

The structure have some basic format.

1. Saves when possible the order column and direction. If not uses default.
2. Uses Category, Region, City, Price Min and Max. I don't have Country as i use only one.

The code:

Code: Select all

		if( empty($_SESSION['vOrder'])){
			$_SESSION['vOrder'] = osc_default_order_field_at_search();
		}
		
		if( empty($_SESSION['vOrderType'])){
			$_SESSION["vOrderType"] = osc_default_order_type_at_search();
		}
		
		if($_SESSION['vOrder'] == "dt_pub_date"){
			$order_item = osc_item_pub_date();
		} else {
			$order_item = osc_item_price();
		}
	
		$mSearch = new Search();
		$mSearch->addCategory($_SESSION["vCategory"]);
		$mSearch->addRegion($_SESSION["vRegion"]);
		$mSearch->addCity($_SESSION["vCity"]);
		$mSearch->priceRange($_SESSION["vPriceMin"],$_SESSION["vPriceMax"]);
		if($_SESSION["vOrderType"] == "asc"){
			$mSearch->addItemConditions(sprintf("%st_item.".$_SESSION['vOrder']." <= '%s' ", DB_TABLE_PREFIX, $order_item));
			$mSearch->dao->where('('.sprintf("%st_item.pk_i_id < %s ", DB_TABLE_PREFIX, osc_item_id()).' || '.sprintf("%st_item.".$_SESSION['vOrder']." < '%s' ", DB_TABLE_PREFIX, $order_item).' )');
			$mSearch->order(sprintf("%st_item.".$_SESSION['vOrder'], DB_TABLE_PREFIX), "DESC");
		} else{
			$mSearch->addItemConditions(sprintf("%st_item.".$_SESSION['vOrder']." >= '%s' ", DB_TABLE_PREFIX, $order_item));
			$mSearch->dao->where('('.sprintf("%st_item.pk_i_id > %s ", DB_TABLE_PREFIX, osc_item_id()).' || '.sprintf("%st_item.".$_SESSION['vOrder']." > '%s' ", DB_TABLE_PREFIX, $order_item).' )');
			$mSearch->order(sprintf("%st_item.".$_SESSION['vOrder'], DB_TABLE_PREFIX), "ASC");
		}
		$mSearch->limit('0', '1');
Any help on how to adapt to Tufftheme will be great.

At this point i can identify that in listing page in search we have, already category, region and city. But not the remaining values.

:mrgreen:
We made this function to be faster but above code is too slow to make entry in our theme.
No support for unnecessary PM, use forum for support queries.
Please give us good review if you bought our theme from Osclass Market

Locked