PDA

View Full Version : Steps when listing



Petrache Nicolae
December 5, 2013, 10:45 PM
i have disabled the abilty to add videos and when i try to create a listing i see 1-6 + Finish (so 7 areas) and if i move forword those turns into 4 + Finish. why they are not shown properly from the begining? in adition to the fact that we should have a 1 page submition page and instead we have 6 or more, not even this is not working ok? a fix please

Chris Brown
December 6, 2013, 07:23 AM
I believe it's shows all the steps available but when you choose a listing plan (depending on why features you have in the plan) itv then re calculates how many steps there are

Petrache Nicolae
December 6, 2013, 07:35 AM
yes. exactly that is doing but the recalculation should be done prior of starting listing. all users prefer a one page submit form compared to a multi step one.

Chris Brown
December 6, 2013, 01:46 PM
recalculation cant be done prior as the listing packages are one of the steps. Then its recalculated depending on the package picked.

Its a hard one really for the best option. As packages are based on what category is picked, and then the rest of the steps are based on the listing package.

Petrache Nicolae
December 6, 2013, 02:00 PM
recalculation cant be done prior as the listing packages are one of the steps. Then its recalculated depending on the package picked.

Its a hard one really for the best option. As packages are based on what category is picked, and then the rest of the steps are based on the listing package.

the step with the movies is atached to the listing types. not to the plans...

Mike
December 12, 2013, 06:55 AM
Hi,

Yes i've just checked and see there is ability to enable-disable video for a listings type in addition to listing plans, but step removing made only after plan selected.
To fix this issue (with wrong steps number when you have disabled video for listing type) please do following


open includes/controllers/add_listing.inc.php

find code


/* get posting type of listing */
$listing_type = $rlListingTypes -> types[$category['Type']];
$rlSmarty -> assign_by_ref('listing_type', $listing_type);


and add this code after



if( !$listing_type['Video'] )
{
unset($steps['video']);
}

Petrache Nicolae
December 12, 2013, 07:27 AM
Hi,

Yes i've just checked and see there is ability to enable-disable video for a listings type in addition to listing plans, but step removing made only after plan selected.
To fix this issue (with wrong steps number when you have disabled video for listing type) please do following


open includes/controllers/add_listing.inc.php

find code


/* get posting type of listing */
$listing_type = $rlListingTypes -> types[$category['Type']];
$rlSmarty -> assign_by_ref('listing_type', $listing_type);


and add this code after



if( !$listing_type['Video'] )
{
unset($steps['video']);
}


not working unfortunaly. when i first enter the new listing process, i see 6 steps wich converts after i select category into 5

Mike
December 12, 2013, 07:56 AM
hmm yes sorry, it will remove step after you selected category.. do you have video enabled for any listing type?

You can solve it like below if its ok to remove video step anywhere

includes/classes/add_listing.inc.php
add just after your copyrights



unset($steps['video']);


if you have several add listing pages for different listing types you can add condition to remove video step only for some pages



if($page_info['Key'] == 'my_jobs')
{
unset($steps['video']);
}


of course instead of my_jobs use right page key (not path, if you want to use path in condition you can change $page_info['Key'] to $page_info['Path'] )

Seems its not critical thing, but anyway we will take it into consideration and i think improve it in one of next versions.

Let me know if you still have problems

Petrache Nicolae
December 13, 2013, 09:56 AM
hmm yes sorry, it will remove step after you selected category.. do you have video enabled for any listing type?

You can solve it like below if its ok to remove video step anywhere

includes/classes/add_listing.inc.php
add just after your copyrights



unset($steps['video']);


if you have several add listing pages for different listing types you can add condition to remove video step only for some pages



if($page_info['Key'] == 'my_jobs')
{
unset($steps['video']);
}


of course instead of my_jobs use right page key (not path, if you want to use path in condition you can change $page_info['Key'] to $page_info['Path'] )

Seems its not critical thing, but anyway we will take it into consideration and i think improve it in one of next versions.

Let me know if you still have problems

unset($steps['video']); is working ok (thanks) and this brings me to another issue with flynax script

let's say that we have just 1 plan. that plan is active by default (as it should), but, even if is only one, we still see it when making a listing. This should not work like this. If we have 2+ plans, makes sense to show the plans so that the user can chose the one he needs. But, if only one is available, what's the point of showing it? Just to present users countless steps wich is discouraging for them?

so i tried to use unset($steps['plan']); and when it reaches the plans steps the process is stopped with a 403 Forbidden error

a solutin to this so we can skip the plans steps when we have just 1? thanks

Mike
December 16, 2013, 05:39 AM
Ok, i have a solution for you )

but is not perfect and suppose some "hardcoding" , so its not solution for "if plan is only one skip plans step" but it allows to remove plans step


1. add_listing.inc.php

in place where you unset $steps['plan']

add line $_SESSION['add_listing']['plan_id'] = 1; but instead of 1 use the right plan id (which is your one available plan)

You have to do it because plans depending of category, and before you selected category you dont have available plans to select from.


2. template/tpl/blocks/category_level.tpl

find code {$steps.plan.path} and replace with {$steps.form.path}
(2 appearances)


Hope it will help.

Petrache Nicolae
December 16, 2013, 07:16 AM
Hello Mike. I apreciate your help and i bet other users as well. This is a solution wich should exist by default in flynax script.

Works great except 2 issues
1. - when i start to create the listing (chose category), i see 5 steps +finalisation. after i select the category and move forword, the 5 steps is showing now 4 steps + finalisation.
so, how can i hide this extra step -i assume it is plans even if i have added unset($steps['plan']); ?

2. if i move forword with the steps and than decide to go back, when i try to reach step 1 (chose category) i get a 403 error and can't go back to chose another ocategory unless i refresh the page. so looks like skiping the step is cousing the issue and i think is relates to issue 1. in wich i see an extra step wich should not show

beside this 2 issues, the process is going well, listing is created fine and i can edit it ok

Viktor
December 16, 2013, 08:35 AM
Hello Petrache,

1. You can remove steps here:
ftp://libs>>system.lib.php

find array:



$steps = array(
'category' => array(
'name' => $lang['select_category'],
'caption' => true,
),
'plan' => array(
'name' => $lang['select_plan'],
'caption' => true,
'path' => 'select-a-plan'
),
'form' => array(
'name' => $lang['fill_out_form'],
'caption' => true,
'path' => 'fill-out-a-form'
),
'photo' => array(
'name' => $lang['add_photo'],
'caption' => true,
'path' => 'add-pictures'
),
'video' => array(
'name' => $lang['add_video'],
'caption' => true,
'path' => 'add-video'
),
'checkout' => array(
'name' => $lang['checkout'],
'caption' => true,
'path' => 'checkout'
)
);

and remove



'plan' => array(
'name' => $lang['select_plan'],
'caption' => true,
'path' => 'select-a-plan'
),



2. Please implement 1-st point and may be 2-nd point will be solve automatically.

Petrache Nicolae
December 16, 2013, 12:27 PM
Hello Petrache,

1. You can remove steps here:
ftp://libs>>system.lib.php

find array:



$steps = array(
'category' => array(
'name' => $lang['select_category'],
'caption' => true,
),
'plan' => array(
'name' => $lang['select_plan'],
'caption' => true,
'path' => 'select-a-plan'
),
'form' => array(
'name' => $lang['fill_out_form'],
'caption' => true,
'path' => 'fill-out-a-form'
),
'photo' => array(
'name' => $lang['add_photo'],
'caption' => true,
'path' => 'add-pictures'
),
'video' => array(
'name' => $lang['add_video'],
'caption' => true,
'path' => 'add-video'
),
'checkout' => array(
'name' => $lang['checkout'],
'caption' => true,
'path' => 'checkout'
)
);

and remove



'plan' => array(
'name' => $lang['select_plan'],
'caption' => true,
'path' => 'select-a-plan'
),



2. Please implement 1-st point and may be 2-nd point will be solve automatically.


turns out that the extra step that is showing when creating the listing is "checkout". that should not show as well if there is no payed plan, so another bug.

in any case, i have removed

'plan' => array(
'name' => $lang['select_plan'],
'caption' => true,
'path' => 'select-a-plan'
),

and i have the same issue when i try to go back and change the category - 403 error, so i reverted back the change. any other ideea?


i just noticed something. if i click on the back arrow from the bottom of the listing i get the 403 error, but, if i click on the round 1 step, from above the listing, that is working ok. in any case, the links are different
if i click on back arrow, the link is http://my-website/adauga-anunt/laptopuri/.html
if i click on the round 1 step, the link is http://my-website/adauga-anunt.html?edit

why they are not identical?

Mike
January 16, 2014, 11:05 AM
Try other changes, restore original file and try next changes, let me know if you have problems with it. This solution is more flexible and it will work without hardcoding anyghing. when you have only one active plan it will remove unnecessary steps automatically

1. includes/controllers/add_listing.inc.php almost end of file ~1100 line




else
{
if ( !$_REQUEST['xjxfun'] )
{
$rlHook -> load('addListingGetCats');
$sections = $rlCategories -> getCatTree(0, $account_info['Abilities'], true);
$rlSmarty -> assign_by_ref( 'sections', $sections );

/*add this code */
$plan_info = $rlDb -> getRow("SELECT *, COUNT(*) as `count` FROM `".RL_DBPREFIX."listing_plans` WHERE `Status` = 'active'");

if( $plan_info['count'] == '1' && !$plan_info['Advanced_mode'] && $plan_info['Sticky'] )
{
$_SESSION['add_listing']['plan_id'] = $plan_info['ID'];
$_SESSION['add_listing']['no_plan_step'] = true;
unset($steps['plan']);

/* remove steps depending of plan and listing type */
if ( $plan_info )
{
if ( !$plan_info['Image'] && !$plan_info['Image_unlim'] )
{
unset($steps['photo']);
}
if ( !$plan_info['Video'] && !$plan_info['Video_unlim'] )
{
unset($steps['video']);
}
if ( ($plan_info['Type'] == 'package' && ($plan_info['Package_ID'] || $plan_info['Price'] <= 0) ) || ($plan_info['Type'] == 'listing' && $plan_info['Price'] <= 0) )
{
unset($steps['checkout']);
}
}
}
/*end*/
}




2. same file (add_listing.inc.php) ~50 line



/*add this code*/
if( $_SESSION['add_listing']['no_plan_step'] )
{
unset($steps['plan']);
}

/* build registration steps */
$rlHook -> load('addListingSteps');



3. and final change template/tpl/blocks/category_level.tpl


find code and replace with code below



<li id="tree_cat_{$cat.ID}" {if $cat.Lock}class="locked"{/if}>
<img {if !$sub_leval}class="no_child"{/if} src="{$rlTplBase}img/blank.gif" alt="" />
<a title="{$lang.add_listing_to|replace:$replace:$cat.name}" {if $cat.Lock}class="cursor_default"{/if} href="{if $cat.Lock}javascript:void(0);{else}{$rlBase}{if $config.mod_rewrite}{$pageInfo.Path}/{if $cat.Tmp}tmp-category{else}{$cat.Path}{/if}/{if $steps.plan}{$steps.plan.path}{else}{$steps.form.p ath}{/if}.html{if $cat.Tmp}?tmp_id={$cat.ID}{/if}{else}?page={$pageInfo.Path}&amp;step={if $steps.plan}{$steps.plan.path}{else}{$steps.form.p ath}{/if}&amp;{if $cat.Tmp}tmp_id{else}id{/if}={$cat.ID}{/if}{/if}">{$cat.name}</a>
<span class="tree_loader"></span>
</li>