Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

Hi All,

I need a previous next button on the product page to go from one product to the next.  Has anyone done this?  I knew how to do it Osc 2.3 but I don't know how to do it on OSC 4

Posted

I found the following code in the admin section but I am not sure how to implement it

<div class="w-prod-page after w-or-prev-next">
    {if isset($app->controller->view->product_prev) && $app->controller->view->product_prev > 0}
    <a href="{$app->urlManager->createUrl(['categories/productedit', 'pID' => $app->controller->view->product_prev])}" class="btn-next-prev-or btn-prev-or" title="{$app->controller->view->product_prev_name}"></a>
    {else}
    <a href="javascript:void(0)" class="btn-next-prev-or btn-prev-or btn-next-prev-or-dis" title=""></a>
    {/if}
    {if isset($app->controller->view->product_next) && $app->controller->view->product_next > 0}
    <a href="{$app->urlManager->createUrl(['categories/productedit', 'pID' => $app->controller->view->product_next])}" class="btn-next-prev-or btn-next-or" title="{$app->controller->view->product_next_name}"></a>
    {else}
    <a href="javascript:void(0)" class="btn-next-prev-or btn-next-or btn-next-prev-or-dis" title=""></a>
    {/if}

 

   $(document).ready(function(){

        const prevNextTop = $('.w-or-prev-next').offset().top;
        const $btnNextPrev = $('.btn-next-prev-or');
        btnNextPrevPosition();
        $(window).on('scroll resize', btnNextPrevPosition)
        function btnNextPrevPosition(){
            let top = $(window).height() / 2 + $(window).scrollTop() - prevNextTop;
            $btnNextPrev.css('top', top)
        }
        
        $('.btn-prev-or, .btn-next-or').click(function(e){
            $(this).attr('href', $(this).attr('href')+window.location.hash);
        })
    
        $(".check_bot_switch_on_off").tlSwitch(
            {
                onText: "{$smarty.const.SW_ON}",
                offText: "{$smarty.const.SW_OFF}",
                handleWidth: '20px',
                labelWidth: '24px'
            }
        );

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...