T
T
timers2020-05-13 19:35:33
PHP
timers, 2020-05-13 19:35:33

Requests intersect, how to solve?

The code:

$id = $_REQUEST['id'];
if( $id )
  {
    
    $result = $db->query( "SELECT * FROM ".PREFIX."_shop_post WHERE `alt_name`='{$id}' LIMIT 1" );
    $Allow = ( $db->num_rows( $result ) > 0 ) ? true : false;
    
    if( $Allow === true )
      {
        $row = $db->get_row( $result );
        $approve = intval( $row['approve'] );
        
        if( $approve != 1 )
          {
            $Allow = false;
            $errorAllow = "Товара нет";
          }
      }
    if( $Allow === true )
      {
        $id = $row['id'];
        $ids = $row['id'];
        $title = htmlspecialchars( stripslashes( $row['title'] ), ENT_QUOTES, $config['charset'] );
         
        //--------------------------------------------------=-=-=-=-=
        //	Тут делаем запрос на вывод привязанных вип товаров
        //--------------------------------------------------=-=-=-=-=				
        $Listing = array(						
          "template"		=> "shop/shop_vip_short.tpl",
          "tpl_compiles"	=> "shop_vip_content",
          "sql_count"		=> "SELECT COUNT(*) as count FROM ".PREFIX."_shop_vip_post WHERE shop_vip_topvar='{$ids}'",
          "sql_query"		=> "SELECT * FROM ".PREFIX."_shop_vip_post WHERE shop_vip_topvar='{$ids}'",
          "no_news_error" => "Не обнаружено.",							
        );
        require( DLEPlugins::Check(ENGINE_DIR."/modules/shop/vip.post.php") );
        $List = $tpl->result['shop_vip_content'];
                
        //--------------------------------------------------=-=-=-=-=
        //	Выводим сам товар
        //--------------------------------------------------=-=-=-=-=
        
        $tpl->Load_Template( "shop/shop_full.tpl" );
                        
        $tpl->set( "{id}", $id );			
        $tpl->set( "{title}", $title );
        $tpl->set( "{list}", $List );
        $tpl->copy_template = $Shop->ParsePhotos( $tpl->copy_template, $row['photos'] );	

        if( $Shop->Field !== false ) $tpl->copy_template = $Shop->Field->ParseTags( $tpl->copy_template, $row['xfields'] );
                        
        $tpl->compile( "shop_content" );
        $tpl->clear();				
      }
        else
      {
        $tpl->Load_Template( "info.tpl" );
        $tpl->set( "{title}", "Ошибка" );
        $tpl->set( "{error}", $errorAllow );
        $tpl->compile( "shop_content" );
        $tpl->clear();
      }

  }


The DLE engine has 2 tables, dle_shop_post and dle_shop_vip_post

The dle_shop_vip_post table has a shop_vip_topvar column where the id of the linked dle_shop_post product is written

. here - $Shop and there $Shop_Vip, thus the engine gets confused and displays the main info from $Shop_Vip. the main ID now becomes from there.

How can this problem be solved?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question