Count checkout steps
8 years 1 month ago #296603
by kyratn
Count checkout steps was created by kyratn
Hi,
Is there a way to count checkout steps in custom component or joomla template? Our template use different templates views based on menu item. So i have tried to use this:
but it doesn't work...
We would like to have different modules/styles based on checkout steps.
Thank you
Is there a way to count checkout steps in custom component or joomla template? Our template use different templates views based on menu item. So i have tried to use this:
Code:
if(!@include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')){ return false; }
$steps = count($this->checkoutHelper->checkout_workflow['steps']);
but it doesn't work...
We would like to have different modules/styles based on checkout steps.
Thank you
Please Log in or Create an account to join the conversation.
8 years 1 month ago #296604
by nicolas
Replied by nicolas on topic Count checkout steps
Hi,
In your code, you load HikaShop and then you try to directly use the variable, but you need to first initialize the checkoutHelper variable before you can use it.
You can do it like that:
In your code, you load HikaShop and then you try to directly use the variable, but you need to first initialize the checkoutHelper variable before you can use it.
You can do it like that:
Code:
if(!@include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')){ return false; }
hikashop_get('helper.checkout');
$checkoutHelper = hikashopCheckoutHelper::get();
$steps = count($checkoutHelper->checkout_workflow['steps']);
The following user(s) said Thank You: kyratn
Please Log in or Create an account to join the conversation.
8 years 1 month ago #297147
by kyratn
Replied by kyratn on topic Count checkout steps
Hi,
Thank you for help Nicolas but it seems i am not able to asign content based on current checkout step. I am not sure if it is possible at all....
Based on "show_block_bar.php" view I have tried like this:
And it shows on all checkout steps....
I think the main isue is that i use:
instead of:
Using:
It just returns how many steps you have on checkout....
Not sure how it works but is it possible to check current checkout step at all?
Any help would be appreciated.
Thank you
Thank you for help Nicolas but it seems i am not able to asign content based on current checkout step. I am not sure if it is possible at all....
Based on "show_block_bar.php" view I have tried like this:
Code:
$workflow = $checkoutHelper->checkout_workflow;
foreach($workflow['steps'] as $k => $step) {
if($k == 0) { echo 'step-1';}
}
And it shows on all checkout steps....
I think the main isue is that i use:
Code:
$checkoutHelper->checkout_workflow;
instead of:
Code:
$this->checkoutHelper->checkout_workflow;
Using:
Code:
$steps = count($checkoutHelper->checkout_workflow['steps']);
It just returns how many steps you have on checkout....
Not sure how it works but is it possible to check current checkout step at all?
Any help would be appreciated.
Thank you
Please Log in or Create an account to join the conversation.
8 years 1 month ago #297175
by GW
Replied by GW on topic Count checkout steps
Hi,
why not simply check the url which step you are at, we frequently do it this way:
Hope that helps!
why not simply check the url which step you are at, we frequently do it this way:
Code:
if(strpos($_SERVER['REQUEST_URI'],'step-1')){
//SHOW SOMETHING ONLY FOR STEP 1
elseif(strpos($_SERVER['REQUEST_URI'],'step-2')){
//SHOW SOMETHING ONLY FOR STEP 2
}
etc...
Hope that helps!
Please Log in or Create an account to join the conversation.
8 years 1 month ago #297184
by kyratn
Replied by kyratn on topic Count checkout steps
Hi,
Well, it's a good way. Thanks GW. However i needed some kinda variable....
Anyway, we found that Joomla has nice function to set template like this:
We have managed to do what we need.
Kind Regards
Well, it's a good way. Thanks GW. However i needed some kinda variable....
Anyway, we found that Joomla has nice function to set template like this:
Code:
$app = JFactory::getApplication();
$app->setTemplate('protostar');
We have managed to do what we need.
Kind Regards
Please Log in or Create an account to join the conversation.
8 years 1 month ago - 8 years 1 month ago #297177
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Count checkout steps
Hello,
Reading the parameter "step" using the Joomla core functions would be a more appropriate solution:
docs.joomla.org/Retrieving_request_data_using_JInput
Regards,
Reading the parameter "step" using the Joomla core functions would be a more appropriate solution:
docs.joomla.org/Retrieving_request_data_using_JInput
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Last edit: 8 years 1 month ago by nicolas.
Please Log in or Create an account to join the conversation.
Time to create page: 0.187 seconds